Class SerialExecutor

  • All Implemented Interfaces:
    java.lang.AutoCloseable

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

      Fields 
      Modifier and Type Field Description
      (package private) java.util.concurrent.Executor executor  
      (package private) org.osgi.util.promise.PromiseFactory factory  
      (package private) static org.slf4j.Logger logger  
      (package private) java.util.Deque<java.lang.Runnable> tasks  
      (package private) java.lang.Thread thread  
    • Constructor Summary

      Constructors 
      Constructor Description
      SerialExecutor​(java.util.concurrent.Executor executor)
      The executor to use.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      void run​(java.lang.Runnable runnable)
      Run the runnable in order of submission.
      <T> org.osgi.util.promise.Promise<T> submit​(java.util.concurrent.Callable<T> callable)
      Run serial in order of submission and return a promise
      • Methods inherited from class java.lang.Object

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

      • logger

        static final org.slf4j.Logger logger
      • executor

        final java.util.concurrent.Executor executor
      • tasks

        final java.util.Deque<java.lang.Runnable> tasks
      • factory

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

        volatile java.lang.Thread thread
    • Constructor Detail

      • SerialExecutor

        public SerialExecutor​(java.util.concurrent.Executor executor)
        The executor to use.
        Parameters:
        executor -
    • Method Detail

      • submit

        public <T> org.osgi.util.promise.Promise<T> submit​(java.util.concurrent.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​(java.lang.Runnable runnable)
        Run the runnable in order of submission.
        Parameters:
        runnable - the runnable
      • close

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