Class AbstractCollectable<T,R,O extends AbstractOrchestration<T,?>>
- java.lang.Object
-
- com.oracle.coherence.concurrent.executor.AbstractCollectable<T,R,O>
-
- Type Parameters:
T- the type of theTaskR- the type of the collected resultO- the type ofTask.Orchestrationon which theTask.Collectableis based
- All Implemented Interfaces:
Task.Collectable<T,R>,Task.Completable<T,R>
public abstract class AbstractCollectable<T,R,O extends AbstractOrchestration<T,?>> extends Object implements Task.Collectable<T,R>, Task.Completable<T,R>
A base implementation of aTask.CollectableandTask.Completable.- Since:
- 21.12
- Author:
- bo
-
-
Field Summary
Fields Modifier and Type Field Description protected Task.Collector<? super T,?,R>m_collectorTheTask.Collectorfor theTask.protected com.tangosol.util.function.Remote.Predicate<? super R>m_completionPredicateThe optionalRemote.Predicateto indicate if collection is completed.protected Task.CompletionRunnable<? super R>m_completionRunnableThe optionalTask.CompletionRunnableto call after the task is completed.protected Om_orchestrationTheTask.Orchestrationon which theTask.Collectableis based.protected LinkedHashSet<Task.Subscriber<? super R>>m_setSubscribers
-
Constructor Summary
Constructors Constructor Description AbstractCollectable(O orchestration, Task.Collector<? super T,?,R> collector)Constructs aTask.Collectablebased on anTask.Orchestration.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Task.Completable<T,R>andThen(Task.CompletionRunnable<? super R> runnable)Provide a runnable to call when the task has completed.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(com.tangosol.util.function.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.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.oracle.coherence.concurrent.executor.Task.Collectable
submit
-
-
-
-
Field Detail
-
m_orchestration
protected O extends AbstractOrchestration<T,?> m_orchestration
TheTask.Orchestrationon which theTask.Collectableis based.
-
m_collector
protected Task.Collector<? super T,?,R> m_collector
TheTask.Collectorfor theTask.
-
m_completionPredicate
protected com.tangosol.util.function.Remote.Predicate<? super R> m_completionPredicate
The optionalRemote.Predicateto indicate if collection is completed.nullwhen not required (for continuous collection)
-
m_setSubscribers
protected LinkedHashSet<Task.Subscriber<? super R>> m_setSubscribers
-
m_completionRunnable
protected Task.CompletionRunnable<? super R> m_completionRunnable
The optionalTask.CompletionRunnableto call after the task is completed.nullwhen not required (to call a Runnable)
-
-
Constructor Detail
-
AbstractCollectable
public AbstractCollectable(O orchestration, Task.Collector<? super T,?,R> collector)
Constructs aTask.Collectablebased on anTask.Orchestration.- Parameters:
orchestration- theTask.Orchestrationcollector- theTask.Collectorof results
-
-
Method Detail
-
until
public Task.Completable<T,R> until(com.tangosol.util.function.Remote.Predicate<? super R> predicate)
Description copied from interface:Task.CollectableSets 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().- Specified by:
untilin interfaceTask.Collectable<T,R>- 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
public Task.Completable<T,R> andThen(Task.CompletionRunnable<? super R> runnable)
Description copied from interface:Task.CollectableProvide a runnable to call when the task has completed.- Specified by:
andThenin interfaceTask.Collectable<T,R>- Parameters:
runnable- theTask.CompletionRunnableto call when theTaskhas completed- Returns:
- a
Task.Collectableto permit fluent-style method chaining
-
subscribe
public Task.Collectable<T,R> subscribe(Task.Subscriber<? super R> subscriber)
Description copied from interface:Task.CollectableRegisters the specifiedTask.Subscriberas part of the orchestration of theTask.This method may be used multiple times to register multiple
Task.Subscribers.- Specified by:
subscribein interfaceTask.Collectable<T,R>- Parameters:
subscriber- theTask.Subscriber- Returns:
- the
Task.Collectableto permit fluent-style method chaining
-
-