public interface StateRouter<T> extends Comparable<StateRouter<T>>
Cluster.join(Directory, boolean),
Directory.list(Invocation)| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_PRIORITY |
| Modifier and Type | Method and Description |
|---|---|
default int |
compareTo(StateRouter o) |
int |
getPriority()
Router's priority, used to sort routers.
|
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
route(BitList, URL, Invocation, boolean) 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.
|
StateRouterResult<Invoker<T>> |
route(BitList<Invoker<T>> invokers,
org.apache.dubbo.common.URL url,
Invocation invocation,
boolean needToPrintMessage)
** This method can return the state of whether routerChain needed to continue route.
|
default void |
stop() |
static final int DEFAULT_PRIORITY
org.apache.dubbo.common.URL getUrl()
StateRouterResult<Invoker<T>> route(BitList<Invoker<T>> invokers, org.apache.dubbo.common.URL url, Invocation invocation, boolean needToPrintMessage) throws RpcException
invokers - invoker bit listurl - refer urlinvocation - invocationneedToPrintMessage - whether to print router state. Such as `use router branch a`.RpcExceptionboolean isRuntime()
boolean isForce()
route(BitList, URL, Invocation, boolean) would be empty. Most of time, most router implementation would
default this value to false.int getPriority()
void notify(BitList<Invoker<T>> invokers)
route(BitList, URL, Invocation, boolean) gets called.invokers - invoker listdefault int compareTo(StateRouter o)
compareTo in interface Comparable<StateRouter<T>>default void stop()
Copyright © 2011–2021 The Apache Software Foundation. All rights reserved.