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 String
MAPREDUCE_NAME
MapReduce's executor name
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
cancelTask(String taskId)
Cancels task by idint
countActiveWorkers()
Returns active worker groupsboolean
delete()
Deletes executor request queue and state objectsvoid
execute(Runnable... tasks)
Submits tasks batch for execution synchronously.String
getName()
Returns executor namevoid
registerWorkers(int workers)
Register workersvoid
registerWorkers(int workers, ExecutorService executor)
Register workers with custom executorRExecutorFuture<?>
submit(Runnable task)
Submits a Runnable task for execution and returns a Future representing that task.RExecutorBatchFuture
submit(Runnable... tasks)
Submits tasks batch for execution synchronously.<T> RExecutorFuture<T>
submit(Runnable task, T result)
Submits a Runnable task for execution and returns a Future representing that task.RExecutorBatchFuture
submit(Callable<?>... tasks)
Submits tasks batch for execution synchronously.<T> RExecutorFuture<T>
submit(Callable<T> task)
Submits a value-returning task for execution synchronously and returns a Future representing the pending results of the task.-
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
deleteAsync, 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)
Submits a value-returning task for execution synchronously and returns a Future representing the pending results of the task. The Future'sget
method will return the task's result upon successful completion.- Specified by:
submit
in 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
RExecutorBatchFuture submit(Callable<?>... 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- Returns:
- Future object
-
submit
<T> RExecutorFuture<T> submit(Runnable task, T result)
Submits a Runnable task for execution and returns a Future representing that task. The Future'sget
method will return the given result upon successful completion.- Specified by:
submit
in 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)
Submits a Runnable task for execution and returns a Future representing that task. The Future'sget
method will returnnull
upon successful completion.- Specified by:
submit
in interfaceExecutorService
- Parameters:
task
- the task to submit- Returns:
- a Future representing pending completion of the task
-
submit
RExecutorBatchFuture submit(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- Returns:
- Future object
-
getName
String getName()
Returns executor name- Returns:
- name of service
-
delete
boolean delete()
Deletes executor request queue and state objects- Returns:
true
if any of objects were deleted
-
registerWorkers
void registerWorkers(int workers)
Register workers- Parameters:
workers
- - workers amount
-
registerWorkers
void registerWorkers(int workers, ExecutorService executor)
Register workers with custom executor- Parameters:
workers
- - workers amountexecutor
- - executor instance
-
countActiveWorkers
int countActiveWorkers()
Returns active worker groups- Returns:
- active worker groups count
-
cancelTask
boolean cancelTask(String taskId)
Cancels task by id- Parameters:
taskId
- - id of task- Returns:
true
if 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
-
-