Class ThreadPool.RejectionHandler

java.lang.Object
io.helidon.common.configurable.ThreadPool.RejectionHandler
All Implemented Interfaces:
RejectedExecutionHandler
Enclosing class:
ThreadPool

public static class ThreadPool.RejectionHandler extends Object implements RejectedExecutionHandler
A RejectedExecutionHandler that supports pool growth by re-attempting to add the task to the queue. If the queue is actually full, the rejection is counted and an exception thrown.
  • Constructor Details

    • RejectionHandler

      protected RejectionHandler()
      Creates a new rejection handler that counts rejections when attempting to offer rejected tasks to thread pool executor.
  • Method Details

    • rejectedExecution

      public void rejectedExecution(Runnable task, ThreadPoolExecutor executor)
      Specified by:
      rejectedExecution in interface RejectedExecutionHandler
    • getRejectionCount

      public int getRejectionCount()
      Returns the number of rejections.
      Returns:
      the count.
    • throwException

      protected void throwException(ThreadPoolExecutor executor)
      Throws an exception.
      Parameters:
      executor - The executor that is rejecting the task.