akka.util
Class SerializedSuspendableExecutionContext
java.lang.Object
java.util.concurrent.atomic.AtomicReference<AbstractNodeQueue.Node<T>>
akka.dispatch.AbstractNodeQueue<java.lang.Runnable>
akka.util.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 classes/interfaces inherited from interface scala.concurrent.ExecutionContext |
scala.concurrent.ExecutionContext.Implicits$ |
Methods inherited from class java.util.concurrent.atomic.AtomicReference |
compareAndSet, get, getAndSet, lazySet, set, weakCompareAndSet |
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 |
SerializedSuspendableExecutionContext
public SerializedSuspendableExecutionContext(int throughput,
scala.concurrent.ExecutionContext context)
Off
public static final int Off()
On
public static final int On()
Suspended
public static final int Suspended()
apply
public static SerializedSuspendableExecutionContext apply(int throughput,
scala.concurrent.ExecutionContext context)
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>>