Class DefaultGovernanceRuleRepositoryImpl

java.lang.Object
org.apache.dubbo.rpc.cluster.governance.DefaultGovernanceRuleRepositoryImpl
All Implemented Interfaces:
GovernanceRuleRepository

public class DefaultGovernanceRuleRepositoryImpl extends Object implements GovernanceRuleRepository
  • Constructor Details

    • DefaultGovernanceRuleRepositoryImpl

      public DefaultGovernanceRuleRepositoryImpl(org.apache.dubbo.rpc.model.ModuleModel moduleModel)
  • Method Details

    • addListener

      public void addListener(String key, String group, org.apache.dubbo.common.config.configcenter.ConfigurationListener listener)
      Description copied from interface: GovernanceRuleRepository
      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 GovernanceRuleRepository
      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, org.apache.dubbo.common.config.configcenter.ConfigurationListener listener)
      Description copied from interface: GovernanceRuleRepository
      Stops one listener from listening to value changes in the specified key.
      Specified by:
      removeListener in interface GovernanceRuleRepository
      Parameters:
      key - the key to represent a configuration
      group - the group where the key belongs to
      listener - configuration listener
    • getRule

      public String getRule(String key, String group, long timeout) throws IllegalStateException
      Description copied from interface: GovernanceRuleRepository
      Get the governance rule mapped to the given key and the given group. If the rule fails to return after timeout exceeds, IllegalStateException will be thrown.
      Specified by:
      getRule in interface GovernanceRuleRepository
      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