Class 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 Detail

      • CountingRejectedExecutionHandler

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

      • 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.