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
An implementation of a
Task.Coordinator for Coherence-based implementation.- Since:
- 21.12
- Version:
- bo
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassAMemberListenerto monitor the member thisClusteredTaskCoordinatoris part of / connected to in case of an *Extend client. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final CacheServiceTheCacheServiceused by the executor service.protected final ClusteredTaskCoordinator<T>.ClusteredMemberListenerThe member listener for cluster member.protected Task.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_setSubscribersFields inherited from interface com.tangosol.util.MapListener
ASYNCHRONOUS, SYNCHRONOUS, VERSION_AWARE -
Constructor Summary
ConstructorsConstructorDescriptionClusteredTaskCoordinator(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
Modifier and TypeMethodDescriptionvoidaddMemberListener(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) Invoked when a map entry has been removed.voidentryInserted(MapEvent mapEvent) Invoked when a map entry has been inserted.voidentryUpdated(MapEvent mapEvent) Invoked when a map entry has been updated.protected CacheServiceReturn the underlyingCacheServicefor the executor service.Obtain the properties of theTaskbeing coordinated.protected voidRemoves 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, subscribeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.tangosol.util.MapListener
characteristics, isAsynchronous, isSynchronous, isVersionAware, synchronous
-
Field Details
-
m_properties
The sharableTask.Propertiesfor this task. -
f_memberListener
The member listener for cluster member. -
f_cacheService
TheCacheServiceused by the executor service.
-
-
Constructor Details
-
ClusteredTaskCoordinator
public ClusteredTaskCoordinator(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(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 Details
-
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:
-
getProperties
Description copied from interface:Task.CoordinatorObtain the properties of theTaskbeing coordinated.- Specified by:
getPropertiesin interfaceTask.Coordinator<T>- Returns:
- the task properties
-
subscribeRetainedTask
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
Description copied from interface:MapListenerInvoked when a map entry has been inserted.- Specified by:
entryInsertedin interfaceMapListener- Parameters:
mapEvent- the MapEvent carrying the insert information
-
entryUpdated
Description copied from interface:MapListenerInvoked when a map entry has been updated.- Specified by:
entryUpdatedin interfaceMapListener- Parameters:
mapEvent- the MapEvent carrying the update information
-
entryDeleted
Description copied from interface:MapListenerInvoked when a map entry has been removed.- Specified by:
entryDeletedin interfaceMapListener- Parameters:
mapEvent- the MapEvent carrying the delete information
-
addMemberListener
Adds the specifiedMemberListener.- Parameters:
listener- theMemberListenerto add
-
removeMemberListener
Removes the specifiedMemberListener.- Parameters:
listener- theMemberListenerto remove
-
getCacheService
Return the underlyingCacheServicefor the executor service.- Returns:
- the underlying
CacheService
-
removeMapListener
protected void removeMapListener()Removes theMapListenerpreviously installed by thisClusteredTaskCoordinator.
-