public final class ConcurrentUtil extends Object
java.util.concurrent
".Modifier and Type | Field and Description |
---|---|
static ExecutorService |
SEQUENTIAL_EXECUTOR_SERVICE
An
ExecutorService which executes callables in the same thread immediately. |
Modifier and Type | Method and Description |
---|---|
static <T> Consumer<T> |
aggregate(int n,
Consumer<? super List<T>> delegate)
Creates and returns a
Consumer which, when invoked, acts as follows:
First ... |
static <T> List<Consumer<T>> |
collect(int n,
Consumer<? super List<T>> delegate)
Creates and returns a list of n consumers; when each of these has been invoked exactly once,
then the delegate is invoked with a list of the consumed subjects, in the same order as the
consumers.
|
static Runnable |
count(int n,
Runnable delegate)
Creates and returns a
Runnable which, when run, acts as follows:
First ... |
public static final ExecutorService SEQUENTIAL_EXECUTOR_SERVICE
ExecutorService
which executes callables in the same thread immediately.public static Runnable count(int n, Runnable delegate)
Runnable
which, when run, acts as follows:
IllegalStateException
Runnable
can be run from any thread.public static <T> Consumer<T> aggregate(int n, Consumer<? super List<T>> delegate)
Consumer
which, when invoked, acts as follows:
IllegalStateException
Consumer
can be invoked from any thread.public static <T> List<Consumer<T>> collect(int n, Consumer<? super List<T>> delegate)
When one of the returned consumers is invoked more than once, then it throws an IllegalStateException
.
Copyright © 2018 Arno Unkrig. All rights reserved.