Package akka.util

Class SerializedSuspendableExecutionContext

  • All Implemented Interfaces:, java.lang.Runnable, scala.concurrent.ExecutionContext

    public final class SerializedSuspendableExecutionContext
    extends AbstractNodeQueue<java.lang.Runnable>
    implements java.lang.Runnable, scala.concurrent.ExecutionContext
    This ExecutionContext allows to wrap an underlying ExecutionContext and provide guaranteed serial execution of tasks submitted to it. On top of that it also allows for *suspending* and *resuming* processing of tasks.

    WARNING: This type must never leak into User code as anything but ExecutionContext

    param: throughput maximum number of tasks to be executed in serial before relinquishing the executing thread. param: context the underlying context which will be used to actually execute the submitted tasks

    See Also:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface scala.concurrent.ExecutionContext

        scala.concurrent.ExecutionContext.Implicits$, scala.concurrent.ExecutionContext.parasitic$
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static SerializedSuspendableExecutionContext apply​(int throughput, scala.concurrent.ExecutionContext context)  
      void attach()  
      scala.concurrent.ExecutionContext context()  
      void execute​(java.lang.Runnable task)  
      static int Off()  
      static int On()  
      void reportFailure​(java.lang.Throwable t)  
      void resume()
      Resumes execution of tasks until suspend is called, if it isn't currently suspended, it is a no-op.
      void run()  
      int size()
      void suspend()
      Suspends execution of tasks until resume is called, this operation is idempotent.
      static int Suspended()  
      java.lang.String toString()  
      • Methods inherited from class java.util.concurrent.atomic.AtomicReference

        accumulateAndGet, compareAndExchange, compareAndExchangeAcquire, compareAndExchangeRelease, compareAndSet, get, getAcquire, getAndAccumulate, getAndSet, getAndUpdate, getOpaque, getPlain, lazySet, set, setOpaque, setPlain, setRelease, updateAndGet, weakCompareAndSet, weakCompareAndSetAcquire, weakCompareAndSetPlain, weakCompareAndSetRelease, weakCompareAndSetVolatile
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface scala.concurrent.ExecutionContext

    • Constructor Detail

      • SerializedSuspendableExecutionContext

        public SerializedSuspendableExecutionContext​(int throughput,
                                                     scala.concurrent.ExecutionContext context)
    • Method Detail

      • Off

        public static final int Off()
      • On

        public static final int On()
      • Suspended

        public static final int Suspended()
      • context

        public scala.concurrent.ExecutionContext context()
      • resume

        public final void resume()
        Resumes execution of tasks until suspend is called, if it isn't currently suspended, it is a no-op. This operation is idempotent.
      • suspend

        public final void suspend()
        Suspends execution of tasks until resume is called, this operation is idempotent.
      • run

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

        public final void attach()
      • execute

        public final void execute​(java.lang.Runnable task)
        Specified by:
        execute in interface scala.concurrent.ExecutionContext
      • reportFailure

        public final void reportFailure​(java.lang.Throwable t)
        Specified by:
        reportFailure in interface scala.concurrent.ExecutionContext
      • size

        public final int size()
        the number of Runnable's currently enqueued
      • toString

        public final java.lang.String toString()
        toString in class java.util.concurrent.atomic.AtomicReference<AbstractNodeQueue.Node<java.lang.Runnable>>