test_class.declarator: SESSION_TIMEOUT_KEY = "session"
test_class.modifier: private static final
test_class.original_string: private static final String SESSION_TIMEOUT_KEY = "session";
test_class.type: String
test_class.var_name: SESSION_TIMEOUT_KEY
test_class.declarator: config
test_class.modifier: private static
test_class.original_string: private static NacosDynamicConfiguration config;
test_class.type: NacosDynamicConfiguration
test_class.var_name: config
test_class.declarator: nacosClient
test_class.modifier: private static
test_class.original_string: private static ConfigService nacosClient;
test_class.type: ConfigService
test_class.var_name: nacosClient
test_class.file: dubbo-configcenter/dubbo-configcenter-nacos/src/test/java/org/apache/dubbo/configcenter/support/nacos/NacosDynamicConfigurationTest.java
test_class.identifier: NacosDynamicConfigurationTest
test_case.body: @Test
      public void testAddListener() throws Exception {
          CountDownLatch latch = new CountDownLatch(4);
          TestListener listener1 = new TestListener(latch);
          TestListener listener2 = new TestListener(latch);
          TestListener listener3 = new TestListener(latch);
          TestListener listener4 = new TestListener(latch);
  
  
          config.addListener("AService.configurators", listener1);
          config.addListener("AService.configurators", listener2);
          config.addListener("testapp.tag-router", listener3);
          config.addListener("testapp.tag-router", listener4);
  
          put("AService.configurators", "new value1");
          Thread.sleep(200);
          put("testapp.tag-router", "new value2");
          Thread.sleep(200);
          put("testapp", "new value3");
          Thread.sleep(5000);
  
          latch.await();
  
          Assertions.assertEquals(1, listener1.getCount("AService.configurators"));
          Assertions.assertEquals(1, listener2.getCount("AService.configurators"));
          Assertions.assertEquals(1, listener3.getCount("testapp.tag-router"));
          Assertions.assertEquals(1, listener4.getCount("testapp.tag-router"));
  
          Assertions.assertEquals("new value1", listener1.getValue());
          Assertions.assertEquals("new value1", listener2.getValue());
          Assertions.assertEquals("new value2", listener3.getValue());
          Assertions.assertEquals("new value2", listener4.getValue());
  
      }
