Class DefaultGovernanceRuleRepositoryImpl
java.lang.Object
org.apache.dubbo.rpc.cluster.governance.DefaultGovernanceRuleRepositoryImpl
- All Implemented Interfaces:
GovernanceRuleRepository
-
Field Summary
Fields inherited from interface org.apache.dubbo.rpc.cluster.governance.GovernanceRuleRepository
DEFAULT_GROUP -
Constructor Summary
ConstructorsConstructorDescriptionDefaultGovernanceRuleRepositoryImpl(org.apache.dubbo.rpc.model.ModuleModel moduleModel) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddListener(String key, String group, org.apache.dubbo.common.config.configcenter.ConfigurationListener listener) 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.Get the governance rule mapped to the given key and the given group.voidremoveListener(String key, String group, org.apache.dubbo.common.config.configcenter.ConfigurationListener listener) Stops one listener from listening to value changes in the specified key.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.dubbo.rpc.cluster.governance.GovernanceRuleRepository
addListener, getRule, removeListener
-
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:GovernanceRuleRepositoryRegister 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:
addListenerin interfaceGovernanceRuleRepository- Parameters:
key- the key to represent a configurationgroup- the group where the key belongs tolistener- configuration listener
-
removeListener
public void removeListener(String key, String group, org.apache.dubbo.common.config.configcenter.ConfigurationListener listener) Description copied from interface:GovernanceRuleRepositoryStops one listener from listening to value changes in the specified key.- Specified by:
removeListenerin interfaceGovernanceRuleRepository- Parameters:
key- the key to represent a configurationgroup- the group where the key belongs tolistener- configuration listener
-
getRule
Description copied from interface:GovernanceRuleRepositoryGet 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:
getRulein interfaceGovernanceRuleRepository- Parameters:
key- the key to represent a configurationgroup- the group where the key belongs totimeout- 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
-