use of com.jim.framework.rpc.exception.RpcException in project jim-framework by jiangmin168168.
the class RpcClientInvokerManager method getInvoker.
public RpcClientInvoker getInvoker() {
int size = RpcClientInvokerCache.size();
while (size <= 0) {
try {
this.connect();
boolean available = waitingForHandler();
if (available) {
size = RpcClientInvokerCache.size();
}
} catch (InterruptedException e) {
throw new RpcException(e);
}
}
int index = loadbalanceService.index(size);
RpcClientInvoker invoker = RpcClientInvokerCache.get(index);
if (invoker.getChannel().isActive()) {
return invoker;
} else {
RpcClientInvokerCache.removeHandler(invoker);
logger.info("invoker is not active,so remove it and get next one");
return this.getInvoker();
}
}
Aggregations