Package org.redisson.api
Interface RExecutorService
-
- All Superinterfaces:
Executor,ExecutorService,RExecutorServiceAsync
- All Known Subinterfaces:
RScheduledExecutorService
- All Known Implementing Classes:
RedissonExecutorService
public interface RExecutorService extends ExecutorService, RExecutorServiceAsync
Distributed implementation ofExecutorService- Author:
- Nikita Koksharov
-
-
Field Summary
Fields Modifier and Type Field Description static StringMAPREDUCE_NAMEMapReduce's executor name
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description booleancancelTask(String taskId)Cancel task by idintcountActiveWorkers()Returns active workers amount available for tasks execution.booleandelete()Deletes executor request queue and state objectsvoidexecute(Runnable... tasks)Submits tasks batch for execution synchronously.StringgetName()Returns executor nameintgetTaskCount()Returns amount of tasks awaiting for execution and/or currently in execution.Set<String>getTaskIds()Returns list of task ids awaiting for execution and/or currently in execution.booleanhasTask(String taskId)Returnstrueif this Executor Service has task bytaskIdawaiting for execution and/or currently in executionvoidregisterWorkers(int workers)Deprecated.voidregisterWorkers(int workers, ExecutorService executor)Deprecated.voidregisterWorkers(WorkerOptions options)Register workersRExecutorFuture<?>submit(Runnable task)Synchronously submits a Runnable task for execution asynchronously.RExecutorBatchFuturesubmit(Runnable... tasks)Synchronously submits tasks batch for execution asynchronously.RExecutorFuture<?>submit(Runnable task, long timeToLive, TimeUnit timeUnit)Synchronously submits a task with definedtimeToLiveparameter for execution asynchronously.<T> RExecutorFuture<T>submit(Runnable task, T result)Synchronously submits a Runnable task for execution asynchronously and returns a RExecutorFuture representing that task.RExecutorBatchFuturesubmit(Callable<?>... tasks)Synchronously submits tasks batch for execution asynchronously.<T> RExecutorFuture<T>submit(Callable<T> task)Synchronously submits a value-returning task for execution asynchronously and returns a Future representing the pending results of the task.<T> RExecutorFuture<T>submit(Callable<T> task, long timeToLive, TimeUnit timeUnit)Synchronously submits a value-returning task with definedtimeToLiveparameter for execution asynchronously.-
Methods inherited from interface java.util.concurrent.ExecutorService
awaitTermination, invokeAll, invokeAll, invokeAny, invokeAny, isShutdown, isTerminated, shutdown, shutdownNow
-
Methods inherited from interface org.redisson.api.RExecutorServiceAsync
cancelTaskAsync, deleteAsync, getTaskCountAsync, getTaskIdsAsync, hasTaskAsync, submitAsync, submitAsync, submitAsync, submitAsync, submitAsync, submitAsync
-
-
-
-
Field Detail
-
MAPREDUCE_NAME
static final String MAPREDUCE_NAME
MapReduce's executor name- See Also:
- Constant Field Values
-
-
Method Detail
-
submit
<T> RExecutorFuture<T> submit(Callable<T> task)
Synchronously submits a value-returning task for execution asynchronously and returns a Future representing the pending results of the task. The Future'sgetmethod will return the task's result upon successful completion.- Specified by:
submitin interfaceExecutorService- Type Parameters:
T- the type of the task's result- Parameters:
task- the task to submit- Returns:
- a Future representing pending completion of the task
-
submit
<T> RExecutorFuture<T> submit(Callable<T> task, long timeToLive, TimeUnit timeUnit)
Synchronously submits a value-returning task with definedtimeToLiveparameter for execution asynchronously. Returns a Future representing the pending results of the task. The Future'sgetmethod will return the task's result upon successful completion.- Type Parameters:
T- the type of the task's result- Parameters:
task- the task to submittimeToLive- - time to live intervaltimeUnit- - unit of time to live interval- Returns:
- a Future representing pending completion of the task
-
submit
RExecutorBatchFuture submit(Callable<?>... tasks)
Synchronously submits tasks batch for execution asynchronously. All tasks are stored to executor request queue atomically, if case of any error none of tasks will be added.- Parameters:
tasks- - tasks to execute- Returns:
- Future object
-
submit
<T> RExecutorFuture<T> submit(Runnable task, T result)
Synchronously submits a Runnable task for execution asynchronously and returns a RExecutorFuture representing that task. The Future'sgetmethod will return the given result upon successful completion.- Specified by:
submitin interfaceExecutorService- Type Parameters:
T- the type of the result- Parameters:
task- the task to submitresult- the result to return- Returns:
- a Future representing pending completion of the task
-
submit
RExecutorFuture<?> submit(Runnable task)
Synchronously submits a Runnable task for execution asynchronously. Returns a RExecutorFuture representing task completion. The Future'sgetmethod will returnnullupon successful completion.- Specified by:
submitin interfaceExecutorService- Parameters:
task- the task to submit- Returns:
- a Future representing pending completion of the task
-
submit
RExecutorFuture<?> submit(Runnable task, long timeToLive, TimeUnit timeUnit)
Synchronously submits a task with definedtimeToLiveparameter for execution asynchronously. Returns a Future representing task completion. The Future'sgetmethod will return the task's result upon successful completion.- Parameters:
task- the task to submittimeToLive- - time to live intervaltimeUnit- - unit of time to live interval- Returns:
- a Future representing pending completion of the task
-
submit
RExecutorBatchFuture submit(Runnable... tasks)
Synchronously submits tasks batch for execution asynchronously. All tasks are stored to executor request queue atomically, if case of any error none of tasks will be added.- Parameters:
tasks- - tasks to execute- Returns:
- Future object
-
getName
String getName()
Returns executor name- Returns:
- name of service
-
delete
boolean delete()
Deletes executor request queue and state objects- Returns:
trueif any of objects were deleted
-
registerWorkers
@Deprecated void registerWorkers(int workers)
Deprecated.
-
registerWorkers
@Deprecated void registerWorkers(int workers, ExecutorService executor)
Deprecated.
-
registerWorkers
void registerWorkers(WorkerOptions options)
Register workers- Parameters:
options- - worker options
-
getTaskCount
int getTaskCount()
Returns amount of tasks awaiting for execution and/or currently in execution.- Returns:
- amount of tasks
-
countActiveWorkers
int countActiveWorkers()
Returns active workers amount available for tasks execution.- Returns:
- workers amount
-
hasTask
boolean hasTask(String taskId)
Returnstrueif this Executor Service has task bytaskIdawaiting for execution and/or currently in execution- Parameters:
taskId- - id of task- Returns:
trueif this Executor Service has task
-
getTaskIds
Set<String> getTaskIds()
Returns list of task ids awaiting for execution and/or currently in execution.- Returns:
- task ids
-
cancelTask
boolean cancelTask(String taskId)
Cancel task by id- Parameters:
taskId- - id of task- Returns:
trueif task has been canceled successfully- See Also:
RExecutorFuture.getTaskId()
-
execute
void execute(Runnable... tasks)
Submits tasks batch for execution synchronously. All tasks are stored to executor request queue atomically, if case of any error none of tasks will be added.- Parameters:
tasks- - tasks to execute
-
-