Interface Task.Collectable<T,R>
- Type Parameters:
T- the type of theTaskR- the type of the result
- All Known Subinterfaces:
Task.Completable<T,R>
public static interface Task.Collectable<T,R>
Provides the mechanism to submit, orchestrate and collect results from a
Task defined as part of an Task.Orchestration, including the creation
of a Task.Coordinator to subscribe to results, manage and interact with
an orchestrated Task.
A Task.Collectable represents the last part of an Task.Orchestration
definition pipeline.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionandThen(Task.CompletionRunnable<? super R> completionRunnable) Provide a runnable to call when the task has completed.submit()Submits theTask.Collectablefor orchestration by aTaskExecutorService.subscribe(Task.Subscriber<? super R> subscriber) Registers the specifiedTask.Subscriberas part of the orchestration of theTask.until(Remote.Predicate<? super R> predicate) Sets theRemote.Predicateto determine when the collection of results will be considered completed, based on the collected result, after which no further results will be published toTask.Subscribers.
-
Method Details
-
until
Sets theRemote.Predicateto determine when the collection of results will be considered completed, based on the collected result, after which no further results will be published toTask.Subscribers.When collection activity is completed,
Task.Subscribers will then be notified by callingTask.Subscriber.onComplete().- Parameters:
predicate- theRemote.Predicateto determine when theTaskhas completed (based on the collected results) ornullto indicate continuous collection and publishing of results- Returns:
- a
Task.Collectableto permit fluent-style method chaining
-
andThen
Provide a runnable to call when the task has completed.- Parameters:
completionRunnable- theTask.CompletionRunnableto call when theTaskhas completed- Returns:
- a
Task.Collectableto permit fluent-style method chaining
-
subscribe
Registers the specifiedTask.Subscriberas part of the orchestration of theTask.This method may be used multiple times to register multiple
Task.Subscribers.- Parameters:
subscriber- theTask.Subscriber- Returns:
- the
Task.Collectableto permit fluent-style method chaining
-
submit
Task.Coordinator<R> submit()Submits theTask.Collectablefor orchestration by aTaskExecutorService.- Returns:
- a
Task.Coordinatorfor managing an orchestratedTaskand publishing of collected results toTask.Subscribers
-