test_case.class_method_signature: NacosDynamicConfigurationTest.testAddListener()
test_case.full_signature: @Test public void testAddListener()
test_case.identifier: testAddListener
test_case.invocations: addListener addListener addListener addListener put sleep put sleep put sleep await assertEquals getCount assertEquals getCount assertEquals getCount assertEquals getCount assertEquals getValue assertEquals getValue assertEquals getValue assertEquals getValue
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testAddListener()
focal_class.declarator: GET_CONFIG_KEYS_PATH = "/v1/cs/configs"
focal_class.modifier: private static final
focal_class.original_string: private static final String GET_CONFIG_KEYS_PATH = "/v1/cs/configs";
focal_class.type: String
focal_class.var_name: GET_CONFIG_KEYS_PATH
focal_class.declarator: logger = LoggerFactory.getLogger(getClass())
focal_class.modifier: private final
focal_class.original_string: private final Logger logger = LoggerFactory.getLogger(getClass());
focal_class.type: Logger
focal_class.var_name: logger
focal_class.declarator: DEFAULT_TIMEOUT = 5000L
focal_class.modifier: private static final
focal_class.original_string: private static final long DEFAULT_TIMEOUT = 5000L;
focal_class.type: long
focal_class.var_name: DEFAULT_TIMEOUT
focal_class.declarator: nacosProperties
focal_class.modifier: private
focal_class.original_string: private Properties nacosProperties;
focal_class.type: Properties
focal_class.var_name: nacosProperties
focal_class.declarator: configService
focal_class.modifier: private final
focal_class.original_string: private final ConfigService configService;
focal_class.type: ConfigService
focal_class.var_name: configService
focal_class.declarator: httpAgent
focal_class.modifier: private
focal_class.original_string: private HttpAgent httpAgent;
focal_class.type: HttpAgent
focal_class.var_name: httpAgent
focal_class.declarator: watchListenerMap
focal_class.modifier: private final
focal_class.original_string: private final ConcurrentMap<String, NacosConfigListener> watchListenerMap;
focal_class.type: ConcurrentMap<String, NacosConfigListener>
focal_class.var_name: watchListenerMap
focal_class.file: dubbo-configcenter/dubbo-configcenter-nacos/src/main/java/org/apache/dubbo/configcenter/support/nacos/NacosDynamicConfiguration.java
focal_class.identifier: NacosDynamicConfiguration
focal_class.interfaces: implements DynamicConfiguration
focal_class.class_method_signature: NacosDynamicConfiguration.NacosDynamicConfiguration(URL url)
focal_class.full_signature:   NacosDynamicConfiguration(URL url)
focal_class.identifier: NacosDynamicConfiguration
focal_class.parameters: (URL url)
focal_class.signature:  NacosDynamicConfiguration(URL url)
focal_class.class_method_signature: NacosDynamicConfiguration.buildConfigService(URL url)
focal_class.full_signature: private ConfigService buildConfigService(URL url)
focal_class.identifier: buildConfigService
focal_class.modifiers: private
focal_class.parameters: (URL url)
focal_class.return: ConfigService
focal_class.signature: ConfigService buildConfigService(URL url)
focal_class.class_method_signature: NacosDynamicConfiguration.getHttpAgent(ConfigService configService)
focal_class.full_signature: private HttpAgent getHttpAgent(ConfigService configService)
focal_class.identifier: getHttpAgent
focal_class.modifiers: private
focal_class.parameters: (ConfigService configService)
focal_class.return: HttpAgent
focal_class.signature: HttpAgent getHttpAgent(ConfigService configService)
focal_class.class_method_signature: NacosDynamicConfiguration.buildNacosProperties(URL url)
focal_class.full_signature: private Properties buildNacosProperties(URL url)
focal_class.identifier: buildNacosProperties
focal_class.modifiers: private
focal_class.parameters: (URL url)
focal_class.return: Properties
focal_class.signature: Properties buildNacosProperties(URL url)
focal_class.class_method_signature: NacosDynamicConfiguration.setServerAddr(URL url, Properties properties)
focal_class.full_signature: private void setServerAddr(URL url, Properties properties)
focal_class.identifier: setServerAddr
focal_class.modifiers: private
focal_class.parameters: (URL url, Properties properties)
focal_class.return: void
focal_class.signature: void setServerAddr(URL url, Properties properties)
focal_class.class_method_signature: NacosDynamicConfiguration.setProperties(URL url, Properties properties)
focal_class.full_signature: private static void setProperties(URL url, Properties properties)
focal_class.identifier: setProperties
focal_class.modifiers: private static
focal_class.parameters: (URL url, Properties properties)
focal_class.return: void
focal_class.signature: void setProperties(URL url, Properties properties)
focal_class.class_method_signature: NacosDynamicConfiguration.putPropertyIfAbsent(URL url, Properties properties, String propertyName)
focal_class.full_signature: private static void putPropertyIfAbsent(URL url, Properties properties, String propertyName)
focal_class.identifier: putPropertyIfAbsent
focal_class.modifiers: private static
focal_class.parameters: (URL url, Properties properties, String propertyName)
focal_class.return: void
focal_class.signature: void putPropertyIfAbsent(URL url, Properties properties, String propertyName)
focal_class.class_method_signature: NacosDynamicConfiguration.putPropertyIfAbsent(URL url, Properties properties, String propertyName, String defaultValue)
focal_class.full_signature: private static void putPropertyIfAbsent(URL url, Properties properties, String propertyName, String defaultValue)
focal_class.identifier: putPropertyIfAbsent
focal_class.modifiers: private static
focal_class.parameters: (URL url, Properties properties, String propertyName, String defaultValue)
focal_class.return: void
focal_class.signature: void putPropertyIfAbsent(URL url, Properties properties, String propertyName, String defaultValue)
focal_class.class_method_signature: NacosDynamicConfiguration.createTargetListener(String key, String group)
focal_class.full_signature: private NacosConfigListener createTargetListener(String key, String group)
focal_class.identifier: createTargetListener
focal_class.modifiers: private
focal_class.parameters: (String key, String group)
focal_class.return: NacosConfigListener
focal_class.signature: NacosConfigListener createTargetListener(String key, String group)
focal_class.class_method_signature: NacosDynamicConfiguration.addListener(String key, String group, ConfigurationListener listener)
focal_class.full_signature: @Override public void addListener(String key, String group, ConfigurationListener listener)
focal_class.identifier: addListener
focal_class.modifiers: @Override public
focal_class.parameters: (String key, String group, ConfigurationListener listener)
focal_class.return: void
focal_class.signature: void addListener(String key, String group, ConfigurationListener listener)
focal_class.class_method_signature: NacosDynamicConfiguration.removeListener(String key, String group, ConfigurationListener listener)
focal_class.full_signature: @Override public void removeListener(String key, String group, ConfigurationListener listener)
focal_class.identifier: removeListener
focal_class.modifiers: @Override public
focal_class.parameters: (String key, String group, ConfigurationListener listener)
focal_class.return: void
focal_class.signature: void removeListener(String key, String group, ConfigurationListener listener)
focal_class.class_method_signature: NacosDynamicConfiguration.getConfig(String key, String group, long timeout)
focal_class.full_signature: @Override public String getConfig(String key, String group, long timeout)
focal_class.identifier: getConfig
focal_class.modifiers: @Override public
focal_class.parameters: (String key, String group, long timeout)
focal_class.return: String
focal_class.signature: String getConfig(String key, String group, long timeout)
focal_class.class_method_signature: NacosDynamicConfiguration.getInternalProperty(String key)
focal_class.full_signature: @Override public Object getInternalProperty(String key)
focal_class.identifier: getInternalProperty
focal_class.modifiers: @Override public
focal_class.parameters: (String key)
focal_class.return: Object
focal_class.signature: Object getInternalProperty(String key)
focal_class.class_method_signature: NacosDynamicConfiguration.publishConfig(String key, String group, String content)
focal_class.full_signature: @Override public boolean publishConfig(String key, String group, String content)
focal_class.identifier: publishConfig
focal_class.modifiers: @Override public
focal_class.parameters: (String key, String group, String content)
focal_class.return: boolean
focal_class.signature: boolean publishConfig(String key, String group, String content)
focal_class.class_method_signature: NacosDynamicConfiguration.getDefaultTimeout()
focal_class.full_signature: @Override public long getDefaultTimeout()
focal_class.identifier: getDefaultTimeout
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: long
focal_class.signature: long getDefaultTimeout()
focal_class.class_method_signature: NacosDynamicConfiguration.getConfigKeys(String group)
focal_class.full_signature: @Override public SortedSet<String> getConfigKeys(String group)
focal_class.identifier: getConfigKeys
focal_class.modifiers: @Override public
focal_class.parameters: (String group)
focal_class.return: SortedSet<String>
focal_class.signature: SortedSet<String> getConfigKeys(String group)
focal_class.class_method_signature: NacosDynamicConfiguration.removeConfig(String key, String group)
focal_class.full_signature: @Override public boolean removeConfig(String key, String group)
focal_class.identifier: removeConfig
focal_class.modifiers: @Override public
focal_class.parameters: (String key, String group)
focal_class.return: boolean
focal_class.signature: boolean removeConfig(String key, String group)
focal_class.class_method_signature: NacosDynamicConfiguration.toKeysStream(String content)
focal_class.full_signature: private Stream<String> toKeysStream(String content)
focal_class.identifier: toKeysStream
focal_class.modifiers: private
focal_class.parameters: (String content)
focal_class.return: Stream<String>
focal_class.signature: Stream<String> toKeysStream(String content)
focal_class.class_method_signature: NacosDynamicConfiguration.getProperty(String name, String defaultValue)
focal_class.full_signature: private String getProperty(String name, String defaultValue)
focal_class.identifier: getProperty
focal_class.modifiers: private
focal_class.parameters: (String name, String defaultValue)
focal_class.return: String
focal_class.signature: String getProperty(String name, String defaultValue)
focal_class.class_method_signature: NacosDynamicConfiguration.buildListenerKey(String key, String group)
focal_class.full_signature: protected String buildListenerKey(String key, String group)
focal_class.identifier: buildListenerKey
focal_class.modifiers: protected
focal_class.parameters: (String key, String group)
focal_class.return: String
focal_class.signature: String buildListenerKey(String key, String group)
focal_class.class_method_signature: NacosDynamicConfiguration.resolveGroup(String group)
focal_class.full_signature: protected String resolveGroup(String group)
focal_class.identifier: resolveGroup
focal_class.modifiers: protected
focal_class.parameters: (String group)
focal_class.return: String
focal_class.signature: String resolveGroup(String group)
focal_method.body: @Override
      public void addListener(String key, String group, ConfigurationListener listener) {
          String resolvedGroup = resolveGroup(group);
          String listenerKey = buildListenerKey(key, group);
          NacosConfigListener nacosConfigListener = watchListenerMap.computeIfAbsent(listenerKey, k -> createTargetListener(key, resolvedGroup));
          nacosConfigListener.addListener(listener);
          try {
              configService.addListener(key, resolvedGroup, nacosConfigListener);
          } catch (NacosException e) {
              logger.error(e.getMessage());
          }
      }
focal_method.class_method_signature: NacosDynamicConfiguration.addListener(String key, String group, ConfigurationListener listener)
focal_method.full_signature: @Override public void addListener(String key, String group, ConfigurationListener listener)
focal_method.identifier: addListener
focal_method.invocations: resolveGroup buildListenerKey computeIfAbsent createTargetListener addListener addListener error getMessage
focal_method.modifiers: @Override public
focal_method.parameters: (String key, String group, ConfigurationListener listener)
focal_method.return: void
focal_method.signature: void addListener(String key, String group, ConfigurationListener listener)