Class ScopeClusterInvoker<T>

java.lang.Object
org.apache.dubbo.rpc.cluster.support.wrapper.ScopeClusterInvoker<T>
Type Parameters:
T - the type of service interface
All Implemented Interfaces:
org.apache.dubbo.common.Node, ClusterInvoker<T>, Invoker<T>, ExporterChangeListener

public class ScopeClusterInvoker<T> extends Object implements ClusterInvoker<T>, ExporterChangeListener
ScopeClusterInvoker is a cluster invoker which handles the invocation logic of a single service in a specific scope.

It selects between local and remote invoker at runtime.

  • Constructor Details

    • ScopeClusterInvoker

      public ScopeClusterInvoker(Directory<T> directory, Invoker<T> invoker)
  • Method Details

    • getUrl

      public org.apache.dubbo.common.URL getUrl()
      Specified by:
      getUrl in interface org.apache.dubbo.common.Node
    • getRegistryUrl

      public org.apache.dubbo.common.URL getRegistryUrl()
      Specified by:
      getRegistryUrl in interface ClusterInvoker<T>
    • getDirectory

      public Directory<T> getDirectory()
      Specified by:
      getDirectory in interface ClusterInvoker<T>
    • isDestroyed

      public boolean isDestroyed()
      Specified by:
      isDestroyed in interface ClusterInvoker<T>
    • isAvailable

      public boolean isAvailable()
      Specified by:
      isAvailable in interface org.apache.dubbo.common.Node
    • destroy

      public void destroy()
      Specified by:
      destroy in interface org.apache.dubbo.common.Node
    • getInterface

      public Class<T> getInterface()
      Specified by:
      getInterface in interface Invoker<T>
    • invoke

      public Result invoke(Invocation invocation) throws RpcException
      Checks if the current ScopeClusterInvoker is exported to the local JVM and invokes the corresponding Invoker. If it's not exported locally, then it delegates the invocation to the original Invoker.
      Specified by:
      invoke in interface Invoker<T>
      Parameters:
      invocation - the invocation to be performed
      Returns:
      the result of the invocation
      Throws:
      RpcException - if there was an error during the invocation
    • onExporterChangeExport

      public void onExporterChangeExport(Exporter<?> exporter)
      Specified by:
      onExporterChangeExport in interface ExporterChangeListener
    • onExporterChangeUnExport

      public void onExporterChangeUnExport(Exporter<?> exporter)
      Specified by:
      onExporterChangeUnExport in interface ExporterChangeListener
    • getInvoker

      public Invoker<?> getInvoker()
    • toString

      public String toString()
      Overrides:
      toString in class Object