test_class.declarator: etcdServiceDiscovery
test_class.modifier: static
test_class.original_string: static EtcdServiceDiscovery etcdServiceDiscovery;
test_class.type: EtcdServiceDiscovery
test_class.var_name: etcdServiceDiscovery
test_class.file: dubbo-registry/dubbo-registry-etcd3/src/test/java/org/apache/dubbo/registry/etcd/EtcdServiceDiscoveryTest.java
test_class.identifier: EtcdServiceDiscoveryTest
test_case.body: @Test
      public void testUpdate() throws Exception {
          DefaultServiceInstance serviceInstance = new DefaultServiceInstance(valueOf(System.nanoTime()), "EtcdTest34Service", "127.0.0.1", 8080);
          Assertions.assertNull(etcdServiceDiscovery.etcdClient.getKVValue(etcdServiceDiscovery.toPath(serviceInstance)));
          etcdServiceDiscovery.register(serviceInstance);
          Assertions.assertNotNull(etcdServiceDiscovery.etcdClient.getKVValue(etcdServiceDiscovery.toPath(serviceInstance)));
          Assertions.assertEquals(etcdServiceDiscovery.etcdClient.getKVValue(etcdServiceDiscovery.toPath(serviceInstance)),
                  new Gson().toJson(serviceInstance));
          serviceInstance.setPort(9999);
          etcdServiceDiscovery.update(serviceInstance);
          Assertions.assertNotNull(etcdServiceDiscovery.etcdClient.getKVValue(etcdServiceDiscovery.toPath(serviceInstance)));
          Assertions.assertEquals(etcdServiceDiscovery.etcdClient.getKVValue(etcdServiceDiscovery.toPath(serviceInstance)),
                  new Gson().toJson(serviceInstance));
      }
