Package akka.util

Class SerializedSuspendableExecutionContext

  • All Implemented Interfaces:
    java.io.Serializable, 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$
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static V accumulateAndGet​(V x$1, java.util.function.BinaryOperator<V> x$2)  
      static void add​(T value)  
      static void addNode​(AbstractNodeQueue.Node<T> n)  
      static SerializedSuspendableExecutionContext apply​(int throughput, scala.concurrent.ExecutionContext context)  
      void attach()  
      static boolean compareAndSet​(V x$1, V x$2)  
      scala.concurrent.ExecutionContext context()  
      static int count()  
      void execute​(java.lang.Runnable task)  
      static V get()  
      static V getAndAccumulate​(V x$1, java.util.function.BinaryOperator<V> x$2)  
      static V getAndSet​(V x$1)  
      static V getAndUpdate​(java.util.function.UnaryOperator<V> x$1)  
      static boolean isEmpty()  
      static void lazySet​(V x$1)  
      static int Off()  
      static int On()  
      static T peek()  
      protected static AbstractNodeQueue.Node<T> peekNode()  
      static T poll()  
      static AbstractNodeQueue.Node<T> pollNode()  
      static scala.concurrent.ExecutionContext prepare()  
      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()  
      static void set​(V x$1)  
      int size()
      O(N)
      void suspend()
      Suspends execution of tasks until resume is called, this operation is idempotent.
      static int Suspended()  
      java.lang.String toString()  
      static V updateAndGet​(java.util.function.UnaryOperator<V> x$1)  
      static boolean weakCompareAndSet​(V x$1, V x$2)  
      • 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

        prepare
    • 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()
      • get

        public static final V get()
      • set

        public static final void set​(V x$1)
      • lazySet

        public static final void lazySet​(V x$1)
      • compareAndSet

        public static final boolean compareAndSet​(V x$1,
                                                  V x$2)
      • weakCompareAndSet

        public static final boolean weakCompareAndSet​(V x$1,
                                                      V x$2)
      • getAndSet

        public static final V getAndSet​(V x$1)
      • getAndUpdate

        public static final V getAndUpdate​(java.util.function.UnaryOperator<V> x$1)
      • updateAndGet

        public static final V updateAndGet​(java.util.function.UnaryOperator<V> x$1)
      • getAndAccumulate

        public static final V getAndAccumulate​(V x$1,
                                               java.util.function.BinaryOperator<V> x$2)
      • accumulateAndGet

        public static final V accumulateAndGet​(V x$1,
                                               java.util.function.BinaryOperator<V> x$2)
      • peek

        public static final T peek()
      • add

        public static final void add​(T value)
      • isEmpty

        public static final boolean isEmpty()
      • count

        public static final int count()
      • poll

        public static final T poll()
      • prepare

        public static scala.concurrent.ExecutionContext prepare()
      • 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()
        O(N)
        Returns:
        the number of Runnable's currently enqueued
      • toString

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