Class BlockingTaskAwareExecutorServiceImpl

  • All Implemented Interfaces:
    java.util.concurrent.Executor, java.util.concurrent.ExecutorService, BlockingTaskAwareExecutorService

    public class BlockingTaskAwareExecutorServiceImpl
    extends java.util.concurrent.AbstractExecutorService
    implements BlockingTaskAwareExecutorService
    A special executor service that accepts a BlockingRunnable. This special runnable gives hints about the code to be running in order to avoiding put a runnable that will block the thread. In this way, only when the runnable says that is ready, it is sent to the real executor service
    Pedro Ruivo
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean awaitTermination​(long timeout, java.util.concurrent.TimeUnit unit)  
      void checkForReadyTasks()
      It checks for tasks ready to be processed in this ExecutorService.
      void execute​(java.lang.Runnable command)  
      void execute​(BlockingRunnable runnable)
      Executes the given command at some time in the future when the command is less probably to block a thread.
      java.util.concurrent.ExecutorService getExecutorService()  
      boolean isShutdown()  
      boolean isTerminated()  
      void shutdown()  
      java.util.List<java.lang.Runnable> shutdownNow()  
      • Methods inherited from class java.util.concurrent.AbstractExecutorService

        invokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskFor, submit, submit, submit
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.concurrent.ExecutorService

        invokeAll, invokeAll, invokeAny, invokeAny, submit, submit, submit
    • Constructor Detail

      • BlockingTaskAwareExecutorServiceImpl

        public BlockingTaskAwareExecutorServiceImpl​(java.lang.String controllerThreadName,
                                                    java.util.concurrent.ExecutorService executorService,
                                                    TimeService timeService)
    • Method Detail

      • shutdown

        public void shutdown()
        Specified by:
        shutdown in interface java.util.concurrent.ExecutorService
      • shutdownNow

        public java.util.List<java.lang.Runnable> shutdownNow()
        Specified by:
        shutdownNow in interface java.util.concurrent.ExecutorService
      • isShutdown

        public boolean isShutdown()
        Specified by:
        isShutdown in interface java.util.concurrent.ExecutorService
      • isTerminated

        public boolean isTerminated()
        Specified by:
        isTerminated in interface java.util.concurrent.ExecutorService
      • awaitTermination

        public boolean awaitTermination​(long timeout,
                                        java.util.concurrent.TimeUnit unit)
                                 throws java.lang.InterruptedException
        Specified by:
        awaitTermination in interface java.util.concurrent.ExecutorService
      • execute

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

        public java.util.concurrent.ExecutorService getExecutorService()