Skip to content

Commit 6a3f4c7

Browse files
tswstarplanetralf0131
authored andcommitted
use equal explicit class to replace anonymous class (#4027)
1 parent 309b694 commit 6a3f4c7

File tree

1 file changed

+1
-18
lines changed

1 file changed

+1
-18
lines changed

dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/AvailableCluster.java

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,10 @@
1616
*/
1717
package org.apache.dubbo.rpc.cluster.support;
1818

19-
import org.apache.dubbo.rpc.Invocation;
2019
import org.apache.dubbo.rpc.Invoker;
21-
import org.apache.dubbo.rpc.Result;
2220
import org.apache.dubbo.rpc.RpcException;
2321
import org.apache.dubbo.rpc.cluster.Cluster;
2422
import org.apache.dubbo.rpc.cluster.Directory;
25-
import org.apache.dubbo.rpc.cluster.LoadBalance;
26-
27-
import java.util.List;
2823

2924
/**
3025
* AvailableCluster
@@ -36,19 +31,7 @@ public class AvailableCluster implements Cluster {
3631

3732
@Override
3833
public <T> Invoker<T> join(Directory<T> directory) throws RpcException {
39-
40-
return new AbstractClusterInvoker<T>(directory) {
41-
@Override
42-
public Result doInvoke(Invocation invocation, List<Invoker<T>> invokers, LoadBalance loadbalance) throws RpcException {
43-
for (Invoker<T> invoker : invokers) {
44-
if (invoker.isAvailable()) {
45-
return invoker.invoke(invocation);
46-
}
47-
}
48-
throw new RpcException("No provider available in " + invokers);
49-
}
50-
};
51-
34+
return new AvailableClusterInvoker<>(directory);
5235
}
5336

5437
}

0 commit comments

Comments
 (0)