@Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) { if (!id2Call.isEmpty()) { cleanupCalls(ctx, IPCUtil.toIOE(cause)); } conn.shutdown(); }
@Override public void operationComplete(ChannelFuture future) throws Exception { // Fail the call if we failed to write it out. This usually because the channel is // closed. This is needed because we may shutdown the channel inside event loop and // there may still be some pending calls in the event loop queue after us. if (!future.isSuccess()) { call.setException(toIOE(future.cause())); } } });
LOG.trace("Error while writing call, call_id:" + call.id, t); IOException e = IPCUtil.toIOE(t); closeConn(e); return;
@Override public void operationComplete(ChannelFuture future) throws Exception { Channel ch = future.channel(); if (!future.isSuccess()) { failInit(ch, toIOE(future.cause())); rpcClient.failedServers.addToFailedServers(remoteId.address, future.cause()); return; } ch.writeAndFlush(connectionHeaderPreamble.retainedDuplicate()); if (useSasl) { saslNegotiate(ch); } else { // send the connection header to server ch.write(connectionHeaderWithLength.retainedDuplicate()); established(ch); } } }).channel();
connection.sendRequest(call, hrc); } catch (Exception e) { call.setException(toIOE(e));
final Throwable error = future.cause(); scheduleRelogin(error); failInit(ch, toIOE(error));
@Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) { if (!id2Call.isEmpty()) { cleanupCalls(ctx, IPCUtil.toIOE(cause)); } conn.shutdown(); }
@Override public void operationComplete(ChannelFuture future) throws Exception { // Fail the call if we failed to write it out. This usually because the channel is // closed. This is needed because we may shutdown the channel inside event loop and // there may still be some pending calls in the event loop queue after us. if (!future.isSuccess()) { call.setException(toIOE(future.cause())); } } });
LOG.trace("Error while writing call, call_id:" + call.id, t); IOException e = IPCUtil.toIOE(t); closeConn(e); return;
@Override public void operationComplete(ChannelFuture future) throws Exception { Channel ch = future.channel(); if (!future.isSuccess()) { failInit(ch, toIOE(future.cause())); rpcClient.failedServers.addToFailedServers(remoteId.address, future.cause()); return; } ch.writeAndFlush(connectionHeaderPreamble.retainedDuplicate()); if (useSasl) { saslNegotiate(ch); } else { // send the connection header to server ch.write(connectionHeaderWithLength.retainedDuplicate()); established(ch); } } }).channel();
private void callMethod(final Descriptors.MethodDescriptor md, final HBaseRpcController hrc, final Message param, Message returnType, final User ticket, final InetSocketAddress addr, final RpcCallback<Message> callback) { final MetricsConnection.CallStats cs = MetricsConnection.newCallStats(); cs.setStartTime(EnvironmentEdgeManager.currentTime()); final AtomicInteger counter = concurrentCounterCache.getUnchecked(addr); Call call = new Call(nextCallId(), md, param, hrc.cellScanner(), returnType, hrc.getCallTimeout(), hrc.getPriority(), new RpcCallback<Call>() { @Override public void run(Call call) { counter.decrementAndGet(); onCallFinished(call, hrc, addr, callback); } }, cs); ConnectionId remoteId = new ConnectionId(ticket, md.getService().getName(), addr); int count = counter.incrementAndGet(); try { if (count > maxConcurrentCallsPerServer) { throw new ServerTooBusyException(addr, count); } cs.setConcurrentCallsPerServer(count); T connection = getConnection(remoteId); connection.sendRequest(call, hrc); } catch (Exception e) { call.setException(toIOE(e)); } }
@Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) { if (!id2Call.isEmpty()) { cleanupCalls(ctx, IPCUtil.toIOE(cause)); } conn.shutdown(); }
final Throwable error = future.cause(); scheduleRelogin(error); failInit(ch, toIOE(error));
@Override public void operationComplete(ChannelFuture future) throws Exception { // Fail the call if we failed to write it out. This usually because the channel is // closed. This is needed because we may shutdown the channel inside event loop and // there may still be some pending calls in the event loop queue after us. if (!future.isSuccess()) { call.setException(toIOE(future.cause())); } } });
LOG.trace("Error while writing call, call_id:" + call.id, t); IOException e = IPCUtil.toIOE(t); closeConn(e); return;
@Override public void operationComplete(ChannelFuture future) throws Exception { Channel ch = future.channel(); if (!future.isSuccess()) { failInit(ch, toIOE(future.cause())); rpcClient.failedServers.addToFailedServers(remoteId.address, future.cause()); return; } ch.writeAndFlush(connectionHeaderPreamble.retainedDuplicate()); if (useSasl) { saslNegotiate(ch); } else { // send the connection header to server ch.write(connectionHeaderWithLength.retainedDuplicate()); established(ch); } } }).channel();
private void callMethod(final Descriptors.MethodDescriptor md, final HBaseRpcController hrc, final Message param, Message returnType, final User ticket, final InetSocketAddress addr, final RpcCallback<Message> callback) { final MetricsConnection.CallStats cs = MetricsConnection.newCallStats(); cs.setStartTime(EnvironmentEdgeManager.currentTime()); final AtomicInteger counter = concurrentCounterCache.getUnchecked(addr); Call call = new Call(nextCallId(), md, param, hrc.cellScanner(), returnType, hrc.getCallTimeout(), hrc.getPriority(), new RpcCallback<Call>() { @Override public void run(Call call) { counter.decrementAndGet(); onCallFinished(call, hrc, addr, callback); } }, cs); ConnectionId remoteId = new ConnectionId(ticket, md.getService().getName(), addr); int count = counter.incrementAndGet(); try { if (count > maxConcurrentCallsPerServer) { throw new ServerTooBusyException(addr, count); } cs.setConcurrentCallsPerServer(count); T connection = getConnection(remoteId); connection.sendRequest(call, hrc); } catch (Exception e) { call.setException(toIOE(e)); } }
final Throwable error = future.cause(); scheduleRelogin(error); failInit(ch, toIOE(error));