Class AbstractOrchestration<T,C extends TaskExecutorService>
- java.lang.Object
-
- com.oracle.coherence.concurrent.executor.AbstractOrchestration<T,C>
-
- Type Parameters:
T- the type of results produced by aTaskC- theTaskExecutorServicethat created theTask.Orchestration
- All Implemented Interfaces:
Task.Orchestration<T>,Task.SubscribedOrchestration<T>
- Direct Known Subclasses:
ClusteredOrchestration
public abstract class AbstractOrchestration<T,C extends TaskExecutorService> extends Object implements Task.Orchestration<T>
A base implementation of aTask.Orchestration.- Since:
- 21.12
- Author:
- bo
-
-
Field Summary
Fields Modifier and Type Field Description protected OptionsByType<Task.Option>m_optionsByTypeTheTask.Options forTask.Orchestration.protected Task.Propertiesm_propertiesTheTask.Propertiesfor the orchestratedTask.protected Durationm_retainDurationThe optionalDurationto retain the task after it is completed.protected Set<Task.Subscriber<? super T>>m_setSubscribersThe set ofTask.Subscribers for the orchestratedTask.protected Stringm_sTaskIdTheTaskidentity.protected ExecutionStrategym_strategyprotected ExecutionStrategyBuilderm_strategyBuilderTheExecutionStrategyBuilderused to build theExecutionStrategy.protected Task<T>m_taskTheTaskto execute.protected Cm_taskExecutorServiceTheTaskExecutorServicethat created theTask.Orchestration.
-
Constructor Summary
Constructors Constructor Description AbstractOrchestration(C taskExecutorService, Task<T> task)Constructs aTask.Orchestration.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Task.Orchestration<T>as(String taskId)Sets the unique identity for theTaskwhen it is orchestrated.protected abstract Task.Collectable<T,T>collect()Obtain aTask.Collectableusing the default collection mechanism.Task.Orchestration<T>concurrently()<V extends Serializable>
Task.Orchestration<T>define(String sName, V value)Defines theTask.Propertiesfor theTask.Task.Orchestration<T>filter(com.tangosol.util.function.Remote.Predicate<? super TaskExecutorService.ExecutorInfo> predicate)Limit theExecutors to only those that satisfy the specifiedRemote.Predicate.ExecutionStrategygetAssignmentStrategy()Obtains theExecutionStrategyfor theTaskorchestration.OptionsByType<Task.Option>getOptionsByType()Obtains theOptionsByTypefor theTaskorchestration.Task.PropertiesgetProperties()Obtains theTask.Propertiesfor theTaskorchestration.protected Supplier<Task.Properties>getPropertiesSupplier()Return aSupplierof aTask.Propertiesinstance.DurationgetRetainDuration()Task<T>getTask()Obtains theTaskto orchestrate.CgetTaskExecutorService()Obtains theTask.Orchestrationthat created theTask.Orchestration.StringgetTaskId()Obtains theTaskidentity.Task.Orchestration<T>limit(int cLimit)Task.Orchestration<T>retain(Duration duration)Sets theDurationto retain the task after it is completed.Task.Orchestration<T>sequentially()Task.Coordinator<T>submit()Submits theTaskfor orchestration by theTaskExecutorService.Task.SubscribedOrchestration<T>subscribe(Task.Subscriber<? super T> subscriber)Registers the specifiedTask.Subscriberas part of the orchestration of theTask.Task.Orchestration<T>with(Task.Option... options)Sets theTask.Options for orchestration.-
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.Orchestration
collect
-
-
-
-
Field Detail
-
m_taskExecutorService
protected C extends TaskExecutorService m_taskExecutorService
TheTaskExecutorServicethat created theTask.Orchestration.
-
m_strategyBuilder
protected ExecutionStrategyBuilder m_strategyBuilder
TheExecutionStrategyBuilderused to build theExecutionStrategy.
-
m_strategy
protected ExecutionStrategy m_strategy
-
m_optionsByType
protected OptionsByType<Task.Option> m_optionsByType
TheTask.Options forTask.Orchestration.
-
m_properties
protected Task.Properties m_properties
TheTask.Propertiesfor the orchestratedTask.
-
m_retainDuration
protected Duration m_retainDuration
The optionalDurationto retain the task after it is completed.nullwhen not required (to retain the task)
-
m_setSubscribers
protected Set<Task.Subscriber<? super T>> m_setSubscribers
The set ofTask.Subscribers for the orchestratedTask.
-
-
Constructor Detail
-
AbstractOrchestration
public AbstractOrchestration(C taskExecutorService, Task<T> task)
Constructs aTask.Orchestration.- Parameters:
taskExecutorService- theTaskExecutorServicethat created theTask.Orchestrationtask- theTaskto be orchestrated
-
-
Method Detail
-
concurrently
public Task.Orchestration<T> concurrently()
Description copied from interface:Task.OrchestrationSpecify that theTaskshould be executed concurrently on its assignedExecutors.This is the default setting for execution.
- Specified by:
concurrentlyin interfaceTask.Orchestration<T>- Returns:
- the
Task.Orchestrationto permit fluent-style method chaining
-
sequentially
public Task.Orchestration<T> sequentially()
Description copied from interface:Task.Orchestration- Specified by:
sequentiallyin interfaceTask.Orchestration<T>- Returns:
- the
Task.Orchestrationto permit fluent-style method chaining
-
filter
public Task.Orchestration<T> filter(com.tangosol.util.function.Remote.Predicate<? super TaskExecutorService.ExecutorInfo> predicate)
Description copied from interface:Task.OrchestrationLimit theExecutors to only those that satisfy the specifiedRemote.Predicate.- Specified by:
filterin interfaceTask.Orchestration<T>- Parameters:
predicate- theTaskExecutorService.ExecutorInfopredicate- Returns:
- the
Task.Orchestrationto permit fluent-style method chaining
-
limit
public Task.Orchestration<T> limit(int cLimit)
Description copied from interface:Task.Orchestration- Specified by:
limitin interfaceTask.Orchestration<T>- Parameters:
cLimit- the number ofExecutors to use- Returns:
- the
Task.Orchestrationto permit fluent-style method chaining
-
as
public Task.Orchestration<T> as(String taskId)
Description copied from interface:Task.OrchestrationSets the unique identity for theTaskwhen it is orchestrated.- Specified by:
asin interfaceTask.Orchestration<T>- Parameters:
taskId- the unique identity for theTask- Returns:
- the
Task.Orchestrationto permit fluent-style method chaining
-
with
public Task.Orchestration<T> with(Task.Option... options)
Description copied from interface:Task.OrchestrationSets theTask.Options for orchestration.- Specified by:
within interfaceTask.Orchestration<T>- Parameters:
options- theTask.Option- Returns:
- the
Task.Orchestrationto permit fluent-style method chaining
-
retain
public Task.Orchestration<T> retain(Duration duration)
Description copied from interface:Task.OrchestrationSets theDurationto retain the task after it is completed.- Specified by:
retainin interfaceTask.Orchestration<T>- Parameters:
duration- the duration to retain the task after it is completed.- Returns:
- the
Task.Orchestrationto permit fluent-style method chaining
-
subscribe
public Task.SubscribedOrchestration<T> subscribe(Task.Subscriber<? super T> subscriber)
Description copied from interface:Task.SubscribedOrchestrationRegisters the specifiedTask.Subscriberas part of the orchestration of theTask.This method may be used multiple times to register multiple
Task.Subscribers.This method is mutually exclusive to
Task.Orchestration.collect(Collector). To subscribe when using aTask.Collector, useTask.Collectable.subscribe(Subscriber)on theTask.Collectablereturned byTask.Orchestration.collect(Collector).- Specified by:
subscribein interfaceTask.SubscribedOrchestration<T>- Parameters:
subscriber- theTask.Subscriber- Returns:
- the
Task.Orchestrationto permit fluent-style method chaining - See Also:
Task.Collectable.subscribe(Subscriber)
-
submit
public Task.Coordinator<T> submit()
Description copied from interface:Task.SubscribedOrchestrationSubmits theTaskfor orchestration by theTaskExecutorService.- Specified by:
submitin interfaceTask.SubscribedOrchestration<T>- Returns:
- a
Task.Coordinatorfor managing an orchestratedTaskand publishing of collected results toTask.Subscribers - See Also:
Task.Collectable.subscribe(Subscriber)
-
define
public <V extends Serializable> Task.Orchestration<T> define(String sName, V value)
Description copied from interface:Task.OrchestrationDefines theTask.Propertiesfor theTask.- Specified by:
definein interfaceTask.Orchestration<T>- Type Parameters:
V- the value type of the property- Parameters:
sName- the name of the propertyvalue- the value of the property- Returns:
- the
Task.Orchestrationto permit fluent-style method chaining
-
collect
protected abstract Task.Collectable<T,T> collect()
Obtain aTask.Collectableusing the default collection mechanism.- Returns:
- a
Task.Collectable
-
getTaskExecutorService
public C getTaskExecutorService()
Obtains theTask.Orchestrationthat created theTask.Orchestration.- Returns:
- the
Task.Orchestration
-
getAssignmentStrategy
public ExecutionStrategy getAssignmentStrategy()
Obtains theExecutionStrategyfor theTaskorchestration.- Returns:
- the
ExecutionStrategy
-
getOptionsByType
public OptionsByType<Task.Option> getOptionsByType()
Obtains theOptionsByTypefor theTaskorchestration.- Returns:
- the
OptionsByType
-
getProperties
public Task.Properties getProperties()
Obtains theTask.Propertiesfor theTaskorchestration.- Returns:
- the
Task.Properties
-
getPropertiesSupplier
protected Supplier<Task.Properties> getPropertiesSupplier()
Return aSupplierof aTask.Propertiesinstance.- Returns:
- a
Supplierof aTask.Propertiesinstance
-
-