@Test public void testExecuteRequestCallback() throws Exception { final AtomicInteger cc = new AtomicInteger(0); RequestResponseFuture future = new RequestResponseFuture(UUID.randomUUID().toString(), 3 * 1000L, new RequestCallback() { @Override public void onSuccess(Message message) { cc.incrementAndGet(); } @Override public void onException(Throwable e) { } }); future.setSendRequestOk(true); future.executeRequestCallback(); assertThat(cc.get()).isEqualTo(1); }
public void executeRequestCallback() { if (requestCallback != null) { if (sendRequestOk && cause == null) { requestCallback.onSuccess(responseMsg); } else { requestCallback.onException(cause); } } }
RequestResponseFuture { public void executeRequestCallback() { if (requestCallback != null) { if (sendRequestOk && cause == null) { requestCallback.onSuccess(responseMsg); } else { requestCallback.onException(cause); } } } }
RequestResponseFuture { public void executeRequestCallback() { if (requestCallback != null) { if (sendRequestOk && cause == null) { requestCallback.onSuccess(responseMsg); } else { requestCallback.onException(cause); } } } RequestResponseFuture(String correlationId, long timeoutMillis, RequestCallback requestCallback); }
RequestResponseFuture { public void executeRequestCallback() { if (requestCallback != null) { if (sendRequestOk && cause == null) { requestCallback.onSuccess(responseMsg); } else { requestCallback.onException(cause); } } } RequestResponseFuture(String correlationId, long timeoutMillis, RequestCallback requestCallback); void executeRequestCallback(); boolean isTimeout(); Message waitResponseMessage(final long timeout); void putResponseMessage(final Message responseMsg); String getCorrelationId(); long getTimeoutMillis(); void setTimeoutMillis(long timeoutMillis); RequestCallback getRequestCallback(); long getBeginTimestamp(); CountDownLatch getCountDownLatch(); void setCountDownLatch(CountDownLatch countDownLatch); Message getResponseMsg(); void setResponseMsg(Message responseMsg); boolean isSendRequestOk(); void setSendRequestOk(boolean sendRequestOk); Message getRequestMsg(); Throwable getCause(); void setCause(Throwable cause); }
RequestResponseFuture { public void executeRequestCallback() { if (requestCallback != null) { if (sendRequestOk && cause == null) { requestCallback.onSuccess(responseMsg); } else { requestCallback.onException(cause); } } } RequestResponseFuture(String correlationId, long timeoutMillis, RequestCallback requestCallback); void executeRequestCallback(); boolean isTimeout(); Message waitResponseMessage(final long timeout); void putResponseMessage(final Message responseMsg); String getCorrelationId(); long getTimeoutMillis(); void setTimeoutMillis(long timeoutMillis); RequestCallback getRequestCallback(); long getBeginTimestamp(); CountDownLatch getCountDownLatch(); void setCountDownLatch(CountDownLatch countDownLatch); Message getResponseMsg(); void setResponseMsg(Message responseMsg); boolean isSendRequestOk(); void setSendRequestOk(boolean sendRequestOk); Message getRequestMsg(); Throwable getCause(); void setCause(Throwable cause);  }