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 Details

  • Constructor Details

    • ListenableStateRouter

      public ListenableStateRouter(org.apache.dubbo.common.URL url, String ruleKey)
  • Method Details

    • process

      public void process(org.apache.dubbo.common.config.configcenter.ConfigChangedEvent event)
      Specified by:
      process in interface org.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: 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>
      Overrides:
      isForce in class AbstractStateRouter<T>
      Returns:
      true to execute if none of invokers matches the current router
    • stop

      public void stop()
      Specified by:
      stop in interface StateRouter<T>