Interface ResultFuture<OUT>
-
- Type Parameters:
OUT
- Output type
- All Known Subinterfaces:
StreamElementQueueEntry<OUT>
- All Known Implementing Classes:
StreamRecordQueueEntry
@PublicEvolving public interface ResultFuture<OUT>
ResultFuture
collects data / error in user codes while processing async i/o.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
complete(Collection<OUT> result)
Completes the result future with a collection of result objects.void
complete(CollectionSupplier<OUT> supplier)
The same as complete, but will execute the supplier on the Mailbox thread which initiated the asynchronous process.void
completeExceptionally(Throwable error)
Completes the result future exceptionally with an exception.
-
-
-
Method Detail
-
complete
void complete(Collection<OUT> result)
Completes the result future with a collection of result objects.Note that it should be called for exactly one time in the user code. Calling this function for multiple times will cause data lose.
Put all results in a
Collection
and then emit output.- Parameters:
result
- A list of results.
-
completeExceptionally
void completeExceptionally(Throwable error)
Completes the result future exceptionally with an exception.- Parameters:
error
- A Throwable object.
-
complete
void complete(CollectionSupplier<OUT> supplier)
The same as complete, but will execute the supplier on the Mailbox thread which initiated the asynchronous process.Note that if an exception is thrown while executing the supplier, the result should be the same as calling
completeExceptionally(Throwable)
.
-
-