Package io.activej.async
Class AsyncAccumulator<A>
- java.lang.Object
-
- io.activej.async.AsyncAccumulator<A>
-
- All Implemented Interfaces:
AsyncCloseable
public final class AsyncAccumulator<A> extends Object implements AsyncCloseable
-
-
Field Summary
-
Fields inherited from interface io.activej.async.process.AsyncCloseable
STATIC
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> voidaddPromise(@NotNull Promise<T> promise, @NotNull BiConsumer<A,T> consumer)voidcloseEx(@NotNull Throwable e)Closes process exceptionally in case an exception is thrown while executing the given process.voidcomplete()voidcomplete(A result)static <A> AsyncAccumulator<A>create(A accumulator)@NotNull Promise<A>get()AgetAccumulator()intgetActivePromises()<V> SettablePromise<V>newPromise(@NotNull BiConsumer<A,V> consumer)Promise<A>run()Promise<A>run(@NotNull Promise<Void> runtimePromise)<T> AsyncAccumulator<A>withPromise(@NotNull Promise<T> promise, @NotNull BiConsumer<A,T> accumulator)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.activej.async.process.AsyncCloseable
close
-
-
-
-
Method Detail
-
create
public static <A> AsyncAccumulator<A> create(@Nullable A accumulator)
-
withPromise
public <T> AsyncAccumulator<A> withPromise(@NotNull @NotNull Promise<T> promise, @NotNull @NotNull BiConsumer<A,T> accumulator)
-
addPromise
public <T> void addPromise(@NotNull @NotNull Promise<T> promise, @NotNull @NotNull BiConsumer<A,T> consumer)
-
newPromise
public <V> SettablePromise<V> newPromise(@NotNull @NotNull BiConsumer<A,V> consumer)
-
getAccumulator
public A getAccumulator()
-
getActivePromises
public int getActivePromises()
-
complete
public void complete()
-
complete
public void complete(A result)
-
closeEx
public void closeEx(@NotNull @NotNull Throwable e)Description copied from interface:AsyncCloseableCloses process exceptionally in case an exception is thrown while executing the given process.- Specified by:
closeExin interfaceAsyncCloseable- Parameters:
e- exception that is used to close process with
-
-