类 AbstractStateRouter<T>
- java.lang.Object
-
- org.apache.dubbo.rpc.cluster.router.state.AbstractStateRouter<T>
-
- 所有已实现的接口:
StateRouter<T>
- 直接已知子类:
ConditionStateRouter,ListenableStateRouter,MeshRuleRouter,MockInvokersSelector,ScriptStateRouter,TagStateRouter
public abstract class AbstractStateRouter<T> extends Object implements StateRouter<T>
The abstract class of StateRoute.- 从以下版本开始:
- 3.0
-
-
构造器概要
构造器 构造器 说明 AbstractStateRouter(org.apache.dubbo.common.URL url)
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 StringbuildSnapshot()Build Router's Current State Snapshot for QoSStateRouter<T>getNextRouter()GovernanceRuleRepositorygetRuleRepository()org.apache.dubbo.common.URLgetUrl()Get the router url.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.booleanisRuntime()To decide whether this router need to execute every time an RPC comes or should only execute when addresses or rule change.voidnotify(BitList<Invoker<T>> invokers)Notify the router the invoker list.BitList<Invoker<T>>route(BitList<Invoker<T>> invokers, org.apache.dubbo.common.URL url, Invocation invocation, boolean needToPrintMessage, org.apache.dubbo.common.utils.Holder<RouterSnapshotNode<T>> nodeHolder)Filter invokers with current routing rule and only return the invokers that comply with the rule.voidsetForce(boolean force)voidsetNextRouter(StateRouter<T> nextRouter)Next Router node state is maintained by AbstractStateRouter and this method is not allow to override.voidsetUrl(org.apache.dubbo.common.URL url)-
从接口继承的方法 org.apache.dubbo.rpc.cluster.router.state.StateRouter
stop
-
-
-
-
方法详细资料
-
getUrl
public org.apache.dubbo.common.URL getUrl()
从接口复制的说明:StateRouterGet the router url.- 指定者:
getUrl在接口中StateRouter<T>- 返回:
- url
-
setUrl
public void setUrl(org.apache.dubbo.common.URL url)
-
isRuntime
public boolean isRuntime()
从接口复制的说明:StateRouterTo decide whether this router need to execute every time an RPC comes or should only execute when addresses or rule change.- 指定者:
isRuntime在接口中StateRouter<T>- 返回:
- true if the router need to execute every time.
-
isForce
public boolean isForce()
从接口复制的说明: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.- 指定者:
isForce在接口中StateRouter<T>- 返回:
- true to execute if none of invokers matches the current router
-
setForce
public void setForce(boolean force)
-
getRuleRepository
public GovernanceRuleRepository getRuleRepository()
-
getNextRouter
public StateRouter<T> getNextRouter()
-
notify
public void notify(BitList<Invoker<T>> invokers)
从接口复制的说明:StateRouterNotify the router the invoker list. Invoker list may change from time to time. This method gives the router a chance to prepare beforeStateRouter.route(BitList, URL, Invocation, boolean, Holder)gets called. No need to notify next node.- 指定者:
notify在接口中StateRouter<T>- 参数:
invokers- invoker list
-
route
public final BitList<Invoker<T>> route(BitList<Invoker<T>> invokers, org.apache.dubbo.common.URL url, Invocation invocation, boolean needToPrintMessage, org.apache.dubbo.common.utils.Holder<RouterSnapshotNode<T>> nodeHolder) throws RpcException
从接口复制的说明:StateRouterFilter invokers with current routing rule and only return the invokers that comply with the rule. Caching address lists in BitMap mode improves routing performance.- 指定者:
route在接口中StateRouter<T>- 参数:
invokers- invoker bit listurl- refer urlinvocation- invocationneedToPrintMessage- whether to print router state. Such as `use router branch a`.- 返回:
- state with route result
- 抛出:
RpcException
-
setNextRouter
public final void setNextRouter(StateRouter<T> nextRouter)
Next Router node state is maintained by AbstractStateRouter and this method is not allow to override. If a specified router wants to control the behaviour of continue route or not, please overridesupportContinueRoute()- 指定者:
setNextRouter在接口中StateRouter<T>- 参数:
nextRouter- next router node
-
buildSnapshot
public final String buildSnapshot()
从接口复制的说明:StateRouterBuild Router's Current State Snapshot for QoS- 指定者:
buildSnapshot在接口中StateRouter<T>- 返回:
- Current State
-
-