Interface RejectedExecutionHandler


  • public interface RejectedExecutionHandler
    Interface to be invoked when a limiter can not accept a task for any reason. Since in threadly pools will only reject tasks if the pool is shutdown, this is currently specific to our limiting wrappers.
    Since:
    4.8.0
    • Field Detail

      • THROW_REJECTED_EXECUTION_EXCEPTION

        static final RejectedExecutionHandler THROW_REJECTED_EXECUTION_EXCEPTION
        Typically the default handler for most pool implementations. This handler will only throw a RejectedExecutionException to indicate the failure in accepting the task.
    • Method Detail

      • handleRejectedTask

        void handleRejectedTask​(java.lang.Runnable task)
        Handle the task that was unable to be accepted by a pool. This function may simply swallow the task, log, queue in a different way, or throw an exception. Note that this task may not be the original task submitted, but an instance of ListenableFutureTask or something similar to convert Callables or handle other future needs. In any case the comparison of tasks should be possible using ContainerHelper.
        Parameters:
        task - Task which could not be submitted to the pool