接口 Router

    • 字段概要

      字段 
      修饰符和类型 字段 说明
      static int DEFAULT_PRIORITY  
    • 方法概要

      所有方法 实例方法 抽象方法 默认方法 
      修饰符和类型 方法 说明
      default int compareTo​(Router 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(List, URL, Invocation) 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.
      default <T> void notify​(List<Invoker<T>> invokers)
      Notify the router the invoker list.
      <T> List<Invoker<T>> route​(List<Invoker<T>> invokers, org.apache.dubbo.common.URL url, Invocation invocation)
      Filter invokers with current routing rule and only return the invokers that comply with the rule.
      default void stop()  
    • 字段详细资料

      • DEFAULT_PRIORITY

        static final int DEFAULT_PRIORITY
        另请参阅:
        常量字段值
    • 方法详细资料

      • getUrl

        org.apache.dubbo.common.URL getUrl()
        Get the router url.
        返回:
        url
      • route

        <T> List<Invoker<T>> route​(List<Invoker<T>> invokers,
                                   org.apache.dubbo.common.URL url,
                                   Invocation invocation)
                            throws RpcException
        Filter invokers with current routing rule and only return the invokers that comply with the rule.
        参数:
        invokers - invoker list
        url - refer url
        invocation - invocation
        返回:
        routed invokers
        抛出:
        RpcException
      • notify

        default <T> void notify​(List<Invoker<T>> invokers)
        Notify the router the invoker list. Invoker list may change from time to time. This method gives the router a chance to prepare before route(List, URL, Invocation) gets called.
        类型参数:
        T - invoker's type
        参数:
        invokers - invoker list
      • isRuntime

        boolean isRuntime()
        To decide whether this router need to execute every time an RPC comes or should only execute when addresses or rule change.
        返回:
        true if the router need to execute every time.
      • isForce

        boolean isForce()
        To decide whether this router should take effect when none of the invoker can match the router rule, which means the route(List, URL, Invocation) would be empty. Most of time, most router implementation would default this value to false.
        返回:
        true to execute if none of invokers matches the current router
      • getPriority

        int getPriority()
        Router's priority, used to sort routers.
        返回:
        router's priority
      • stop

        default void stop()