@Test public void shouldInvokeActionOnRetryCloseTimeout() throws Exception { when(mockAgent.doWork()).then(answersWithDelay(500, RETURNS_DEFAULTS)); final Thread agentRunnerThread = new Thread(runner); agentRunnerThread.start(); Thread.sleep(100); final AtomicInteger closeTimeoutCalls = new AtomicInteger(); runner.close( 1, (t) -> { closeTimeoutCalls.incrementAndGet(); assertSame(t, agentRunnerThread); }); assertThat(closeTimeoutCalls.get(), greaterThan(0)); }
public final void close() { close(RETRY_CLOSE_TIMEOUT_MS, null); }
AgentRunner implements Runnable, AutoCloseable { public final void close() { close(RETRY_CLOSE_TIMEOUT_MS, null); } }
AgentRunner implements Runnable, AutoCloseable { public final void close() { close(RETRY_CLOSE_TIMEOUT_MS, null); } AgentRunner(
        final IdleStrategy idleStrategy,
        final ErrorHandler errorHandler,
        final AtomicCounter errorCounter,
        final Agent agent); }
AgentRunner implements Runnable, AutoCloseable { public final void close() { close(RETRY_CLOSE_TIMEOUT_MS, null); } AgentRunner(
        final IdleStrategy idleStrategy,
        final ErrorHandler errorHandler,
        final AtomicCounter errorCounter,
        final Agent agent); static Thread startOnThread(final AgentRunner runner); static Thread startOnThread(final AgentRunner runner, final ThreadFactory threadFactory); Agent agent(); boolean isClosed(); Thread thread(); void run(); final void close(); final void close(final int retryCloseTimeoutMs, final Consumer<Thread> closeFailAction); }
AgentRunner implements Runnable, AutoCloseable { public final void close() { close(RETRY_CLOSE_TIMEOUT_MS, null); } AgentRunner(
        final IdleStrategy idleStrategy,
        final ErrorHandler errorHandler,
        final AtomicCounter errorCounter,
        final Agent agent); static Thread startOnThread(final AgentRunner runner); static Thread startOnThread(final AgentRunner runner, final ThreadFactory threadFactory); Agent agent(); boolean isClosed(); Thread thread(); void run(); final void close(); final void close(final int retryCloseTimeoutMs, final Consumer<Thread> closeFailAction); static final Thread TOMBSTONE; static final int RETRY_CLOSE_TIMEOUT_MS; }