Class TailStateRouter<T>

java.lang.Object
org.apache.dubbo.rpc.cluster.router.state.TailStateRouter<T>
All Implemented Interfaces:
StateRouter<T>

public class TailStateRouter<T> extends Object implements StateRouter<T>
  • Method Details

    • getInstance

      public static <T> TailStateRouter<T> getInstance()
    • setNextRouter

      public void setNextRouter(StateRouter<T> nextRouter)
      Description copied from interface: StateRouter
      Notify next router node to current router.
      Specified by:
      setNextRouter in interface StateRouter<T>
      Parameters:
      nextRouter - next router node
    • getUrl

      public org.apache.dubbo.common.URL getUrl()
      Description copied from interface: StateRouter
      Get the router url.
      Specified by:
      getUrl in interface StateRouter<T>
      Returns:
      url
    • route

      public 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
      Description copied from interface: StateRouter
      Filter invokers with current routing rule and only return the invokers that comply with the rule. Caching address lists in BitMap mode improves routing performance.
      Specified by:
      route in interface StateRouter<T>
      Parameters:
      invokers - invoker bit list
      url - refer url
      invocation - invocation
      needToPrintMessage - whether to print router state. Such as `use router branch a`.
      Returns:
      state with route result
      Throws:
      RpcException
    • isRuntime

      public boolean isRuntime()
      Description copied from interface: StateRouter
      To decide whether this router need to execute every time an RPC comes or should only execute when addresses or rule change.
      Specified by:
      isRuntime in interface StateRouter<T>
      Returns:
      true if the router need to execute every time.
    • isForce

      public boolean isForce()
      Description copied from interface: StateRouter
      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. Most of time, most router implementation would default this value to false.
      Specified by:
      isForce in interface StateRouter<T>
      Returns:
      true to execute if none of invokers matches the current router
    • notify

      public void notify(BitList<Invoker<T>> invokers)
      Description copied from interface: StateRouter
      Notify the router the invoker list. Invoker list may change from time to time. This method gives the router a chance to prepare before StateRouter.route(BitList, URL, Invocation, boolean, Holder) gets called. No need to notify next node.
      Specified by:
      notify in interface StateRouter<T>
      Parameters:
      invokers - invoker list
    • buildSnapshot

      public String buildSnapshot()
      Description copied from interface: StateRouter
      Build Router's Current State Snapshot for QoS
      Specified by:
      buildSnapshot in interface StateRouter<T>
      Returns:
      Current State