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>,MapListener,EventListener
public class ClusteredTaskCoordinator<T> extends AbstractTaskCoordinator<T> implements 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 ClusteredTaskCoordinator.ClusteredMemberListenerf_memberListenerThe member listener for cluster member.protected Task.Propertiesm_propertiesThe sharableTask.Propertiesfor this task.protected NamedCachem_taskManagersTheClusteredTaskManagers cache.-
Fields inherited from class com.oracle.coherence.concurrent.executor.AbstractTaskCoordinator
f_cancelled, f_closed, f_executorService, f_fRetainTask, f_sTaskId, m_lastValue, m_setSubscribers
-
Fields inherited from interface com.tangosol.util.MapListener
ASYNCHRONOUS, SYNCHRONOUS, VERSION_AWARE
-
-
Constructor Summary
Constructors Constructor Description ClusteredTaskCoordinator(CacheService service, ClusteredTaskManager manager, ExecutorService executorService)Constructs aClusteredTaskCoordinator.ClusteredTaskCoordinator(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(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(MapEvent mapEvent)voidentryInserted(MapEvent mapEvent)voidentryUpdated(MapEvent mapEvent)Task.PropertiesgetProperties()Obtain the properties of theTaskbeing coordinated.protected voidremoveMapListener()Removes theMapListenerpreviously installed by thisClusteredTaskCoordinator.voidremoveMemberListener(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
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.tangosol.util.MapListener
characteristics, isAsynchronous, isSynchronous, isVersionAware, synchronous
-
-
-
-
Field Detail
-
m_taskManagers
protected NamedCache m_taskManagers
TheClusteredTaskManagers cache.
-
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.
-
-
Constructor Detail
-
ClusteredTaskCoordinator
public ClusteredTaskCoordinator(CacheService service, ClusteredTaskManager manager, ExecutorService executorService)
Constructs aClusteredTaskCoordinator.- Parameters:
service- theCacheServicecontaining the orchestration metadata cachesmanager- theClusteredTaskManagerexecutorService- theExecutorServicefrom theTaskExecutorServicefor asynchronously publishing
-
ClusteredTaskCoordinator
public ClusteredTaskCoordinator(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 asynchronously 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.
Based on https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/Future.html#cancel(boolean)- 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
-
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(MapEvent mapEvent)
- Specified by:
entryInsertedin interfaceMapListener
-
entryUpdated
public void entryUpdated(MapEvent mapEvent)
- Specified by:
entryUpdatedin interfaceMapListener
-
entryDeleted
public void entryDeleted(MapEvent mapEvent)
- Specified by:
entryDeletedin interfaceMapListener
-
addMemberListener
public void addMemberListener(MemberListener listener)
Adds the specifiedMemberListener.- Parameters:
listener- theMemberListenerto add
-
removeMemberListener
public void removeMemberListener(MemberListener listener)
Removes the specifiedMemberListener.- Parameters:
listener- theMemberListenerto remove
-
removeMapListener
protected void removeMapListener()
Removes theMapListenerpreviously installed by thisClusteredTaskCoordinator.
-
-