gpt4 book ai didi

org.apache.dubbo.remoting.zookeeper.ZookeeperClient.isConnected()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-18 02:51:31 27 4
gpt4 key购买 nike

本文整理了Java中org.apache.dubbo.remoting.zookeeper.ZookeeperClient.isConnected()方法的一些代码示例,展示了ZookeeperClient.isConnected()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZookeeperClient.isConnected()方法的具体详情如下:
包路径:org.apache.dubbo.remoting.zookeeper.ZookeeperClient
类名称:ZookeeperClient
方法名:isConnected

ZookeeperClient.isConnected介绍

暂无

代码示例

代码示例来源:origin: apache/incubator-dubbo

@Override
public boolean isAvailable() {
  return zkClient.isConnected();
}

代码示例来源:origin: apache/incubator-dubbo

@Override
public boolean isAvailable() {
  return zkClient.isConnected();
}

代码示例来源:origin: apache/incubator-dubbo

/**
 * get the ZookeeperClient from cache, the ZookeeperClient must be connected.
 * <p>
 * It is not private method for unit test.
 *
 * @param addressList
 * @return
 */
ZookeeperClient fetchAndUpdateZookeeperClientCache(List<String> addressList) {
  ZookeeperClient zookeeperClient = null;
  for (String address : addressList) {
    if ((zookeeperClient = zookeeperClientMap.get(address)) != null && zookeeperClient.isConnected()) {
      break;
    }
  }
  if (zookeeperClient != null && zookeeperClient.isConnected()) {
    writeToClientMap(addressList, zookeeperClient);
  }
  return zookeeperClient;
}

代码示例来源:origin: apache/incubator-dubbo

/**
 * get the ZookeeperClient from cache, the ZookeeperClient must be connected.
 * <p>
 * It is not private method for unit test.
 *
 * @param addressList
 * @return
 */
ZookeeperClient fetchAndUpdateZookeeperClientCache(List<String> addressList) {
  ZookeeperClient zookeeperClient = null;
  for (String address : addressList) {
    if ((zookeeperClient = zookeeperClientMap.get(address)) != null && zookeeperClient.isConnected()) {
      break;
    }
  }
  if (zookeeperClient != null && zookeeperClient.isConnected()) {
    writeToClientMap(addressList, zookeeperClient);
  }
  return zookeeperClient;
}

代码示例来源:origin: apache/incubator-dubbo

/**
 * share connnect for registry, metadata, etc..
 * <p>
 * Make sure the connection is connected.
 *
 * @param url
 * @return
 */
@Override
public ZookeeperClient connect(URL url) {
  ZookeeperClient zookeeperClient;
  List<String> addressList = getURLBackupAddress(url);
  // The field define the zookeeper server , including protocol, host, port, username, password
  if ((zookeeperClient = fetchAndUpdateZookeeperClientCache(addressList)) != null && zookeeperClient.isConnected()) {
    logger.info("find valid zookeeper client from the cache for address: " + url);
    return zookeeperClient;
  }
  // avoid creating too many connections, so add lock
  synchronized (zookeeperClientMap) {
    if ((zookeeperClient = fetchAndUpdateZookeeperClientCache(addressList)) != null && zookeeperClient.isConnected()) {
      logger.info("find valid zookeeper client from the cache for address: " + url);
      return zookeeperClient;
    }
    zookeeperClient = createZookeeperClient(toClientURL(url));
    logger.info("No valid zookeeper client found from cache, therefore create a new client for url. " + url);
    writeToClientMap(addressList, zookeeperClient);
  }
  return zookeeperClient;
}

代码示例来源:origin: apache/incubator-dubbo

/**
 * share connnect for registry, metadata, etc..
 * <p>
 * Make sure the connection is connected.
 *
 * @param url
 * @return
 */
@Override
public ZookeeperClient connect(URL url) {
  ZookeeperClient zookeeperClient;
  List<String> addressList = getURLBackupAddress(url);
  // The field define the zookeeper server , including protocol, host, port, username, password
  if ((zookeeperClient = fetchAndUpdateZookeeperClientCache(addressList)) != null && zookeeperClient.isConnected()) {
    logger.info("find valid zookeeper client from the cache for address: " + url);
    return zookeeperClient;
  }
  // avoid creating too many connections, so add lock
  synchronized (zookeeperClientMap) {
    if ((zookeeperClient = fetchAndUpdateZookeeperClientCache(addressList)) != null && zookeeperClient.isConnected()) {
      logger.info("find valid zookeeper client from the cache for address: " + url);
      return zookeeperClient;
    }
    zookeeperClient = createZookeeperClient(toClientURL(url));
    logger.info("No valid zookeeper client found from cache, therefore create a new client for url. " + url);
    writeToClientMap(addressList, zookeeperClient);
  }
  return zookeeperClient;
}

