Skip to content

Commit

Permalink
use equal explicit class to replace anonymous class
Browse files Browse the repository at this point in the history
  • Loading branch information
tswstarplanet committed May 10, 2019
1 parent 6a1dd65 commit b149265
Showing 1 changed file with 1 addition and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,7 @@ public class AvailableCluster implements Cluster {

@Override
public <T> Invoker<T> join(Directory<T> directory) throws RpcException {

return new AbstractClusterInvoker<T>(directory) {
@Override
public Result doInvoke(Invocation invocation, List<Invoker<T>> invokers, LoadBalance loadbalance) throws RpcException {
for (Invoker<T> invoker : invokers) {
if (invoker.isAvailable()) {
return invoker.invoke(invocation);
}
}
throw new RpcException("No provider available in " + invokers);
}
};

return new AvailableClusterInvoker<>(directory);
}

}

0 comments on commit b149265

Please sign in to comment.