@Override public void operationComplete(ResponseFuture responseFuture) { try { submitCallback.call(responseFuture.getResponseCommand()); } finally { latch.countDown(); } } });
try { final ResponseFuture responseFuture = new ResponseFuture(request.getOpaque(), timeoutMillis, null, null); this.responseTable.put(request.getOpaque(), responseFuture); channel.writeAndFlush(request).addListener(new ChannelHandlerListener() { RemotingCommand responseCommand = responseFuture.waitResponse(timeoutMillis); if (null == responseCommand) { if (responseFuture.isSendRequestOK()) { throw new RemotingTimeoutException(RemotingHelper.parseChannelRemoteAddr(channel), timeoutMillis, responseFuture.getCause()); responseFuture.getCause());
public void processResponseCommand(Channel channel, RemotingCommand cmd) { final ResponseFuture responseFuture = responseTable.get(cmd.getOpaque()); if (responseFuture != null) { responseFuture.setResponseCommand(cmd); responseFuture.release(); if (responseFuture.getAsyncCallback() != null) { boolean runInThisThread = false; ExecutorService executor = this.getCallbackExecutor(); responseFuture.executeInvokeCallback(); } catch (Exception e) { LOGGER.warn("", e); responseFuture.putResponse(cmd);
public void scanResponseTable() { Iterator<Entry<Integer, ResponseFuture>> it = this.responseTable.entrySet().iterator(); while (it.hasNext()) { Entry<Integer, ResponseFuture> next = it.next(); ResponseFuture rep = next.getValue(); if ((rep.getBeginTimestamp() + rep.getTimeoutMillis() + 1000) <= SystemClock.now()) { it.remove(); rep.release(); try { rep.executeInvokeCallback(); } catch (Exception e) { LOGGER.error("scanResponseTable, operationComplete exception", e); } LOGGER.warn("remove timeout request, " + rep); } } }
@Override public void operationComplete(Future future) throws Exception { if (future.isSuccess()) { responseFuture.setSendRequestOK(true); return; } else { responseFuture.setSendRequestOK(false); } responseFuture.putResponse(null); try { responseFuture.executeInvokeCallback(); } finally { responseFuture.release(); } responseTable.remove(request.getOpaque()); LOGGER.warn("send a request command to channel <" + channel.remoteAddress() + "> failed."); LOGGER.warn(request.toString()); } });
@Override public void operationComplete(Future future) throws Exception { if (future.isSuccess()) { responseFuture.setSendRequestOK(true); return; } else { responseFuture.setSendRequestOK(false); } responseTable.remove(request.getOpaque()); responseFuture.setCause(future.cause()); responseFuture.putResponse(null); LOGGER.warn("send a request command to channel <" + channel.remoteAddress() + "> failed."); LOGGER.warn(request.toString()); } });
@Override public void operationComplete(Future future) throws Exception { if (future.isSuccess()) { responseFuture.setSendRequestOK(true); return; } else { responseFuture.setSendRequestOK(false); } responseFuture.putResponse(null); responseFuture.executeInvokeCallback(); responseTable.remove(request.getOpaque()); LOGGER.warn("send a request command to channel <" + channel.remoteAddress() + "> failed."); LOGGER.warn(request.toString()); } });
@Override public void run() { try { responseFuture.executeInvokeCallback(); } catch (Exception e) { LOGGER.warn("execute callback in executor exception, and callback throw", e); } } });
new ResponseFuture(request.getOpaque(), timeoutMillis, asyncCallback, once); this.responseTable.put(request.getOpaque(), responseFuture); try {
public void scanResponseTable() { Iterator<Entry<Integer, ResponseFuture>> it = this.responseTable.entrySet().iterator(); while (it.hasNext()) { Entry<Integer, ResponseFuture> next = it.next(); ResponseFuture rep = next.getValue(); if ((rep.getBeginTimestamp() + rep.getTimeoutMillis() + 1000) <= SystemClock.now()) { it.remove(); rep.release(); try { rep.executeInvokeCallback(); } catch (Exception e) { LOGGER.error("scanResponseTable, operationComplete exception", e); } LOGGER.warn("remove timeout request, " + rep); } } }
@Override public void operationComplete(Future future) throws Exception { if (future.isSuccess()) { responseFuture.setSendRequestOK(true); return; } else { responseFuture.setSendRequestOK(false); } responseFuture.putResponse(null); try { responseFuture.executeInvokeCallback(); } finally { responseFuture.release(); } responseTable.remove(request.getOpaque()); LOGGER.warn("send a request command to channel <" + channel.remoteAddress() + "> failed."); LOGGER.warn(request.toString()); } });
@Override public void operationComplete(Future future) throws Exception { if (future.isSuccess()) { responseFuture.setSendRequestOK(true); return; } else { responseFuture.setSendRequestOK(false); } responseTable.remove(request.getOpaque()); responseFuture.setCause(future.cause()); responseFuture.putResponse(null); LOGGER.warn("send a request command to channel <" + channel.remoteAddress() + "> failed."); LOGGER.warn(request.toString()); } });
@Override public void run() { try { responseFuture.executeInvokeCallback(); } catch (Exception e) { LOGGER.warn("execute callback in executor exception, and callback throw", e); } } });
new ResponseFuture(request.getOpaque(), timeoutMillis, asyncCallback, once); this.responseTable.put(request.getOpaque(), responseFuture); try {
public void processResponseCommand(Channel channel, RemotingCommand cmd) { final ResponseFuture responseFuture = responseTable.get(cmd.getOpaque()); if (responseFuture != null) { responseFuture.setResponseCommand(cmd); responseFuture.release(); if (responseFuture.getAsyncCallback() != null) { boolean runInThisThread = false; ExecutorService executor = this.getCallbackExecutor(); responseFuture.executeInvokeCallback(); } catch (Exception e) { LOGGER.warn("", e); responseFuture.putResponse(cmd);
@Override public void operationComplete(ResponseFuture responseFuture) { try { submitCallback.call(responseFuture.getResponseCommand()); } finally { latch.countDown(); } } });
public void scanResponseTable() { Iterator<Entry<Integer, ResponseFuture>> it = this.responseTable.entrySet().iterator(); while (it.hasNext()) { Entry<Integer, ResponseFuture> next = it.next(); ResponseFuture rep = next.getValue(); if ((rep.getBeginTimestamp() + rep.getTimeoutMillis() + 1000) <= SystemClock.now()) { it.remove(); rep.release(); try { rep.executeInvokeCallback(); } catch (Exception e) { LOGGER.error("scanResponseTable, operationComplete exception", e); } LOGGER.warn("remove timeout request, " + rep); } } }
try { final ResponseFuture responseFuture = new ResponseFuture(request.getOpaque(), timeoutMillis, null, null); this.responseTable.put(request.getOpaque(), responseFuture); channel.writeAndFlush(request).addListener(new ChannelHandlerListener() { RemotingCommand responseCommand = responseFuture.waitResponse(timeoutMillis); if (null == responseCommand) { if (responseFuture.isSendRequestOK()) { throw new RemotingTimeoutException(RemotingHelper.parseChannelRemoteAddr(channel), timeoutMillis, responseFuture.getCause()); responseFuture.getCause());
@Override public void operationComplete(Future future) throws Exception { if (future.isSuccess()) { responseFuture.setSendRequestOK(true); return; } else { responseFuture.setSendRequestOK(false); } responseTable.remove(request.getOpaque()); responseFuture.setCause(future.cause()); responseFuture.putResponse(null); LOGGER.warn("send a request command to channel <" + channel.remoteAddress() + "> failed."); LOGGER.warn(request.toString()); } });
@Override public void run() { try { responseFuture.executeInvokeCallback(); } catch (Exception e) { LOGGER.warn("execute callback in executor exception, and callback throw", e); } } });