Interface Task.Collectable<T,R>
- Type Parameters:
T
- the type of theTask
R
- 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.Collectable
for orchestration by aTaskExecutorService
.subscribe
(Task.Subscriber<? super R> subscriber) Registers the specifiedTask.Subscriber
as part of the orchestration of theTask
.until
(Remote.Predicate<? super R> predicate) Sets theRemote.Predicate
to determine when the collection of results will be considered completed, based on the collected result, after which no further results will be published toTask.Subscriber
s.
-
Method Details
-
until
Sets theRemote.Predicate
to determine when the collection of results will be considered completed, based on the collected result, after which no further results will be published toTask.Subscriber
s.When collection activity is completed,
Task.Subscriber
s will then be notified by callingTask.Subscriber.onComplete()
.- Parameters:
predicate
- theRemote.Predicate
to determine when theTask
has completed (based on the collected results) ornull
to indicate continuous collection and publishing of results- Returns:
- a
Task.Collectable
to permit fluent-style method chaining
-
andThen
Provide a runnable to call when the task has completed.- Parameters:
completionRunnable
- theTask.CompletionRunnable
to call when theTask
has completed- Returns:
- a
Task.Collectable
to permit fluent-style method chaining
-
subscribe
Registers the specifiedTask.Subscriber
as part of the orchestration of theTask
.This method may be used multiple times to register multiple
Task.Subscriber
s.- Parameters:
subscriber
- theTask.Subscriber
- Returns:
- the
Task.Collectable
to permit fluent-style method chaining
-
submit
Task.Coordinator<R> submit()Submits theTask.Collectable
for orchestration by aTaskExecutorService
.- Returns:
- a
Task.Coordinator
for managing an orchestratedTask
and publishing of collected results toTask.Subscriber
s
-