You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by al...@apache.org on 2021/11/04 07:45:54 UTC

[dubbo] branch 3.0 updated: Add get raw invokers in Directory Support (#9205)

This is an automated email from the ASF dual-hosted git repository.

albumenj pushed a commit to branch 3.0
in repository https://gitbox.apache.org/repos/asf/dubbo.git


The following commit(s) were added to refs/heads/3.0 by this push:
     new c5fc78f  Add get raw invokers in Directory Support (#9205)
c5fc78f is described below

commit c5fc78fc9ff2b7a71c6a3e0387b84db3b94792f9
Author: Albumen Kevin <jh...@gmail.com>
AuthorDate: Thu Nov 4 15:45:40 2021 +0800

    Add get raw invokers in Directory Support (#9205)
---
 .../java/org/apache/dubbo/rpc/cluster/RouterChain.java   |  2 +-
 .../dubbo/rpc/cluster/directory/AbstractDirectory.java   | 16 ++++++++++++++++
 .../dubbo/registry/integration/DynamicDirectory.java     |  4 ----
 .../dubbo/registry/integration/RegistryDirectory.java    |  5 -----
 4 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/RouterChain.java b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/RouterChain.java
index 84ec662..5cae5f8 100644
--- a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/RouterChain.java
+++ b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/RouterChain.java
@@ -222,7 +222,7 @@ public class RouterChain<T> {
     /**
      * Build each router's result
      */
-    private RouterSnapshotNode<T> buildRouterSnapshot(URL url, BitList<Invoker<T>> availableInvokers, Invocation invocation) {
+    public RouterSnapshotNode<T> buildRouterSnapshot(URL url, BitList<Invoker<T>> availableInvokers, Invocation invocation) {
         AddrCache<T> cache = this.cache.get();
         BitList<Invoker<T>> resultInvokers = availableInvokers.clone();
         RouterSnapshotNode<T> snapshotNode = new RouterSnapshotNode<T>("Parent", resultInvokers.size());
diff --git a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/directory/AbstractDirectory.java b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/directory/AbstractDirectory.java
index a6b41ea..2ec0ecc 100644
--- a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/directory/AbstractDirectory.java
+++ b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/directory/AbstractDirectory.java
@@ -403,6 +403,22 @@ public abstract class AbstractDirectory<T> implements Directory<T> {
         return connectivityCheckFuture;
     }
 
+    public BitList<Invoker<T>> getInvokers() {
+        return invokers;
+    }
+
+    public BitList<Invoker<T>> getValidInvokers() {
+        return validInvokers;
+    }
+
+    public List<Invoker<T>> getInvokersToReconnect() {
+        return invokersToReconnect;
+    }
+
+    public Set<Invoker<T>> getDisabledInvokers() {
+        return disabledInvokers;
+    }
+
     protected abstract List<Invoker<T>> doList(BitList<Invoker<T>> invokers, Invocation invocation) throws RpcException;
 
 }
diff --git a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/DynamicDirectory.java b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/DynamicDirectory.java
index cc709e8..1d887a8 100644
--- a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/DynamicDirectory.java
+++ b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/DynamicDirectory.java
@@ -253,10 +253,6 @@ public abstract class DynamicDirectory<T> extends AbstractDirectory<T> implement
         this.setRouterChain(RouterChain.buildChain(url));
     }
 
-    public List<Invoker<T>> getInvokers() {
-        return invokers;
-    }
-
     @Override
     public boolean isAvailable() {
         if (isDestroyed() || this.forbidden) {
diff --git a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/RegistryDirectory.java b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/RegistryDirectory.java
index 1e24630..fe0c8ee 100644
--- a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/RegistryDirectory.java
+++ b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/RegistryDirectory.java
@@ -555,11 +555,6 @@ public class RegistryDirectory<T> extends DynamicDirectory<T> {
         return urlInvokerMap;
     }
 
-    @Override
-    public List<Invoker<T>> getInvokers() {
-        return invokers;
-    }
-
     private boolean isValidCategory(URL url) {
         String category = url.getCategory(DEFAULT_CATEGORY);
         if ((ROUTERS_CATEGORY.equals(category) || ROUTE_PROTOCOL.equals(url.getProtocol())) ||