public abstract class AbstractStateRouter<T> extends Object implements StateRouter<T>
| 构造器和说明 |
|---|
AbstractStateRouter(org.apache.dubbo.common.URL url) |
| 限定符和类型 | 方法和说明 |
|---|---|
String |
buildSnapshot()
Build Router's Current State Snapshot for QoS
|
StateRouter<T> |
getNextRouter() |
GovernanceRuleRepository |
getRuleRepository() |
org.apache.dubbo.common.URL |
getUrl()
Get the router url.
|
boolean |
isForce()
To decide whether this router should take effect when none of the invoker can match the router rule, which
means the
StateRouter.route(BitList, URL, Invocation, boolean, Holder) would be empty. |
boolean |
isRuntime()
To decide whether this router need to execute every time an RPC comes or should only execute when addresses or
rule change.
|
void |
notify(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.
|
void |
setForce(boolean force) |
void |
setNextRouter(StateRouter<T> nextRouter)
Next Router node state is maintained by AbstractStateRouter and this method is not allow to override.
|
void |
setUrl(org.apache.dubbo.common.URL url) |
stoppublic org.apache.dubbo.common.URL getUrl()
StateRoutergetUrl 在接口中 StateRouter<T>public void setUrl(org.apache.dubbo.common.URL url)
public boolean isRuntime()
StateRouterisRuntime 在接口中 StateRouter<T>public boolean isForce()
StateRouterStateRouter.route(BitList, URL, Invocation, boolean, Holder) would be empty. Most of time, most router implementation would
default this value to false.isForce 在接口中 StateRouter<T>public void setForce(boolean force)
public GovernanceRuleRepository getRuleRepository()
public StateRouter<T> getNextRouter()
public void notify(BitList<Invoker<T>> invokers)
StateRouterStateRouter.route(BitList, URL, Invocation, boolean, Holder) gets called.
No need to notify next node.notify 在接口中 StateRouter<T>invokers - invoker listpublic 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
StateRouterroute 在接口中 StateRouter<T>invokers - invoker bit listurl - refer urlinvocation - invocationneedToPrintMessage - whether to print router state. Such as `use router branch a`.RpcExceptionpublic final void setNextRouter(StateRouter<T> nextRouter)
supportContinueRoute()setNextRouter 在接口中 StateRouter<T>nextRouter - next router nodepublic final String buildSnapshot()
StateRouterbuildSnapshot 在接口中 StateRouter<T>Copyright © 2011–2020 The Apache Software Foundation. All rights reserved.