Class SingleTaskExecutorImpl

  • All Implemented Interfaces:
    SingleTaskExecutor, TaskExecutor, java.lang.AutoCloseable, java.lang.Runnable, java.util.concurrent.Executor

    public final class SingleTaskExecutorImpl
    extends java.lang.Object
    implements java.lang.Runnable, SingleTaskExecutor
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      void execute​(java.lang.Runnable task)  
      void run()  
      boolean stop​(java.lang.Runnable task)
      Atomically stop the active task
      java.lang.Runnable task()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SingleTaskExecutorImpl

        public SingleTaskExecutorImpl()
    • Method Detail

      • run

        public final void run()
        Specified by:
        run in interface java.lang.Runnable
      • execute

        public final void execute​(java.lang.Runnable task)
                           throws java.util.concurrent.RejectedExecutionException
        Specified by:
        execute in interface java.util.concurrent.Executor
        Throws:
        java.util.concurrent.RejectedExecutionException
      • task

        public final java.lang.Runnable task()
        Specified by:
        task in interface SingleTaskExecutor
        Returns:
        the active task instance, null if no active task is being executed at the moment
      • stop

        public final boolean stop​(java.lang.Runnable task)
        Description copied from interface: SingleTaskExecutor
        Atomically stop the active task
        Specified by:
        stop in interface SingleTaskExecutor
        Parameters:
        task - the task to check if it is still active
        Returns:
        true if the task was still active and stopped, false otherwise
      • close

        public final void close()
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface TaskExecutor