#501·disruptor

`handleOnShutdownException` might never be invoked in `shutdown`

Author: ocoanetCreated Jul 8, 2025Updated Jul 8, 2025

I identified a potential flaw in the implementation of Disruptor.shutdown:

java
public void shutdown()
{
    try
    {
        shutdown(-1, TimeUnit.MILLISECONDS);
    }
    catch (final TimeoutException e)
    {
        exceptionHandler.handleOnShutdownException(e);
    }
}

The -1 parameter is interpreted as an infinite timeout, which aligns with the method's comments. As a result, TimeoutException will never be thrown and the handleOnShutdownException callback will never be invoked.

To resolve this, I suggest removing the try / catch block.

If needed, I can create a pull request with the changes.