Class SerialExecutor

java.lang.Object
aQute.lib.concurrent.serial.SerialExecutor
All Implemented Interfaces:
AutoCloseable

public class SerialExecutor extends Object implements AutoCloseable
Will execute a set of tasks in order of submit.
  • Field Details

    • logger

      static final org.slf4j.Logger logger
    • executor

      final Executor executor
    • tasks

      final Deque<Runnable> tasks
    • factory

      final org.osgi.util.promise.PromiseFactory factory
    • thread

      volatile Thread thread
  • Constructor Details

    • SerialExecutor

      public SerialExecutor(Executor executor)
      The executor to use.
      Parameters:
      executor -
  • Method Details

    • submit

      public <T> org.osgi.util.promise.Promise<T> submit(Callable<T> callable)
      Run serial in order of submission and return a promise
      Type Parameters:
      T - the return type
      Parameters:
      callable - the callable providing the data
      Returns:
      the promise
    • run

      public void run(Runnable runnable)
      Run the runnable in order of submission.
      Parameters:
      runnable - the runnable
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable