Class ClusteredExecutorService
- java.lang.Object
-
- com.oracle.coherence.concurrent.executor.ClusteredExecutorService
-
- All Implemented Interfaces:
RemoteExecutor,TaskExecutorService
- Direct Known Subclasses:
NamedClusteredExecutorService
public class ClusteredExecutorService extends Object implements TaskExecutorService
An Oracle Coherence basedTaskExecutorService.- Since:
- 21.12
- Author:
- bo, lh
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classClusteredExecutorService.CESRunnableFuture<V>CESRunnableFutureis a holder for the Callable or Runnable which will be executed byexecute(Remote.Runnable).protected static classClusteredExecutorService.StateEnumeration representing possible state transitions of theClusteredExecutorService.-
Nested classes/interfaces inherited from interface com.oracle.coherence.concurrent.executor.TaskExecutorService
TaskExecutorService.ExecutorInfo, TaskExecutorService.Registration
-
-
Field Summary
Fields Modifier and Type Field Description protected ConcurrentHashMap<ExecutorService,ClusteredRegistration>f_mapLocalRegistrationsprotected ScheduledExecutorServicef_scheduledExecutorServiceAScheduledExecutorServicefor performing local asynchronous operations.protected AtomicEnum<ClusteredExecutorService.State>f_stateThe current state of theTaskExecutorService.protected com.tangosol.net.CacheServicem_cacheServiceTheCacheServicecontaining the orchestration metadata caches.-
Fields inherited from interface com.oracle.coherence.concurrent.executor.RemoteExecutor
DEFAULT_EXECUTOR_NAME
-
-
Constructor Summary
Constructors Constructor Description ClusteredExecutorService(com.tangosol.net.CacheService cacheService)Constructs aClusteredExecutorServicebased on the specifiedCacheService.ClusteredExecutorService(com.tangosol.net.ConfigurableCacheFactory cacheFactory)Constructs aClusteredExecutorServicebased on the specifiedConfigurableCacheFactory.ClusteredExecutorService(com.tangosol.net.Session session)Constructs aClusteredExecutorServicebased on the specifiedSession.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <R> Task.Coordinator<R>acquire(String sTaskId)Attempts to acquire theTask.Coordinatorfor a previously submittedTask.booleanawaitTermination(long lcTimeout, TimeUnit unit)Blocks until all tasks have completed execution after a shutdown request, or the timeout occurs, or the current thread is interrupted, whichever happens first.protected static <T> voidcancelAll(List<Future<T>> futures)Cancels all providedfutures.protected static <T> voidcancelAll(List<Future<T>> futures, int nStartIdx)Cancels providedfuturesbeginning with the specified index.TaskExecutorService.Registrationderegister(ExecutorService executor)De-registers a previously registeredExecutorService.protected <T> TdoInvokeAny(Collection<? extends com.tangosol.util.function.Remote.Callable<T>> colTasks, boolean fTimed, long lcNanos)The main mechanics of invokeAny.voidexecute(com.tangosol.util.function.Remote.Runnable command)Executes the given command at some time in the future.com.tangosol.net.CacheServicegetCacheService()Obtains theCacheServicebeing used by theTaskExecutorService.ScheduledExecutorServicegetScheduledExecutorService()Obtains the internalScheduledExecutorServicethat can be used for scheduling asynchronous local activities for theTaskExecutorService.protected voidinit(com.tangosol.net.CacheService cacheService)Responsible for adding indexes for theClusteredAssignmentcache.<T> List<Future<T>>invokeAll(Collection<? extends com.tangosol.util.function.Remote.Callable<T>> tasks)Executes the given tasks, returning a list of Futures holding their status and results when all complete.<T> List<Future<T>>invokeAll(Collection<? extends com.tangosol.util.function.Remote.Callable<T>> tasks, long lcTimeout, TimeUnit unit)Executes the given tasks, returning a list of Futures holding their status and results when all complete or the timeout expires, whichever happens first.<T> TinvokeAny(Collection<? extends com.tangosol.util.function.Remote.Callable<T>> colTasks)Executes the given tasks, returning the result of one that has completed successfully (i.e., without throwing an exception), if any do.<T> TinvokeAny(Collection<? extends com.tangosol.util.function.Remote.Callable<T>> colTasks, long lcTimeout, TimeUnit unit)Override implementation is required asAbstractExecutorService's implementation creates its ownRunnableFutures that are passed toexecute(Remote.Runnable).booleanisShutdown()Returnstrueif this executor has been shut down.booleanisTerminated()Returnstrueif all tasks have completed following shut down.<T> Task.Orchestration<T>orchestrate(Task<T> task)Creates a pendingTask.Orchestrationfor aTask.TaskExecutorService.Registrationregister(ExecutorService executor, TaskExecutorService.Registration.Option... options)Registers anExecutorServiceto commence execution of orchestrated tasks.<T> ScheduledFuture<T>schedule(com.tangosol.util.function.Remote.Callable<T> callable, long lcDelay, TimeUnit unit)Submits a value-returning one-shot task that becomes enabled after the given delay.ScheduledFuture<?>schedule(com.tangosol.util.function.Remote.Runnable command, long lcDelay, TimeUnit unit)Submits a one-shot task that becomes enabled after the given delay.ScheduledFuture<?>scheduleAtFixedRate(com.tangosol.util.function.Remote.Runnable command, long lcInitialDelay, long lcPeriod, TimeUnit unit)Submits a periodic action that becomes enabled first after the given initial delay, and subsequently with the given period; that is, executions will commence afterinitialDelay, theninitialDelay + period, theninitialDelay + 2 * period, and so on.protected ScheduledFuture<?>scheduleRunnable(Runnable command, long cInitialDelay, long cPeriod, long cDelay, TimeUnit unit)Schedules the specifiedRunnable.ScheduledFuture<?>scheduleWithFixedDelay(com.tangosol.util.function.Remote.Runnable command, long cInitialDelay, long cDelay, TimeUnit unit)Submits a periodic action that becomes enabled first after the given initial delay, and subsequently with the given delay between the termination of one execution and the commencement of the next.protected booleansetState(ClusteredExecutorService.State from, ClusteredExecutorService.State to)State transition helper.voidshutdown()Initiates an orderly shutdown in which previously submitted tasks are executed, but no new tasks will be accepted.protected booleanshutdownInternal()Initiate graceful shutdown.List<Runnable>shutdownNow()Attempts to stop all actively executing tasks, halts the processing of waiting tasks, and returns a list of the tasks that were awaiting execution.protected booleanshutdownNowInternal()Initiate immediate shutdown.protected <T,A,R>
Task.Coordinator<R>submit(Task<T> task, String sTaskId, ExecutionStrategy strategy, OptionsByType<Task.Option> optionsByType, Task.Properties properties, Task.Collector<? super T,A,R> collector, com.tangosol.util.function.Remote.Predicate<? super R> completionPredicate, Task.CompletionRunnable<? super R> completionRunnable, Duration retainDuration, Iterator<Task.Subscriber<? super R>> subscribers)Submit aTaskfor execution with the given taskId,ExecutionStrategy,OptionsByType, result collector, completionRemote.Predicate, andTask.Subscriber(s).<T> Future<T>submit(com.tangosol.util.function.Remote.Callable<T> task)Submits a value-returning task for execution and returns a Future representing the pending results of the task.Future<?>submit(com.tangosol.util.function.Remote.Runnable task)Submits a Runnable task for execution and returns a Future representing that task.<T> Future<T>submit(com.tangosol.util.function.Remote.Runnable task, T result)Submits a Runnable task for execution and returns a Future representing that task.-
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.TaskExecutorService
submit
-
-
-
-
Field Detail
-
m_cacheService
protected com.tangosol.net.CacheService m_cacheService
TheCacheServicecontaining the orchestration metadata caches.
-
f_mapLocalRegistrations
protected final ConcurrentHashMap<ExecutorService,ClusteredRegistration> f_mapLocalRegistrations
-
f_state
protected final AtomicEnum<ClusteredExecutorService.State> f_state
The current state of theTaskExecutorService.
-
f_scheduledExecutorService
protected final ScheduledExecutorService f_scheduledExecutorService
AScheduledExecutorServicefor performing local asynchronous operations.
-
-
Constructor Detail
-
ClusteredExecutorService
public ClusteredExecutorService(com.tangosol.net.CacheService cacheService)
Constructs aClusteredExecutorServicebased on the specifiedCacheService.- Parameters:
cacheService- theCacheServiceto use for orchestration metadata
-
ClusteredExecutorService
public ClusteredExecutorService(com.tangosol.net.ConfigurableCacheFactory cacheFactory)
Constructs aClusteredExecutorServicebased on the specifiedConfigurableCacheFactory.- Parameters:
cacheFactory- theConfigurableCacheFactory
-
ClusteredExecutorService
public ClusteredExecutorService(com.tangosol.net.Session session)
Constructs aClusteredExecutorServicebased on the specifiedSession.- Parameters:
session- theSession
-
-
Method Detail
-
getScheduledExecutorService
public ScheduledExecutorService getScheduledExecutorService()
Obtains the internalScheduledExecutorServicethat can be used for scheduling asynchronous local activities for theTaskExecutorService.- Returns:
- a
ScheduledExecutorService
-
getCacheService
public com.tangosol.net.CacheService getCacheService()
Obtains theCacheServicebeing used by theTaskExecutorService.- Returns:
- the
CacheService
-
register
public TaskExecutorService.Registration register(ExecutorService executor, TaskExecutorService.Registration.Option... options)
Description copied from interface:TaskExecutorServiceRegisters anExecutorServiceto commence execution of orchestrated tasks.- Specified by:
registerin interfaceTaskExecutorService- Parameters:
executor- theExecutorServiceto registeroptions- theTaskExecutorService.Registration.Options for theExecutorService- Returns:
- the
TaskExecutorService.Registrationcreated for the registeredExecutorService, or the existingTaskExecutorService.Registrationwhen theExecutorServiceis already registered
-
deregister
public TaskExecutorService.Registration deregister(ExecutorService executor)
Description copied from interface:TaskExecutorServiceDe-registers a previously registeredExecutorService.Upon execution, all allocated executables are deemed to be suspended. Any results made towards completing said executables will be ignored. Executables specifically allocated to the identified
ExecutorServicewill be lost, unless they were submitted as being retained. All other executables will be re-allocated and submitted to other available and appropriate subscribedExecutorServices.- Specified by:
deregisterin interfaceTaskExecutorService- Parameters:
executor- theExecutorServiceto deregister- Returns:
- the
TaskExecutorService.Registrationthat was originally created for the registeredExecutorService, ornullif theExecutorServiceis unknown/not registered
-
orchestrate
public <T> Task.Orchestration<T> orchestrate(Task<T> task)
Description copied from interface:TaskExecutorServiceCreates a pendingTask.Orchestrationfor aTask.- Specified by:
orchestratein interfaceTaskExecutorService- Type Parameters:
T- the type result produced by theTask- Parameters:
task- theTask- Returns:
- an
Task.Orchestration
-
acquire
public <R> Task.Coordinator<R> acquire(String sTaskId)
Description copied from interface:TaskExecutorServiceAttempts to acquire theTask.Coordinatorfor a previously submittedTask.- Specified by:
acquirein interfaceTaskExecutorService- Type Parameters:
R- the collected result type published by theTask.Coordinator- Parameters:
sTaskId- the unique identity originally allocated to theTask(available by callingTask.Coordinator.getTaskId())- Returns:
- the
Task.Coordinatorfor the specifiedTaskornullif theTaskis unknown
-
isShutdown
public boolean isShutdown()
Description copied from interface:RemoteExecutorReturnstrueif this executor has been shut down.- Specified by:
isShutdownin interfaceRemoteExecutor- Returns:
trueif this executor has been shut down
-
isTerminated
public boolean isTerminated()
Description copied from interface:RemoteExecutorReturnstrueif all tasks have completed following shut down. Note thatisTerminatedis nevertrueunless eithershutdownorshutdownNowwas called first.- Specified by:
isTerminatedin interfaceRemoteExecutor- Returns:
trueif all tasks have completed following shut down
-
awaitTermination
public boolean awaitTermination(long lcTimeout, TimeUnit unit) throws InterruptedExceptionDescription copied from interface:RemoteExecutorBlocks until all tasks have completed execution after a shutdown request, or the timeout occurs, or the current thread is interrupted, whichever happens first.- Specified by:
awaitTerminationin interfaceRemoteExecutor- Parameters:
lcTimeout- the maximum time to waitunit- the time unit of the timeout argument- Returns:
trueif this executor terminated andfalseif the timeout elapsed before termination- Throws:
InterruptedException- if interrupted while waiting
-
shutdown
public void shutdown()
Description copied from interface:RemoteExecutorInitiates an orderly shutdown in which previously submitted tasks are executed, but no new tasks will be accepted. Invocation has no additional effect if already shut down.This method does not wait for previously submitted tasks to complete execution. Use
awaitTerminationto do that.- Specified by:
shutdownin interfaceRemoteExecutor
-
shutdownNow
public List<Runnable> shutdownNow()
Description copied from interface:RemoteExecutorAttempts to stop all actively executing tasks, halts the processing of waiting tasks, and returns a list of the tasks that were awaiting execution.This method does not wait for actively executing tasks to terminate. Use
awaitTerminationto do that.There are no guarantees beyond best-effort attempts to stop processing actively executing tasks. For example, typical implementations will cancel via
Thread.interrupt(), so any task that fails to respond to interrupts may never terminate.- Specified by:
shutdownNowin interfaceRemoteExecutor- Returns:
- list of tasks that never commenced execution
-
execute
public void execute(com.tangosol.util.function.Remote.Runnable command)
Description copied from interface:RemoteExecutorExecutes the given command at some time in the future. The command may execute in a new thread, in a pooled thread, or in the calling thread, at the discretion of theExecutorimplementation.- Specified by:
executein interfaceRemoteExecutor- Parameters:
command- the runnable task
-
schedule
public <T> ScheduledFuture<T> schedule(com.tangosol.util.function.Remote.Callable<T> callable, long lcDelay, TimeUnit unit)
Description copied from interface:RemoteExecutorSubmits a value-returning one-shot task that becomes enabled after the given delay.- Specified by:
schedulein interfaceRemoteExecutor- Type Parameters:
T- the type of the callable's result- Parameters:
callable- the function to executelcDelay- the time from now to delay executionunit- the time unit of the delay parameter- Returns:
- a ScheduledFuture that can be used to extract result or cancel
-
schedule
public ScheduledFuture<?> schedule(com.tangosol.util.function.Remote.Runnable command, long lcDelay, TimeUnit unit)
Description copied from interface:RemoteExecutorSubmits a one-shot task that becomes enabled after the given delay.- Specified by:
schedulein interfaceRemoteExecutor- Parameters:
command- the task to executelcDelay- the time from now to delay executionunit- the time unit of the delay parameter- Returns:
- a
ScheduledFuturerepresenting the pending completion of the task and whoseget()method will returnnullupon completion
-
scheduleAtFixedRate
public ScheduledFuture<?> scheduleAtFixedRate(com.tangosol.util.function.Remote.Runnable command, long lcInitialDelay, long lcPeriod, TimeUnit unit)
Description copied from interface:RemoteExecutorSubmits a periodic action that becomes enabled first after the given initial delay, and subsequently with the given period; that is, executions will commence afterinitialDelay, theninitialDelay + period, theninitialDelay + 2 * period, and so on.The sequence of task executions continues indefinitely until one of the following exceptional completions occur:
- The task is explicitly cancelled via the returned future.
- The executor terminates, also resulting in task cancellation.
- An execution of the task throws an exception. In this case
calling
geton the returned future will throwExecutionException, holding the exception as its cause.
isDone()on the returned future will returntrue.If any execution of this task takes longer than its period, then subsequent executions may start late, but will not concurrently execute.
- Specified by:
scheduleAtFixedRatein interfaceRemoteExecutor- Parameters:
command- the task to executelcInitialDelay- the time to delay first executionlcPeriod- the period between successive executionsunit- the time unit of the initialDelay and period parameters- Returns:
- a
ScheduledFuturerepresenting pending completion of the series of repeated tasks. The future'sget()method will never return normally, and will throw an exception upon task cancellation or abnormal termination of a task execution.
-
scheduleWithFixedDelay
public ScheduledFuture<?> scheduleWithFixedDelay(com.tangosol.util.function.Remote.Runnable command, long cInitialDelay, long cDelay, TimeUnit unit)
Description copied from interface:RemoteExecutorSubmits a periodic action that becomes enabled first after the given initial delay, and subsequently with the given delay between the termination of one execution and the commencement of the next.The sequence of task executions continues indefinitely until one of the following exceptional completions occur:
- The task is explicitly cancelled via the returned future.
- The executor terminates, also resulting in task cancellation.
- An execution of the task throws an exception. In this case
calling
geton the returned future will throwExecutionException, holding the exception as its cause.
isDone()on the returned future will returntrue.- Specified by:
scheduleWithFixedDelayin interfaceRemoteExecutor- Parameters:
command- the task to executecInitialDelay- the time to delay first executioncDelay- the delay between the termination of one execution and the commencement of the nextunit- the time unit of the initialDelay and delay parameters- Returns:
- a
ScheduledFuturerepresenting pending completion of the series of repeated tasks. The future'sget()method will never return normally, and will throw an exception upon task cancellation or abnormal termination of a task execution.
-
invokeAny
public <T> T invokeAny(Collection<? extends com.tangosol.util.function.Remote.Callable<T>> colTasks) throws InterruptedException, ExecutionException
Description copied from interface:RemoteExecutorExecutes the given tasks, returning the result of one that has completed successfully (i.e., without throwing an exception), if any do. Upon normal or exceptional return, tasks that have not completed are cancelled. The results of this method are undefined if the given collection is modified while this operation is in progress.- Specified by:
invokeAnyin interfaceRemoteExecutor- Type Parameters:
T- the type of the values returned from the tasks- Parameters:
colTasks- the collection of tasks- Returns:
- the result returned by one of the tasks
- Throws:
InterruptedException- if interrupted while waitingExecutionException- if no task successfully completes
-
invokeAny
public <T> T invokeAny(Collection<? extends com.tangosol.util.function.Remote.Callable<T>> colTasks, long lcTimeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
Override implementation is required asAbstractExecutorService's implementation creates its ownRunnableFutures that are passed toexecute(Remote.Runnable).- Specified by:
invokeAnyin interfaceRemoteExecutor- Type Parameters:
T- the type of the values returned from the tasks- Parameters:
colTasks- the collection of taskslcTimeout- the maximum time to waitunit- the time unit of the timeout argument- Returns:
- the result returned by one of the tasks
- Throws:
InterruptedException- if interrupted while waitingExecutionException- if no task successfully completesTimeoutException- if the given timeout elapses before any task successfully completes
-
invokeAll
public <T> List<Future<T>> invokeAll(Collection<? extends com.tangosol.util.function.Remote.Callable<T>> tasks) throws InterruptedException
Description copied from interface:RemoteExecutorExecutes the given tasks, returning a list of Futures holding their status and results when all complete.Future.isDone()istruefor each element of the returned list. Note that a completed task could have terminated either normally or by throwing an exception. The results of this method are undefined if the given collection is modified while this operation is in progress.- Specified by:
invokeAllin interfaceRemoteExecutor- Type Parameters:
T- the type of the values returned from the tasks- Parameters:
tasks- the collection of tasks- Returns:
- a list of Futures representing the tasks, in the same sequential order as produced by the iterator for the given task list, each of which has completed
- Throws:
InterruptedException- if interrupted while waiting, in which case unfinished tasks are cancelled
-
invokeAll
public <T> List<Future<T>> invokeAll(Collection<? extends com.tangosol.util.function.Remote.Callable<T>> tasks, long lcTimeout, TimeUnit unit) throws InterruptedException
Description copied from interface:RemoteExecutorExecutes the given tasks, returning a list of Futures holding their status and results when all complete or the timeout expires, whichever happens first.Future.isDone()istruefor each element of the returned list. Upon return, tasks that have not completed are cancelled. Note that a completed task could have terminated either normally or by throwing an exception. The results of this method are undefined if the given collection is modified while this operation is in progress.- Specified by:
invokeAllin interfaceRemoteExecutor- Type Parameters:
T- the type of the values returned from the tasks- Parameters:
tasks- the collection of taskslcTimeout- the maximum time to waitunit- the time unit of the timeout argument- Returns:
- a list of Futures representing the tasks, in the same sequential order as produced by the iterator for the given task list. If the operation did not time out, each task will have completed. If it did time out, some of these tasks will not have completed.
- Throws:
InterruptedException- if interrupted while waiting, in which case unfinished tasks are cancelled
-
submit
public <T> Future<T> submit(com.tangosol.util.function.Remote.Callable<T> task)
Description copied from interface:RemoteExecutorSubmits a value-returning task for execution and returns a Future representing the pending results of the task. The Future'sgetmethod will return the task's result upon successful completion.If you would like to immediately block waiting for a task, you can use constructions of the form
result = exec.submit(aCallable).get();Note: The
Executorsclass includes a set of methods that can convert some other common closure-like objects, for example,PrivilegedActiontoCallableform so they can be submitted.- Specified by:
submitin interfaceRemoteExecutor- Type Parameters:
T- the type of the task's result- Parameters:
task- the task to submit- Returns:
- a
Futurerepresenting pending completion of the task
-
submit
public <T> Future<T> submit(com.tangosol.util.function.Remote.Runnable task, T result)
Description copied from interface:RemoteExecutorSubmits a Runnable task for execution and returns a Future representing that task. The Future'sgetmethod will return the given result upon successful completion.- Specified by:
submitin interfaceRemoteExecutor- Type Parameters:
T- the type of the result- Parameters:
task- the task to submitresult- the result to return- Returns:
- a
Futurerepresenting pending completion of the task
-
submit
public Future<?> submit(com.tangosol.util.function.Remote.Runnable task)
Description copied from interface:RemoteExecutorSubmits a Runnable task for execution and returns a Future representing that task. The Future'sgetmethod will returnnullupon successful completion.- Specified by:
submitin interfaceRemoteExecutor- Parameters:
task- the task to submit- Returns:
- a
Futurerepresenting pending completion of the task
-
doInvokeAny
protected <T> T doInvokeAny(Collection<? extends com.tangosol.util.function.Remote.Callable<T>> colTasks, boolean fTimed, long lcNanos) throws InterruptedException, ExecutionException, TimeoutException
The main mechanics of invokeAny. See AbstractExecutorService#doInvokeAny(Collection, boolean, long) on which this implementation is based.- Type Parameters:
T- return value type- Parameters:
colTasks-CollectionofRemote.CallablesfTimed- whether the invokeAny is timedlcNanos- nanos to wait if timed- Returns:
- see
invokeAny(Collection) - Throws:
InterruptedException- seeinvokeAny(Collection)ExecutionException- seeinvokeAny(Collection)TimeoutException- seeinvokeAny(Collection)
-
cancelAll
protected static <T> void cancelAll(List<Future<T>> futures)
Cancels all providedfutures.- Type Parameters:
T- the future result type- Parameters:
futures- list offutures
-
cancelAll
protected static <T> void cancelAll(List<Future<T>> futures, int nStartIdx)
Cancels providedfuturesbeginning with the specified index.- Type Parameters:
T- the future result type- Parameters:
futures- list offuturesnStartIdx- the start index within the list
-
submit
protected <T,A,R> Task.Coordinator<R> submit(Task<T> task, String sTaskId, ExecutionStrategy strategy, OptionsByType<Task.Option> optionsByType, Task.Properties properties, Task.Collector<? super T,A,R> collector, com.tangosol.util.function.Remote.Predicate<? super R> completionPredicate, Task.CompletionRunnable<? super R> completionRunnable, Duration retainDuration, Iterator<Task.Subscriber<? super R>> subscribers)
Submit aTaskfor execution with the given taskId,ExecutionStrategy,OptionsByType, result collector, completionRemote.Predicate, andTask.Subscriber(s).- Type Parameters:
T- the type of the taskA- the accumulation type of the collectableR- the type of the collected result- Parameters:
task- theTaskto submitsTaskId- the task IDstrategy- theExecutionStrategyfor this taskoptionsByType- theOptionsByTypeto be usedproperties- theTask.Propertiesfor this taskcollector- theTask.Collectorto be used to collect the resultcompletionPredicate- the completionRemote.PredicatecompletionRunnable- theTask.CompletionRunnableto call when the task is completeretainDuration- theDurationto retain aTaskafter it is completesubscribers- a list of subscribers- Returns:
- a
Task.Coordinator
-
init
protected void init(com.tangosol.net.CacheService cacheService)
Responsible for adding indexes for theClusteredAssignmentcache.- Parameters:
cacheService- the cache service providing the caches used by the executor service
-
scheduleRunnable
protected ScheduledFuture<?> scheduleRunnable(Runnable command, long cInitialDelay, long cPeriod, long cDelay, TimeUnit unit)
Schedules the specifiedRunnable.- Parameters:
command- theRunnableto schedulecInitialDelay- the initial delay before scheduling occurscPeriod- the period between executioncDelay- the delay to start the next execution after the completion of the current executionunit- theTimeUnitto apply- Returns:
- a
ScheduledFuturerepresenting the result from processing the command
-
setState
protected boolean setState(ClusteredExecutorService.State from, ClusteredExecutorService.State to)
State transition helper.- Parameters:
from- theClusteredExecutorService.Statetransitioning fromto- theClusteredExecutorService.Statetransitioning to- Returns:
trueif the state transition was successful
-
shutdownInternal
protected boolean shutdownInternal()
Initiate graceful shutdown.- Returns:
- true if shutdown has been initiated; false if the
ClusteredExecutorServiceis already shutting down or terminated.
-
shutdownNowInternal
protected boolean shutdownNowInternal()
Initiate immediate shutdown.- Returns:
- true if shutdown has been initiated; false if the
ClusteredExecutorServiceis already shutting down or terminated.
-
-