Class ClusteredTaskCoordinator<T>
- java.lang.Object
-
- com.oracle.coherence.concurrent.executor.AbstractTaskCoordinator<T>
-
- com.oracle.coherence.concurrent.executor.ClusteredTaskCoordinator<T>
-
- Type Parameters:
T- the type of theTaskresult
- All Implemented Interfaces:
Task.Coordinator<T>,com.tangosol.util.MapListener,EventListener
public class ClusteredTaskCoordinator<T> extends AbstractTaskCoordinator<T> implements com.tangosol.util.MapListener
An implementation of aTask.Coordinatorfor Coherence-based implementation.- Since:
- 21.12
- Version:
- bo
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classClusteredTaskCoordinator.ClusteredMemberListenerAMemberListenerto monitor the member thisClusteredTaskCoordinatoris part of / connected to in case of an *Extend client.
-
Field Summary
Fields Modifier and Type Field Description protected com.tangosol.net.CacheServicef_cacheServiceTheCacheServiceused by the executor service.protected ClusteredTaskCoordinator.ClusteredMemberListenerf_memberListenerThe member listener for cluster member.protected Task.Propertiesm_propertiesThe sharableTask.Propertiesfor this task.-
Fields inherited from class com.oracle.coherence.concurrent.executor.AbstractTaskCoordinator
f_cancelled, f_closed, f_executorService, f_fRetainTask, f_sTaskId, m_lastValue, m_setSubscribers
-
-
Constructor Summary
Constructors Constructor Description ClusteredTaskCoordinator(com.tangosol.net.CacheService service, ClusteredTaskManager manager, ExecutorService executorService)Constructs aClusteredTaskCoordinator.ClusteredTaskCoordinator(com.tangosol.net.CacheService service, ClusteredTaskManager manager, ExecutorService executorService, Task.Properties properties, Iterator<Task.Subscriber<? super T>> subscribers)Constructs aClusteredTaskCoordinator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddMemberListener(com.tangosol.net.MemberListener listener)Adds the specifiedMemberListener.booleancancel(boolean fMayInterruptIfRunning)Attempts to cancel execution of theTask.voidclose()Closes thisClusteredTaskCoordinatorand notifies theTask.Subscribers that there will no longer be any further items by callingTask.Subscriber.onComplete().voidentryDeleted(com.tangosol.util.MapEvent mapEvent)voidentryInserted(com.tangosol.util.MapEvent mapEvent)voidentryUpdated(com.tangosol.util.MapEvent mapEvent)protected com.tangosol.net.CacheServicegetCacheService()Task.PropertiesgetProperties()Obtain the properties of theTaskbeing coordinated.protected voidremoveMapListener()Removes theMapListenerpreviously installed by thisClusteredTaskCoordinator.voidremoveMemberListener(com.tangosol.net.MemberListener listener)Removes the specifiedMemberListener.protected voidsubscribeRetainedTask(Task.Subscriber subscriber)Subscribes to a retained task (a task that has completed execution, but it still held in memory).-
Methods inherited from class com.oracle.coherence.concurrent.executor.AbstractTaskCoordinator
closeSubscriber, getTaskId, hasSubscribers, isCancelled, isDone, offer, subscribe
-
-
-
-
Field Detail
-
m_properties
protected Task.Properties m_properties
The sharableTask.Propertiesfor this task.
-
f_memberListener
protected final ClusteredTaskCoordinator.ClusteredMemberListener f_memberListener
The member listener for cluster member.
-
f_cacheService
protected final com.tangosol.net.CacheService f_cacheService
TheCacheServiceused by the executor service.
-
-
Constructor Detail
-
ClusteredTaskCoordinator
public ClusteredTaskCoordinator(com.tangosol.net.CacheService service, ClusteredTaskManager manager, ExecutorService executorService)Constructs aClusteredTaskCoordinator. This constructor should only be used to obtain a coordinator for a previously submitted task.- Parameters:
service- theCacheServicecontaining the orchestration metadata cachesmanager- theClusteredTaskManagerexecutorService- theExecutorServicefrom theTaskExecutorServicefor asynchronous publishing
-
ClusteredTaskCoordinator
public ClusteredTaskCoordinator(com.tangosol.net.CacheService service, ClusteredTaskManager manager, ExecutorService executorService, Task.Properties properties, Iterator<Task.Subscriber<? super T>> subscribers)Constructs aClusteredTaskCoordinator.- Parameters:
service- theCacheServicecontaining the orchestration metadata cachesmanager- theClusteredTaskManagerexecutorService- theExecutorServicefrom theTaskExecutorServicefor asynchronous publishingproperties- theTask.Propertiesof the tasksubscribers- an optional set of subscribers to pre-register
-
-
Method Detail
-
cancel
public boolean cancel(boolean fMayInterruptIfRunning)
Description copied from interface:Task.CoordinatorAttempts to cancel execution of theTask. This attempt will fail if the task has already completed, has already been cancelled, or could not be cancelled for some other reason. If successful, and this task has not started when cancel is called, this task should never run. If the task has already started, then the mayInterruptIfRunning parameter determines whether the thread executing this task should be interrupted in an attempt to stop the task.After this method returns, subsequent calls to isDone() will always return true. Subsequent calls to isDone() will always return true if this method returned true.
- Specified by:
cancelin interfaceTask.Coordinator<T>- Overrides:
cancelin classAbstractTaskCoordinator<T>- Parameters:
fMayInterruptIfRunning-trueif the thread executing this task should be interrupted; otherwise, in-progress tasks are allowed to complete- Returns:
falseif the task could not be cancelled, typically because it has already completed normally;trueotherwise- See Also:
Future.cancel(boolean)
-
getProperties
public Task.Properties getProperties()
Description copied from interface:Task.CoordinatorObtain the properties of theTaskbeing coordinated.- Specified by:
getPropertiesin interfaceTask.Coordinator<T>- Returns:
- the task properties
-
subscribeRetainedTask
protected void subscribeRetainedTask(Task.Subscriber subscriber)
Description copied from class:AbstractTaskCoordinatorSubscribes to a retained task (a task that has completed execution, but it still held in memory).- Specified by:
subscribeRetainedTaskin classAbstractTaskCoordinator<T>- Parameters:
subscriber- the subscriber
-
close
public void close()
Closes thisClusteredTaskCoordinatorand notifies theTask.Subscribers that there will no longer be any further items by callingTask.Subscriber.onComplete().- Overrides:
closein classAbstractTaskCoordinator<T>
-
entryInserted
public void entryInserted(com.tangosol.util.MapEvent mapEvent)
- Specified by:
entryInsertedin interfacecom.tangosol.util.MapListener
-
entryUpdated
public void entryUpdated(com.tangosol.util.MapEvent mapEvent)
- Specified by:
entryUpdatedin interfacecom.tangosol.util.MapListener
-
entryDeleted
public void entryDeleted(com.tangosol.util.MapEvent mapEvent)
- Specified by:
entryDeletedin interfacecom.tangosol.util.MapListener
-
addMemberListener
public void addMemberListener(com.tangosol.net.MemberListener listener)
Adds the specifiedMemberListener.- Parameters:
listener- theMemberListenerto add
-
removeMemberListener
public void removeMemberListener(com.tangosol.net.MemberListener listener)
Removes the specifiedMemberListener.- Parameters:
listener- theMemberListenerto remove
-
getCacheService
protected com.tangosol.net.CacheService getCacheService()
-
removeMapListener
protected void removeMapListener()
Removes theMapListenerpreviously installed by thisClusteredTaskCoordinator.
-
-