test_class.declarator: zkServer
test_class.modifier: private
test_class.original_string: private TestingServer zkServer;
test_class.type: TestingServer
test_class.var_name: zkServer
test_class.declarator: zookeeperClient
test_class.modifier: private
test_class.original_string: private ZookeeperClient zookeeperClient;
test_class.type: ZookeeperClient
test_class.var_name: zookeeperClient
test_class.declarator: abstractZookeeperTransporter
test_class.modifier: private
test_class.original_string: private AbstractZookeeperTransporter abstractZookeeperTransporter;
test_class.type: AbstractZookeeperTransporter
test_class.var_name: abstractZookeeperTransporter
test_class.declarator: zkServerPort
test_class.modifier: private
test_class.original_string: private int zkServerPort;
test_class.type: int
test_class.var_name: zkServerPort
test_class.file: dubbo-remoting/dubbo-remoting-zookeeper/src/test/java/org/apache/dubbo/remoting/zookeeper/support/AbstractZookeeperTransporterTest.java
test_class.identifier: AbstractZookeeperTransporterTest
test_case.body: @Test
      public void testFetchAndUpdateZookeeperClientCache() throws Exception {
          int zkServerPort2 = NetUtils.getAvailablePort();
          TestingServer zkServer2 = new TestingServer(zkServerPort2, true);
  
          int zkServerPort3 = NetUtils.getAvailablePort();
          TestingServer zkServer3 = new TestingServer(zkServerPort3, true);
  
          URL url = URL.valueOf("zookeeper://127.0.0.1:" + zkServerPort + "/org.apache.dubbo.registry.RegistryService?backup=127.0.0.1:" + zkServerPort3 + ",127.0.0.1:" + zkServerPort2 + "&application=metadatareport-local-xml-provider2&dubbo=2.0.2&interface=org.apache.dubbo.registry.RegistryService&pid=47418&specVersion=2.7.0-SNAPSHOT&timestamp=1547102428828");
          ZookeeperClient newZookeeperClient = abstractZookeeperTransporter.connect(url);
          //just for connected
          newZookeeperClient.getContent("/dubbo/test");
          Assertions.assertEquals(abstractZookeeperTransporter.getZookeeperClientMap().size(), 3);
          Assertions.assertEquals(abstractZookeeperTransporter.getZookeeperClientMap().get("127.0.0.1:" + zkServerPort), newZookeeperClient);
  
          URL url2 = URL.valueOf("zookeeper://127.0.0.1:" + zkServerPort + "/org.apache.dubbo.metadata.store.MetadataReport?address=zookeeper://127.0.0.1:2181&application=metadatareport-local-xml-provider2&cycle-report=false&interface=org.apache.dubbo.metadata.store.MetadataReport&retry-period=4590&retry-times=23&sync-report=true");
          checkFetchAndUpdateCacheNotNull(url2);
          URL url3 = URL.valueOf("zookeeper://127.0.0.1:8778/org.apache.dubbo.metadata.store.MetadataReport?backup=127.0.0.1:" + zkServerPort3 + "&address=zookeeper://127.0.0.1:2181&application=metadatareport-local-xml-provider2&cycle-report=false&interface=org.apache.dubbo.metadata.store.MetadataReport&retry-period=4590&retry-times=23&sync-report=true");
          checkFetchAndUpdateCacheNotNull(url3);
  
          zkServer2.stop();
          zkServer3.stop();
      }