代码示例来源:origin: org.apache.dubbo/dubbo

@Override
public boolean isAvailable() {
  return zkClient.isConnected();
}

代码示例来源:origin: org.apache.dubbo/dubbo-registry-zookeeper

@Override
public boolean isAvailable() {
  return zkClient.isConnected();
}

代码示例来源:origin: org.apache.dubbo/dubbo

/**
 * get the ZookeeperClient from cache, the ZookeeperClient must be connected.
 * <p>
 * It is not private method for unit test.
 *
 * @param addressList
 * @return
 */
ZookeeperClient fetchAndUpdateZookeeperClientCache(List<String> addressList) {
  ZookeeperClient zookeeperClient = null;
  for (String address : addressList) {
    if ((zookeeperClient = zookeeperClientMap.get(address)) != null && zookeeperClient.isConnected()) {
      break;
    }
  }
  if (zookeeperClient != null && zookeeperClient.isConnected()) {
    writeToClientMap(addressList, zookeeperClient);
  }
  return zookeeperClient;
}

代码示例来源:origin: org.apache.dubbo/dubbo-remoting-zookeeper

/**
 * get the ZookeeperClient from cache, the ZookeeperClient must be connected.
 * <p>
 * It is not private method for unit test.
 *
 * @param addressList
 * @return
 */
ZookeeperClient fetchAndUpdateZookeeperClientCache(List<String> addressList) {
  ZookeeperClient zookeeperClient = null;
  for (String address : addressList) {
    if ((zookeeperClient = zookeeperClientMap.get(address)) != null && zookeeperClient.isConnected()) {
      break;
    }
  }
  if (zookeeperClient != null && zookeeperClient.isConnected()) {
    writeToClientMap(addressList, zookeeperClient);
  }
  return zookeeperClient;
}

代码示例来源:origin: org.apache.dubbo/dubbo-remoting-zookeeper

/**
 * share connnect for registry, metadata, etc..
 * <p>
 * Make sure the connection is connected.
 *
 * @param url
 * @return
 */
public ZookeeperClient connect(URL url) {
  ZookeeperClient zookeeperClient;
  List<String> addressList = getURLBackupAddress(url);
  // The field define the zookeeper server , including protocol, host, port, username, password
  if ((zookeeperClient = fetchAndUpdateZookeeperClientCache(addressList)) != null && zookeeperClient.isConnected()) {
    logger.info("find valid zookeeper client from the cache for address: " + url);
    return zookeeperClient;
  }
  // avoid creating too many connections, so add lock
  synchronized (zookeeperClientMap) {
    if ((zookeeperClient = fetchAndUpdateZookeeperClientCache(addressList)) != null && zookeeperClient.isConnected()) {
      logger.info("find valid zookeeper client from the cache for address: " + url);
      return zookeeperClient;
    }
    zookeeperClient = createZookeeperClient(toClientURL(url));
    logger.info("No valid zookeeper client found from cache, therefore create a new client for url. " + url);
    writeToClientMap(addressList, zookeeperClient);
  }
  return zookeeperClient;
}

代码示例来源:origin: org.apache.dubbo/dubbo

/**
 * share connnect for registry, metadata, etc..
 * <p>
 * Make sure the connection is connected.
 *
 * @param url
 * @return
 */
public ZookeeperClient connect(URL url) {
  ZookeeperClient zookeeperClient;
  List<String> addressList = getURLBackupAddress(url);
  // The field define the zookeeper server , including protocol, host, port, username, password
  if ((zookeeperClient = fetchAndUpdateZookeeperClientCache(addressList)) != null && zookeeperClient.isConnected()) {
    logger.info("find valid zookeeper client from the cache for address: " + url);
    return zookeeperClient;
  }
  // avoid creating too many connections, so add lock
  synchronized (zookeeperClientMap) {
    if ((zookeeperClient = fetchAndUpdateZookeeperClientCache(addressList)) != null && zookeeperClient.isConnected()) {
      logger.info("find valid zookeeper client from the cache for address: " + url);
      return zookeeperClient;
    }
    zookeeperClient = createZookeeperClient(toClientURL(url));
    logger.info("No valid zookeeper client found from cache, therefore create a new client for url. " + url);
    writeToClientMap(addressList, zookeeperClient);
  }
  return zookeeperClient;
}

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com