Class SingleThreadExecutionSequencer

  • All Implemented Interfaces:
    ExecutionSequencer, java.lang.AutoCloseable

    public class SingleThreadExecutionSequencer
    extends java.lang.Object
    implements ExecutionSequencer
    Ensures serial execution and thread safety of Runnables by using a single thread underneath.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      void sequence​(java.lang.Runnable runnable)
      Runs the argument asynchronously in an environment that assures the following: - The runnables passed in will be executed one at a time, sequentially.
      • Methods inherited from class java.lang.Object

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

      • sequence

        public void sequence​(java.lang.Runnable runnable)
        Description copied from interface: ExecutionSequencer
        Runs the argument asynchronously in an environment that assures the following: - The runnables passed in will be executed one at a time, sequentially. - The runnables don't need to concern themselves with synchronization and visibility of the mutable state that they modify if that is accessed only by Runnables that are passed to this method.
        Specified by:
        sequence in interface ExecutionSequencer
        Parameters:
        runnable - Will be executed asynchronously.
      • close

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