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 aTaskdefined as part of anTask.Orchestration, including the creation of aTask.Coordinatorto subscribe to results, manage and interact with an orchestratedTask.A
Task.Collectablerepresents the last part of anTask.Orchestrationdefinition pipeline.- See Also:
Task.Orchestration
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Task.Completable<T,R>andThen(Task.CompletionRunnable<? super R> completionRunnable)Provide a runnable to call when the task has completed.Task.Coordinator<R>submit()Submits theTask.Collectablefor orchestration by aTaskExecutorService.Task.Collectable<T,R>subscribe(Task.Subscriber<? super R> subscriber)Registers the specifiedTask.Subscriberas part of the orchestration of theTask.Task.Completable<T,R>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 Detail
-
until
Task.Completable<T,R> 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.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
Task.Completable<T,R> andThen(Task.CompletionRunnable<? super R> completionRunnable)
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
Task.Collectable<T,R> subscribe(Task.Subscriber<? super R> subscriber)
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
-
-