public interface DurableExecutorService extends ExecutorService, DistributedObject
ExecutorService
.
DurableExecutor provides additional methods like executing tasks on a member who is owner of a specific key
DurableExecutor also provides a way to retrieve the result of an execution with the given taskId.Modifier and Type | Method and Description |
---|---|
void |
disposeResult(long taskId)
Disposes the result with the given taskId
|
void |
executeOnKeyOwner(Runnable command,
Object key)
Executes a task on the owner of the specified key.
|
<T> Future<T> |
retrieveAndDisposeResult(long taskId)
Retrieves and disposes the result with the given taskId
|
<T> Future<T> |
retrieveResult(long taskId)
Retrieves the result with the given taskId
|
<T> DurableExecutorServiceFuture<T> |
submit(Callable<T> task)
Submits a value-returning task for execution and returns a
Future representing the pending results of the task.
|
DurableExecutorServiceFuture<?> |
submit(Runnable task)
Submits a Runnable task for execution and returns a Future
representing that task.
|
<T> DurableExecutorServiceFuture<T> |
submit(Runnable task,
T result)
Submits a Runnable task for execution and returns a Future
representing that task.
|
<T> DurableExecutorServiceFuture<T> |
submitToKeyOwner(Callable<T> task,
Object key)
Submits a task to the owner of the specified key and returns a Future
representing that task.
|
DurableExecutorServiceFuture<?> |
submitToKeyOwner(Runnable task,
Object key)
Submits a task to the owner of the specified key and returns a Future
representing that task.
|
awaitTermination, invokeAll, invokeAll, invokeAny, invokeAny, isShutdown, isTerminated, shutdown, shutdownNow
destroy, getDestroyContextForTenant, getName, getPartitionKey, getServiceName
@Nonnull <T> DurableExecutorServiceFuture<T> submit(@Nonnull Callable<T> task)
get
method 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 Executors
class includes a set of methods
that can convert some other common closure-like objects,
for example, PrivilegedAction
to
Callable
form so they can be submitted.
submit
in interface ExecutorService
T
- the type of the task's resulttask
- the task to submitRejectedExecutionException
- if the task cannot be
scheduled for executionNullPointerException
- if the task is null@Nonnull <T> DurableExecutorServiceFuture<T> submit(@Nonnull Runnable task, T result)
get
method will
return the given result upon successful completion.submit
in interface ExecutorService
T
- the type of the resulttask
- the task to submitresult
- the result to returnRejectedExecutionException
- if the task cannot be
scheduled for executionNullPointerException
- if the task is null@Nonnull DurableExecutorServiceFuture<?> submit(@Nonnull Runnable task)
get
method will
return null
upon successful completion.submit
in interface ExecutorService
task
- the task to submitRejectedExecutionException
- if the task cannot be
scheduled for executionNullPointerException
- if the task is null<T> Future<T> retrieveResult(long taskId)
T
- the type of the task's resulttaskId
- combination of partitionId and sequencevoid disposeResult(long taskId)
taskId
- combination of partitionId and sequence<T> Future<T> retrieveAndDisposeResult(long taskId)
T
- the type of the task's resulttaskId
- combination of partitionId and sequencevoid executeOnKeyOwner(@Nonnull Runnable command, @Nonnull Object key)
command
- a task executed on the owner of the specified keykey
- the specified key<T> DurableExecutorServiceFuture<T> submitToKeyOwner(@Nonnull Callable<T> task, @Nonnull Object key)
T
- the return type of the tasktask
- task submitted to the owner of the specified keykey
- the specified keyDurableExecutorServiceFuture<?> submitToKeyOwner(@Nonnull Runnable task, @Nonnull Object key)
task
- task submitted to the owner of the specified keykey
- the specified keyCopyright © 2024 Hazelcast, Inc.. All rights reserved.