From 6a3f4c75bd99a50e23d447174170c5867c17821f Mon Sep 17 00:00:00 2001 From: Taosheng Wei Date: Sun, 12 May 2019 10:47:31 +0800 Subject: [PATCH] use equal explicit class to replace anonymous class (#4027) --- .../rpc/cluster/support/AvailableCluster.java | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/AvailableCluster.java b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/AvailableCluster.java index 85e91e0527f..a2e353b4e4c 100644 --- a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/AvailableCluster.java +++ b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/AvailableCluster.java @@ -16,15 +16,10 @@ */ package org.apache.dubbo.rpc.cluster.support; -import org.apache.dubbo.rpc.Invocation; import org.apache.dubbo.rpc.Invoker; -import org.apache.dubbo.rpc.Result; import org.apache.dubbo.rpc.RpcException; import org.apache.dubbo.rpc.cluster.Cluster; import org.apache.dubbo.rpc.cluster.Directory; -import org.apache.dubbo.rpc.cluster.LoadBalance; - -import java.util.List; /** * AvailableCluster @@ -36,19 +31,7 @@ public class AvailableCluster implements Cluster { @Override public Invoker join(Directory directory) throws RpcException { - - return new AbstractClusterInvoker(directory) { - @Override - public Result doInvoke(Invocation invocation, List> invokers, LoadBalance loadbalance) throws RpcException { - for (Invoker invoker : invokers) { - if (invoker.isAvailable()) { - return invoker.invoke(invocation); - } - } - throw new RpcException("No provider available in " + invokers); - } - }; - + return new AvailableClusterInvoker<>(directory); } }