Class CountingRejectedExecutionHandler

java.lang.Object
org.opendaylight.yangtools.util.concurrent.CountingRejectedExecutionHandler
All Implemented Interfaces:
RejectedExecutionHandler

public class CountingRejectedExecutionHandler extends Object implements RejectedExecutionHandler
A RejectedExecutionHandler that delegates to a backing RejectedExecutionHandler and counts the number of rejected tasks.
Author:
Thomas Pantelis
  • Constructor Details

    • CountingRejectedExecutionHandler

      public CountingRejectedExecutionHandler(RejectedExecutionHandler delegate)
      Constructor.
      Parameters:
      delegate - the backing RejectedExecutionHandler.
  • Method Details

    • rejectedExecution

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

      public long getRejectedTaskCount()
      Returns the rejected task count.
    • newCallerRunsPolicy

      public static CountingRejectedExecutionHandler newCallerRunsPolicy()
      Returns a counting handler for rejected tasks that runs the rejected task directly in the calling thread of the execute method, unless the executor has been shut down, in which case the task is discarded.
    • newAbortPolicy

      public static CountingRejectedExecutionHandler newAbortPolicy()
      Returns a counting handler for rejected tasks that throws a RejectedExecutionException.
    • newCallerWaitsPolicy

      public static CountingRejectedExecutionHandler newCallerWaitsPolicy()
      Returns a counting handler for rejected tasks that blocks on the ThreadPoolExecutor's backing queue until it can add the task to the queue.