Class TimeoutProcessor

  • All Implemented Interfaces:
    java.util.concurrent.Executor

    public class TimeoutProcessor
    extends java.lang.Object
    implements java.util.concurrent.Executor
    More efficient handling of cancellable schedulable events. The default ScheduledExecutorService is designed to handle schedulable tasks where cancellation is rare. However, for the purposes of handling timeouts, we would prefer cancellation to be the common case and the tasks should be rarely run.
    See Also:
    ScheduledExecutorService
    • Constructor Detail

      • TimeoutProcessor

        public TimeoutProcessor()
      • TimeoutProcessor

        public TimeoutProcessor​(ResourceRegistry registry,
                                boolean useTreeMap,
                                int executorThreadCount)
      • TimeoutProcessor

        public TimeoutProcessor​(ResourceRegistry registry,
                                long tickingInterval,
                                boolean useTreeMap,
                                int executorThreadCount)
    • Method Detail

      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • shutdownNow

        public void shutdownNow()
        See Also:
        ExecutorService.shutdownNow()
      • awaitTermination

        public void awaitTermination​(int timeout,
                                     java.util.concurrent.TimeUnit unit)
                              throws java.lang.InterruptedException
        Parameters:
        timeout - the maximum time to wait
        unit - the time unit of the timeout argument
        Throws:
        java.lang.InterruptedException - if interrupted while waiting
        See Also:
        ExecutorService.awaitTermination(long, java.util.concurrent.TimeUnit)
      • execute

        public void execute​(java.lang.Runnable command)
        Specified by:
        execute in interface java.util.concurrent.Executor