test_case.class_method_signature: EtcdServiceDiscoveryTest.testUpdate()
test_case.full_signature: @Test public void testUpdate()
test_case.identifier: testUpdate
test_case.invocations: valueOf nanoTime assertNull getKVValue toPath register assertNotNull getKVValue toPath assertEquals getKVValue toPath toJson setPort update assertNotNull getKVValue toPath assertEquals getKVValue toPath toJson
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testUpdate()
focal_class.declarator: logger = LoggerFactory.getLogger(EtcdServiceDiscovery.class)
focal_class.modifier: private final static
focal_class.original_string: private final static Logger logger = LoggerFactory.getLogger(EtcdServiceDiscovery.class);
focal_class.type: Logger
focal_class.var_name: logger
focal_class.declarator: root = "/services"
focal_class.modifier: private final
focal_class.original_string: private final String root = "/services";
focal_class.type: String
focal_class.var_name: root
focal_class.declarator: services = new ConcurrentHashSet<>()
focal_class.modifier: private final
focal_class.original_string: private final Set<String> services = new ConcurrentHashSet<>();
focal_class.type: Set<String>
focal_class.var_name: services
focal_class.declarator: childListenerMap = new ConcurrentHashMap<>()
focal_class.modifier: private final
focal_class.original_string: private final Map<String, ChildListener> childListenerMap = new ConcurrentHashMap<>();
focal_class.type: Map<String, ChildListener>
focal_class.var_name: childListenerMap
focal_class.declarator: etcdClient
focal_class.original_string: EtcdClient etcdClient;
focal_class.type: EtcdClient
focal_class.var_name: etcdClient
focal_class.declarator: dispatcher
focal_class.original_string: EventDispatcher dispatcher;
focal_class.type: EventDispatcher
focal_class.var_name: dispatcher
focal_class.declarator: serviceInstance
focal_class.original_string: ServiceInstance serviceInstance;
focal_class.type: ServiceInstance
focal_class.var_name: serviceInstance
focal_class.file: dubbo-registry/dubbo-registry-etcd3/src/main/java/org/apache/dubbo/registry/etcd/EtcdServiceDiscovery.java
focal_class.identifier: EtcdServiceDiscovery
focal_class.interfaces: implements EventListener<ServiceInstancesChangedEvent>
focal_class.class_method_signature: EtcdServiceDiscovery.onEvent(ServiceInstancesChangedEvent event)
focal_class.full_signature: @Override public void onEvent(ServiceInstancesChangedEvent event)
focal_class.identifier: onEvent
focal_class.modifiers: @Override public
focal_class.parameters: (ServiceInstancesChangedEvent event)
focal_class.return: void
focal_class.signature: void onEvent(ServiceInstancesChangedEvent event)
focal_class.class_method_signature: EtcdServiceDiscovery.initialize(URL registryURL)
focal_class.full_signature: @Override public void initialize(URL registryURL)
focal_class.identifier: initialize
focal_class.modifiers: @Override public
focal_class.parameters: (URL registryURL)
focal_class.return: void
focal_class.signature: void initialize(URL registryURL)
focal_class.class_method_signature: EtcdServiceDiscovery.destroy()
focal_class.full_signature: @Override public void destroy()
focal_class.identifier: destroy
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void destroy()
focal_class.class_method_signature: EtcdServiceDiscovery.register(ServiceInstance serviceInstance)
focal_class.full_signature: @Override public void register(ServiceInstance serviceInstance)
focal_class.identifier: register
focal_class.modifiers: @Override public
focal_class.parameters: (ServiceInstance serviceInstance)
focal_class.return: void
focal_class.signature: void register(ServiceInstance serviceInstance)
focal_class.class_method_signature: EtcdServiceDiscovery.toPath(ServiceInstance serviceInstance)
focal_class.full_signature:  String toPath(ServiceInstance serviceInstance)
focal_class.identifier: toPath
focal_class.parameters: (ServiceInstance serviceInstance)
focal_class.return: String
focal_class.signature: String toPath(ServiceInstance serviceInstance)
focal_class.class_method_signature: EtcdServiceDiscovery.toParentPath(String serviceName)
focal_class.full_signature:  String toParentPath(String serviceName)
focal_class.identifier: toParentPath
focal_class.parameters: (String serviceName)
focal_class.return: String
focal_class.signature: String toParentPath(String serviceName)
focal_class.class_method_signature: EtcdServiceDiscovery.update(ServiceInstance serviceInstance)
focal_class.full_signature: @Override public void update(ServiceInstance serviceInstance)
focal_class.identifier: update
focal_class.modifiers: @Override public
focal_class.parameters: (ServiceInstance serviceInstance)
focal_class.return: void
focal_class.signature: void update(ServiceInstance serviceInstance)
focal_class.class_method_signature: EtcdServiceDiscovery.unregister(ServiceInstance serviceInstance)
focal_class.full_signature: @Override public void unregister(ServiceInstance serviceInstance)
focal_class.identifier: unregister
focal_class.modifiers: @Override public
focal_class.parameters: (ServiceInstance serviceInstance)
focal_class.return: void
focal_class.signature: void unregister(ServiceInstance serviceInstance)
focal_class.class_method_signature: EtcdServiceDiscovery.getServices()
focal_class.full_signature: @Override public Set<String> getServices()
focal_class.identifier: getServices
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: Set<String>
focal_class.signature: Set<String> getServices()
focal_class.class_method_signature: EtcdServiceDiscovery.addServiceInstancesChangedListener(ServiceInstancesChangedListener listener)
focal_class.full_signature: @Override public void addServiceInstancesChangedListener(ServiceInstancesChangedListener listener)
focal_class.identifier: addServiceInstancesChangedListener
focal_class.modifiers: @Override public
focal_class.parameters: (ServiceInstancesChangedListener listener)
focal_class.return: void
focal_class.signature: void addServiceInstancesChangedListener(ServiceInstancesChangedListener listener)
focal_class.class_method_signature: EtcdServiceDiscovery.getInstances(String serviceName)
focal_class.full_signature: @Override public List<ServiceInstance> getInstances(String serviceName)
focal_class.identifier: getInstances
focal_class.modifiers: @Override public
focal_class.parameters: (String serviceName)
focal_class.return: List<ServiceInstance>
focal_class.signature: List<ServiceInstance> getInstances(String serviceName)
focal_class.class_method_signature: EtcdServiceDiscovery.registerServiceWatcher(String serviceName)
focal_class.full_signature: protected void registerServiceWatcher(String serviceName)
focal_class.identifier: registerServiceWatcher
focal_class.modifiers: protected
focal_class.parameters: (String serviceName)
focal_class.return: void
focal_class.signature: void registerServiceWatcher(String serviceName)
focal_class.class_method_signature: EtcdServiceDiscovery.recover()
focal_class.full_signature: private void recover()
focal_class.identifier: recover
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void recover()
focal_class.superclass: extends AbstractServiceDiscovery
focal_method.body: @Override
      public void update(ServiceInstance serviceInstance) throws RuntimeException {
          super.register(serviceInstance);
          try {
              String path = toPath(serviceInstance);
              etcdClient.putEphemeral(path, new Gson().toJson(serviceInstance));
              services.add(serviceInstance.getServiceName());
          } catch (Throwable e) {
              throw new RpcException("Failed to register " + serviceInstance + " to etcd " + etcdClient.getUrl()
                      + ", cause: " + (OptionUtil.isProtocolError(e)
                      ? "etcd3 registry may not be supported yet or etcd3 registry is not available."
                      : e.getMessage()), e);
          }
      }
focal_method.class_method_signature: EtcdServiceDiscovery.update(ServiceInstance serviceInstance)
focal_method.full_signature: @Override public void update(ServiceInstance serviceInstance)
focal_method.identifier: update
focal_method.invocations: register toPath putEphemeral toJson add getServiceName getUrl isProtocolError getMessage
focal_method.modifiers: @Override public
focal_method.parameters: (ServiceInstance serviceInstance)
focal_method.return: void
focal_method.signature: void update(ServiceInstance serviceInstance)