@Test public void timeoutTriggered_multipleCallbacksAdded_allRegisteredCallbacksAreTriggered() { TimeoutExpired callback1 = mock(TimeoutExpired.class); TimeoutExpired callback2 = mock(TimeoutExpired.class); sut.addExpiredCallback(callback1); sut.addExpiredCallback(callback2); requestAndTriggerTimeout(); verify(callback1).expired(isA(Timeout.class)); verify(callback2).expired(isA(Timeout.class)); }
@Override public void addExpiredCallback(final TimeoutExpired callback) { checkNotNull(callback, "Expired callback not allowed to be null."); callbacks.add(callback); }
InMemoryTimeoutManager implements TimeoutManager, AutoCloseable { @Override public void addExpiredCallback(final TimeoutExpired callback) { checkNotNull(callback, "Expired callback not allowed to be null."); callbacks.add(callback); } }
InMemoryTimeoutManager implements TimeoutManager, AutoCloseable { @Override public void addExpiredCallback(final TimeoutExpired callback) { checkNotNull(callback, "Expired callback not allowed to be null."); callbacks.add(callback); } InMemoryTimeoutManager();  InMemoryTimeoutManager(final int timerThreadPoolSize);  InMemoryTimeoutManager(final ScheduledExecutorService scheduledService, final Clock clock); }
InMemoryTimeoutManager implements TimeoutManager, AutoCloseable { @Override public void addExpiredCallback(final TimeoutExpired callback) { checkNotNull(callback, "Expired callback not allowed to be null."); callbacks.add(callback); } InMemoryTimeoutManager();  InMemoryTimeoutManager(final int timerThreadPoolSize);  InMemoryTimeoutManager(final ScheduledExecutorService scheduledService, final Clock clock); @Override void addExpiredCallback(final TimeoutExpired callback); @Override TimeoutId requestTimeout(final ExecutionContext context, final String sagaId, final long delay, final TimeUnit timeUnit, @Nullable final String name,
                               @Nullable final Object data); @Override void cancelTimeouts(final String sagaId); @Override void cancelTimeout(final TimeoutId id); @Override void close(); }
InMemoryTimeoutManager implements TimeoutManager, AutoCloseable { @Override public void addExpiredCallback(final TimeoutExpired callback) { checkNotNull(callback, "Expired callback not allowed to be null."); callbacks.add(callback); } InMemoryTimeoutManager();  InMemoryTimeoutManager(final int timerThreadPoolSize);  InMemoryTimeoutManager(final ScheduledExecutorService scheduledService, final Clock clock); @Override void addExpiredCallback(final TimeoutExpired callback); @Override TimeoutId requestTimeout(final ExecutionContext context, final String sagaId, final long delay, final TimeUnit timeUnit, @Nullable final String name,
                               @Nullable final Object data); @Override void cancelTimeouts(final String sagaId); @Override void cancelTimeout(final TimeoutId id); @Override void close();  }