public final class SerializedSuspendableExecutionContext extends AbstractNodeQueue<java.lang.Runnable> implements java.lang.Runnable, scala.concurrent.ExecutionContext
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
AbstractNodeQueue.Node<T>
Constructor and Description |
---|
SerializedSuspendableExecutionContext(int throughput,
scala.concurrent.ExecutionContext context) |
Modifier and Type | Method and 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) |
add, addNode, count, isEmpty, peek, peekNode, poll, pollNode
accumulateAndGet, compareAndSet, get, getAndAccumulate, getAndSet, getAndUpdate, lazySet, set, updateAndGet, weakCompareAndSet
public SerializedSuspendableExecutionContext(int throughput, scala.concurrent.ExecutionContext context)
public static final int Off()
public static final int On()
public static final int Suspended()
public static SerializedSuspendableExecutionContext apply(int throughput, scala.concurrent.ExecutionContext context)
public static final V get()
public static final void set(V x$1)
public static final void lazySet(V x$1)
public static final boolean compareAndSet(V x$1, V x$2)
public static final boolean weakCompareAndSet(V x$1, V x$2)
public static final V getAndSet(V x$1)
public static final V getAndUpdate(java.util.function.UnaryOperator<V> x$1)
public static final V updateAndGet(java.util.function.UnaryOperator<V> x$1)
public static final V getAndAccumulate(V x$1, java.util.function.BinaryOperator<V> x$2)
public static final V accumulateAndGet(V x$1, java.util.function.BinaryOperator<V> x$2)
protected static final AbstractNodeQueue.Node<T> peekNode()
public static final T peek()
public static final void add(T value)
public static final void addNode(AbstractNodeQueue.Node<T> n)
public static final boolean isEmpty()
public static final int count()
public static final T poll()
public static final AbstractNodeQueue.Node<T> pollNode()
public static scala.concurrent.ExecutionContext prepare()
public scala.concurrent.ExecutionContext context()
public final void resume()
suspend
is called,
if it isn't currently suspended, it is a no-op.
This operation is idempotent.public final void suspend()
resume
is called,
this operation is idempotent.public final void run()
run
in interface java.lang.Runnable
public final void attach()
public final void execute(java.lang.Runnable task)
execute
in interface scala.concurrent.ExecutionContext
public final void reportFailure(java.lang.Throwable t)
reportFailure
in interface scala.concurrent.ExecutionContext
public final int size()
public final java.lang.String toString()
toString
in class java.util.concurrent.atomic.AtomicReference<AbstractNodeQueue.Node<java.lang.Runnable>>