Class ListenableStateRouter<T>
java.lang.Object
org.apache.dubbo.rpc.cluster.router.state.AbstractStateRouter<T>
org.apache.dubbo.rpc.cluster.router.condition.config.ListenableStateRouter<T>
- All Implemented Interfaces:
EventListener,org.apache.dubbo.common.config.configcenter.ConfigurationListener,StateRouter<T>
- Direct Known Subclasses:
AppStateRouter,ProviderAppStateRouter,ServiceStateRouter
public abstract class ListenableStateRouter<T>
extends AbstractStateRouter<T>
implements org.apache.dubbo.common.config.configcenter.ConfigurationListener
Abstract router which listens to dynamic configuration
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoRoute(BitList<Invoker<T>> invokers, org.apache.dubbo.common.URL url, Invocation invocation, boolean needToPrintMessage, org.apache.dubbo.common.utils.Holder<RouterSnapshotNode<T>> nodeHolder, org.apache.dubbo.common.utils.Holder<String> messageHolder) booleanisForce()To decide whether this router should take effect when none of the invoker can match the router rule, which means theStateRouter.route(BitList, URL, Invocation, boolean, Holder)would be empty.voidprocess(org.apache.dubbo.common.config.configcenter.ConfigChangedEvent event) voidstop()Methods inherited from class org.apache.dubbo.rpc.cluster.router.state.AbstractStateRouter
buildSnapshot, getNextRouter, getRuleRepository, getUrl, isRuntime, notify, route, setForce, setNextRouter, setUrl
-
Field Details
-
NAME
- See Also:
-
RULE_SUFFIX
- See Also:
-
-
Constructor Details
-
ListenableStateRouter
-
-
Method Details
-
process
public void process(org.apache.dubbo.common.config.configcenter.ConfigChangedEvent event) - Specified by:
processin interfaceorg.apache.dubbo.common.config.configcenter.ConfigurationListener
-
doRoute
public BitList<Invoker<T>> doRoute(BitList<Invoker<T>> invokers, org.apache.dubbo.common.URL url, Invocation invocation, boolean needToPrintMessage, org.apache.dubbo.common.utils.Holder<RouterSnapshotNode<T>> nodeHolder, org.apache.dubbo.common.utils.Holder<String> messageHolder) throws RpcException - Throws:
RpcException
-
isForce
public boolean isForce()Description copied from interface:StateRouterTo decide whether this router should take effect when none of the invoker can match the router rule, which means theStateRouter.route(BitList, URL, Invocation, boolean, Holder)would be empty. Most of time, most router implementation would default this value to false.- Specified by:
isForcein interfaceStateRouter<T>- Overrides:
isForcein classAbstractStateRouter<T>- Returns:
- true to execute if none of invokers matches the current router
-
stop
public void stop()- Specified by:
stopin interfaceStateRouter<T>
-