Class AbstractDynamicConfiguration

java.lang.Object
org.apache.dubbo.common.config.configcenter.AbstractDynamicConfiguration
All Implemented Interfaces:
AutoCloseable, DynamicConfiguration, Configuration
Direct Known Subclasses:
TreePathDynamicConfiguration

public abstract class AbstractDynamicConfiguration extends Object implements DynamicConfiguration
The abstract implementation of DynamicConfiguration
Since:
2.7.5
  • Field Details

    • PARAM_NAME_PREFIX

      public static final String PARAM_NAME_PREFIX
      See Also:
    • THREAD_POOL_PREFIX_PARAM_NAME

      public static final String THREAD_POOL_PREFIX_PARAM_NAME
      See Also:
    • DEFAULT_THREAD_POOL_PREFIX

      public static final String DEFAULT_THREAD_POOL_PREFIX
      See Also:
    • THREAD_POOL_SIZE_PARAM_NAME

      public static final String THREAD_POOL_SIZE_PARAM_NAME
      See Also:
    • THREAD_POOL_KEEP_ALIVE_TIME_PARAM_NAME

      public static final String THREAD_POOL_KEEP_ALIVE_TIME_PARAM_NAME
      The keep alive time in milliseconds for threads in ThreadPoolExecutor
      See Also:
    • GROUP_PARAM_NAME

      public static final String GROUP_PARAM_NAME
      The parameter name of group for config-center
      Since:
      2.7.8
      See Also:
    • TIMEOUT_PARAM_NAME

      public static final String TIMEOUT_PARAM_NAME
      The parameter name of timeout for config-center
      Since:
      2.7.8
      See Also:
    • DEFAULT_THREAD_POOL_SIZE

      public static final int DEFAULT_THREAD_POOL_SIZE
      See Also:
    • DEFAULT_THREAD_POOL_KEEP_ALIVE_TIME

      public static final long DEFAULT_THREAD_POOL_KEEP_ALIVE_TIME
      Default keep alive time in milliseconds for threads in ThreadPoolExecutor is 1 minute( 60 * 1000 ms)
  • Method Details

    • addListener

      public void addListener(String key, String group, ConfigurationListener listener)
      Description copied from interface: DynamicConfiguration
      Register a configuration listener for a specified key The listener only works for service governance purpose, so the target group would always be the value user specifies at startup or 'dubbo' by default. This method will only register listener, which means it will not trigger a notification that contains the current value.
      Specified by:
      addListener in interface DynamicConfiguration
      Parameters:
      key - the key to represent a configuration
      group - the group where the key belongs to
      listener - configuration listener
    • removeListener

      public void removeListener(String key, String group, ConfigurationListener listener)
      Description copied from interface: DynamicConfiguration
      Stops one listener from listening to value changes in the specified key.
      Specified by:
      removeListener in interface DynamicConfiguration
      Parameters:
      key - the key to represent a configuration
      group - the group where the key belongs to
      listener - configuration listener
    • getConfig

      public final String getConfig(String key, String group, long timeout) throws IllegalStateException
      Description copied from interface: DynamicConfiguration
      Get the configuration mapped to the given key and the given group. If the configuration fails to fetch after timeout exceeds, IllegalStateException will be thrown.
      Specified by:
      getConfig in interface DynamicConfiguration
      Parameters:
      key - the key to represent a configuration
      group - the group where the key belongs to
      timeout - timeout value for fetching the target config
      Returns:
      target configuration mapped to the given key and the given group, IllegalStateException will be thrown if timeout exceeds.
      Throws:
      IllegalStateException
    • getInternalProperty

      public Object getInternalProperty(String key)
      Specified by:
      getInternalProperty in interface Configuration
    • close

      public final void close() throws Exception
      Description copied from interface: DynamicConfiguration
      Close the configuration
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface DynamicConfiguration
      Throws:
      Exception
    • removeConfig

      public boolean removeConfig(String key, String group)
      Specified by:
      removeConfig in interface DynamicConfiguration
      Parameters:
      key - the key to represent a configuration
      group - the group where the key belongs to
      Returns:
      true if success, or false
    • getDefaultGroup

      public String getDefaultGroup()
      Description copied from interface: DynamicConfiguration
      Get the default group for the operations
      Specified by:
      getDefaultGroup in interface DynamicConfiguration
      Returns:
      the default group
      Since:
      2.7.8
    • getDefaultTimeout

      public long getDefaultTimeout()
      Description copied from interface: DynamicConfiguration
      Get the default timeout for the operations in milliseconds
      Specified by:
      getDefaultTimeout in interface DynamicConfiguration
      Returns:
      the default timeout
      Since:
      2.7.8