@Test public void shouldTriggerTheFirstTime() throws Exception { timeoutTimerTask.run(mock(Timeout.class)); verify(requestEventBus).triggerEvent(eq(Event.ERROR), eq(httpRequestContext), any(Throwable.class)); }
@Override public void run(Timeout timeout) throws Exception { if (executed.compareAndSet(false, true) && !canceled.get() && !completed.get()) { requestEventBus.triggerEvent(Event.ERROR, httpRequestContext, new TimeoutException("Request timed out")); } }
TotalRequestTimeoutTimerTask implements TimeoutTimerTask { @Override public void run(Timeout timeout) throws Exception { if (executed.compareAndSet(false, true) && !canceled.get() && !completed.get()) { requestEventBus.triggerEvent(Event.ERROR, httpRequestContext, new TimeoutException("Request timed out")); } } }
TotalRequestTimeoutTimerTask implements TimeoutTimerTask { @Override public void run(Timeout timeout) throws Exception { if (executed.compareAndSet(false, true) && !canceled.get() && !completed.get()) { requestEventBus.triggerEvent(Event.ERROR, httpRequestContext, new TimeoutException("Request timed out")); } } TotalRequestTimeoutTimerTask(RequestEventBus requestEventBus, HttpRequestContext httpRequestContext); }
TotalRequestTimeoutTimerTask implements TimeoutTimerTask { @Override public void run(Timeout timeout) throws Exception { if (executed.compareAndSet(false, true) && !canceled.get() && !completed.get()) { requestEventBus.triggerEvent(Event.ERROR, httpRequestContext, new TimeoutException("Request timed out")); } } TotalRequestTimeoutTimerTask(RequestEventBus requestEventBus, HttpRequestContext httpRequestContext); @Override void run(Timeout timeout); @Override void completed(); @Override void cancel(); }
TotalRequestTimeoutTimerTask implements TimeoutTimerTask { @Override public void run(Timeout timeout) throws Exception { if (executed.compareAndSet(false, true) && !canceled.get() && !completed.get()) { requestEventBus.triggerEvent(Event.ERROR, httpRequestContext, new TimeoutException("Request timed out")); } } TotalRequestTimeoutTimerTask(RequestEventBus requestEventBus, HttpRequestContext httpRequestContext); @Override void run(Timeout timeout); @Override void completed(); @Override void cancel();  }