Class CountingRejectedExecutionHandler
java.lang.Object
org.opendaylight.yangtools.util.concurrent.CountingRejectedExecutionHandler
- All Implemented Interfaces:
RejectedExecutionHandler
A RejectedExecutionHandler that delegates to a backing RejectedExecutionHandler and counts the
number of rejected tasks.
- Author:
- Thomas Pantelis
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor. -
Method Summary
Modifier and TypeMethodDescriptionlong
Returns the rejected task count.Returns a counting handler for rejected tasks that throws a RejectedExecutionException.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.Returns a counting handler for rejected tasks that blocks on theThreadPoolExecutor
's backing queue until it can add the task to the queue.void
rejectedExecution
(Runnable task, ThreadPoolExecutor executor)
-
Constructor Details
-
CountingRejectedExecutionHandler
Constructor.- Parameters:
delegate
- the backing RejectedExecutionHandler.
-
-
Method Details
-
rejectedExecution
- Specified by:
rejectedExecution
in interfaceRejectedExecutionHandler
-
getRejectedTaskCount
public long getRejectedTaskCount()Returns the rejected task count. -
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
Returns a counting handler for rejected tasks that throws a RejectedExecutionException. -
newCallerWaitsPolicy
Returns a counting handler for rejected tasks that blocks on theThreadPoolExecutor
's backing queue until it can add the task to the queue.
-