test_case.class_method_signature: AbstractZookeeperTransporterTest.testFetchAndUpdateZookeeperClientCache()
test_case.full_signature: @Test public void testFetchAndUpdateZookeeperClientCache()
test_case.identifier: testFetchAndUpdateZookeeperClientCache
test_case.invocations: getAvailablePort getAvailablePort valueOf connect getContent assertEquals size getZookeeperClientMap assertEquals get getZookeeperClientMap valueOf checkFetchAndUpdateCacheNotNull valueOf checkFetchAndUpdateCacheNotNull stop stop
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testFetchAndUpdateZookeeperClientCache()
focal_class.declarator: logger = LoggerFactory.getLogger(ZookeeperTransporter.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger logger = LoggerFactory.getLogger(ZookeeperTransporter.class);
focal_class.type: Logger
focal_class.var_name: logger
focal_class.declarator: zookeeperClientMap = new ConcurrentHashMap<>()
focal_class.modifier: private final
focal_class.original_string: private final Map<String, ZookeeperClient> zookeeperClientMap = new ConcurrentHashMap<>();
focal_class.type: Map<String, ZookeeperClient>
focal_class.var_name: zookeeperClientMap
focal_class.file: dubbo-remoting/dubbo-remoting-zookeeper/src/main/java/org/apache/dubbo/remoting/zookeeper/support/AbstractZookeeperTransporter.java
focal_class.identifier: AbstractZookeeperTransporter
focal_class.interfaces: implements ZookeeperTransporter
focal_class.class_method_signature: AbstractZookeeperTransporter.connect(URL url)
focal_class.full_signature: @Override public ZookeeperClient connect(URL url)
focal_class.identifier: connect
focal_class.modifiers: @Override public
focal_class.parameters: (URL url)
focal_class.return: ZookeeperClient
focal_class.signature: ZookeeperClient connect(URL url)
focal_class.class_method_signature: AbstractZookeeperTransporter.createZookeeperClient(URL url)
focal_class.full_signature: protected abstract ZookeeperClient createZookeeperClient(URL url)
focal_class.identifier: createZookeeperClient
focal_class.modifiers: protected abstract
focal_class.parameters: (URL url)
focal_class.return: ZookeeperClient
focal_class.signature: ZookeeperClient createZookeeperClient(URL url)
focal_class.class_method_signature: AbstractZookeeperTransporter.fetchAndUpdateZookeeperClientCache(List<String> addressList)
focal_class.full_signature:  ZookeeperClient fetchAndUpdateZookeeperClientCache(List<String> addressList)
focal_class.identifier: fetchAndUpdateZookeeperClientCache
focal_class.parameters: (List<String> addressList)
focal_class.return: ZookeeperClient
focal_class.signature: ZookeeperClient fetchAndUpdateZookeeperClientCache(List<String> addressList)
focal_class.class_method_signature: AbstractZookeeperTransporter.getURLBackupAddress(URL url)
focal_class.full_signature:  List<String> getURLBackupAddress(URL url)
focal_class.identifier: getURLBackupAddress
focal_class.parameters: (URL url)
focal_class.return: List<String>
focal_class.signature: List<String> getURLBackupAddress(URL url)
focal_class.class_method_signature: AbstractZookeeperTransporter.writeToClientMap(List<String> addressList, ZookeeperClient zookeeperClient)
focal_class.full_signature:  void writeToClientMap(List<String> addressList, ZookeeperClient zookeeperClient)
focal_class.identifier: writeToClientMap
focal_class.parameters: (List<String> addressList, ZookeeperClient zookeeperClient)
focal_class.return: void
focal_class.signature: void writeToClientMap(List<String> addressList, ZookeeperClient zookeeperClient)
focal_class.class_method_signature: AbstractZookeeperTransporter.toClientURL(URL url)
focal_class.full_signature:  URL toClientURL(URL url)
focal_class.identifier: toClientURL
focal_class.parameters: (URL url)
focal_class.return: URL
focal_class.signature: URL toClientURL(URL url)
focal_class.class_method_signature: AbstractZookeeperTransporter.getZookeeperClientMap()
focal_class.full_signature:  Map<String, ZookeeperClient> getZookeeperClientMap()
focal_class.identifier: getZookeeperClientMap
focal_class.parameters: ()
focal_class.return: Map<String, ZookeeperClient>
focal_class.signature: Map<String, ZookeeperClient> getZookeeperClientMap()
focal_method.body: 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;
      }
focal_method.class_method_signature: AbstractZookeeperTransporter.fetchAndUpdateZookeeperClientCache(List<String> addressList)
focal_method.full_signature:  ZookeeperClient fetchAndUpdateZookeeperClientCache(List<String> addressList)
focal_method.identifier: fetchAndUpdateZookeeperClientCache
focal_method.invocations: get isConnected isConnected writeToClientMap
focal_method.parameters: (List<String> addressList)
focal_method.return: ZookeeperClient
focal_method.signature: ZookeeperClient fetchAndUpdateZookeeperClientCache(List<String> addressList)