Javadoc
This
RejectedExecutionHandler blocks the current thread until the
backing queue for a
ThreadPoolExecutor can accept another task. This
becomes useful for situations where tasks are typically long running or
unknown and it is undesirable to block the task submission thread for the
entire length of one of these tasks (which can easily happen if using the
java.util.concurrent.ThreadPoolExecutor.CallerRunsPolicy). Provided
your queue of choice for the
ThreadPoolExecutor is bounded, you'll be
able to continue submitting tasks up until the point where the queue is full
and then resume the submitting of new tasks immediately when the queue can
accept more without having to wait on an existing task in the submitting
thread to finish.