public class RedissonExecutorService extends Object implements RScheduledExecutorService
| Modifier and Type | Field and Description |
|---|---|
static int |
SHUTDOWN_STATE |
static int |
TERMINATED_STATE |
MAPREDUCE_NAME| Constructor and Description |
|---|
RedissonExecutorService(Codec codec,
CommandExecutor commandExecutor,
Redisson redisson,
String name,
QueueTransferService queueTransferService,
ConcurrentMap<String,ResponseEntry> responses,
ExecutorOptions options) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
awaitTermination(long timeout,
TimeUnit unit) |
boolean |
cancelScheduledTask(String taskId)
|
boolean |
cancelTask(String taskId)
Cancels task by id
|
int |
countActiveWorkers()
Returns active worker groups
|
boolean |
delete()
Deletes executor request queue and state objects
|
RFuture<Boolean> |
deleteAsync()
Deletes executor request queue and state objects
|
void |
execute(Runnable... tasks)
Submits tasks batch for execution synchronously.
|
void |
execute(Runnable task) |
protected String |
generateRequestId() |
String |
getName()
Returns executor name
|
<T> List<Future<T>> |
invokeAll(Collection<? extends Callable<T>> tasks) |
<T> List<Future<T>> |
invokeAll(Collection<? extends Callable<T>> tasks,
long timeout,
TimeUnit unit) |
<T> T |
invokeAny(Collection<? extends Callable<T>> tasks) |
<T> T |
invokeAny(Collection<? extends Callable<T>> tasks,
long timeout,
TimeUnit unit) |
boolean |
isShutdown() |
boolean |
isTerminated() |
void |
registerWorkers(int workers)
Register workers
|
void |
registerWorkers(int workers,
ExecutorService executor)
Register workers with custom executor
|
<V> RScheduledFuture<V> |
schedule(Callable<V> task,
long delay,
TimeUnit unit)
Creates and executes a ScheduledFuture that becomes enabled after the
given delay.
|
RScheduledFuture<?> |
schedule(Runnable task,
CronSchedule cronSchedule)
Creates and executes a periodic action with cron schedule object.
|
RScheduledFuture<?> |
schedule(Runnable task,
long delay,
TimeUnit unit)
Creates and executes a one-shot action that becomes enabled
after the given delay.
|
<V> RScheduledFuture<V> |
scheduleAsync(Callable<V> task,
long delay,
TimeUnit unit)
Creates in async mode and executes a ScheduledFuture that becomes enabled after the
given delay.
|
RScheduledFuture<?> |
scheduleAsync(Runnable task,
CronSchedule cronSchedule)
Creates in async mode and executes a periodic action with cron schedule object.
|
RScheduledFuture<?> |
scheduleAsync(Runnable task,
long delay,
TimeUnit unit)
Creates in async mode and executes a one-shot action that becomes enabled
after the given delay.
|
RScheduledFuture<?> |
scheduleAtFixedRate(Runnable task,
long initialDelay,
long period,
TimeUnit unit)
Creates and executes a periodic action that becomes enabled first
after the given initial delay, and subsequently with the given
period; that is executions will commence after
initialDelay then initialDelay+period, then
initialDelay + 2 * period, and so on. |
RScheduledFuture<?> |
scheduleAtFixedRateAsync(Runnable task,
long initialDelay,
long period,
TimeUnit unit)
Creates in async mode and executes a periodic action that becomes enabled first
after the given initial delay, and subsequently with the given
period.
|
RScheduledFuture<?> |
scheduleWithFixedDelay(Runnable task,
long initialDelay,
long delay,
TimeUnit unit)
Creates and executes 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.
|
RScheduledFuture<?> |
scheduleWithFixedDelayAsync(Runnable task,
long initialDelay,
long delay,
TimeUnit unit)
Creates in async mode and executes 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.
|
void |
shutdown() |
List<Runnable> |
shutdownNow() |
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.
|
RExecutorBatchFuture |
submit(Runnable... tasks)
Submits tasks batch for execution synchronously.
|
RExecutorFuture<?> |
submit(Runnable task)
Submits a Runnable task for execution and returns a Future
representing that task.
|
<T> RExecutorFuture<T> |
submit(Runnable task,
T result)
Submits a Runnable task for execution and returns a Future
representing that task.
|
RExecutorBatchFuture |
submitAsync(Callable<?>... tasks)
Submits tasks batch for execution asynchronously.
|
<T> RExecutorFuture<T> |
submitAsync(Callable<T> task)
Submits task for execution asynchronously
|
RExecutorBatchFuture |
submitAsync(Runnable... tasks)
Submits tasks batch for execution asynchronously.
|
RExecutorFuture<?> |
submitAsync(Runnable task)
Submits task for execution asynchronously
|
public static final int SHUTDOWN_STATE
public static final int TERMINATED_STATE
public RedissonExecutorService(Codec codec, CommandExecutor commandExecutor, Redisson redisson, String name, QueueTransferService queueTransferService, ConcurrentMap<String,ResponseEntry> responses, ExecutorOptions options)
protected String generateRequestId()
public int countActiveWorkers()
RExecutorServicecountActiveWorkers in interface RExecutorServicepublic void registerWorkers(int workers)
RExecutorServiceregisterWorkers in interface RExecutorServiceworkers - - workers amountpublic void registerWorkers(int workers,
ExecutorService executor)
RExecutorServiceregisterWorkers in interface RExecutorServiceworkers - - workers amountexecutor - - executor instancepublic void execute(Runnable... tasks)
RExecutorServiceexecute in interface RExecutorServicetasks - - tasks to executepublic void shutdown()
shutdown in interface ExecutorServicepublic String getName()
RExecutorServicegetName in interface RExecutorServicepublic boolean delete()
RExecutorServicedelete in interface RExecutorServicetrue if any of objects were deletedpublic RFuture<Boolean> deleteAsync()
RExecutorServiceAsyncdeleteAsync in interface RExecutorServiceAsynctrue if any of objects were deletedpublic List<Runnable> shutdownNow()
shutdownNow in interface ExecutorServicepublic boolean isShutdown()
isShutdown in interface ExecutorServicepublic boolean isTerminated()
isTerminated in interface ExecutorServicepublic boolean awaitTermination(long timeout,
TimeUnit unit)
throws InterruptedException
awaitTermination in interface ExecutorServiceInterruptedExceptionpublic <T> RExecutorFuture<T> submit(Callable<T> task)
RExecutorServiceget method will return the task's result upon
successful completion.submit in interface ExecutorServicesubmit in interface RExecutorServiceT - the type of the task's resulttask - the task to submitpublic <T> RExecutorFuture<T> submitAsync(Callable<T> task)
RExecutorServiceAsyncsubmitAsync in interface RExecutorServiceAsyncT - type of return valuetask - - task to executepublic RExecutorBatchFuture submit(Callable<?>... tasks)
RExecutorServicesubmit in interface RExecutorServicetasks - - tasks to executepublic RExecutorBatchFuture submitAsync(Callable<?>... tasks)
RExecutorServiceAsyncsubmitAsync in interface RExecutorServiceAsynctasks - - tasks to executepublic <T> RExecutorFuture<T> submit(Runnable task, T result)
RExecutorServiceget method will
return the given result upon successful completion.submit in interface ExecutorServicesubmit in interface RExecutorServiceT - the type of the resulttask - the task to submitresult - the result to returnpublic RExecutorBatchFuture submit(Runnable... tasks)
RExecutorServicesubmit in interface RExecutorServicetasks - - tasks to executepublic RExecutorBatchFuture submitAsync(Runnable... tasks)
RExecutorServiceAsyncsubmitAsync in interface RExecutorServiceAsynctasks - - tasks to executepublic RExecutorFuture<?> submit(Runnable task)
RExecutorServiceget method will
return null upon successful completion.submit in interface ExecutorServicesubmit in interface RExecutorServicetask - the task to submitpublic RExecutorFuture<?> submitAsync(Runnable task)
RExecutorServiceAsyncsubmitAsync in interface RExecutorServiceAsynctask - - task to executepublic RScheduledFuture<?> schedule(Runnable task, long delay, TimeUnit unit)
RScheduledExecutorServiceschedule in interface ScheduledExecutorServiceschedule in interface RScheduledExecutorServicetask - the task to executedelay - the time from now to delay executionunit - the time unit of the delay parameterget() method will return
null upon completionpublic RScheduledFuture<?> scheduleAsync(Runnable task, long delay, TimeUnit unit)
RScheduledExecutorServiceAsyncscheduleAsync in interface RScheduledExecutorServiceAsynctask - the task to executedelay - the time from now to delay executionunit - the time unit of the delay parameterpublic <V> RScheduledFuture<V> schedule(Callable<V> task, long delay, TimeUnit unit)
RScheduledExecutorServiceschedule in interface ScheduledExecutorServiceschedule in interface RScheduledExecutorServiceV - the type of the callable's resulttask - the function to executedelay - the time from now to delay executionunit - the time unit of the delay parameterpublic <V> RScheduledFuture<V> scheduleAsync(Callable<V> task, long delay, TimeUnit unit)
RScheduledExecutorServiceAsyncscheduleAsync in interface RScheduledExecutorServiceAsyncV - the type of the callable's resulttask - the function to executedelay - the time from now to delay executionunit - the time unit of the delay parameterpublic RScheduledFuture<?> scheduleAtFixedRate(Runnable task, long initialDelay, long period, TimeUnit unit)
RScheduledExecutorServiceinitialDelay then initialDelay+period, then
initialDelay + 2 * period, and so on.
If any execution of the task
encounters an exception, subsequent executions are suppressed.
Otherwise, the task will only terminate via cancellation or
termination of the executor. If any execution of this task
takes longer than its period, then subsequent executions
may start late, but will not concurrently execute.scheduleAtFixedRate in interface ScheduledExecutorServicescheduleAtFixedRate in interface RScheduledExecutorServicetask - the task to executeinitialDelay - the time to delay first executionperiod - the period between successive executionsunit - the time unit of the initialDelay and period parametersget() method will throw an
exception upon cancellationpublic RScheduledFuture<?> scheduleAtFixedRateAsync(Runnable task, long initialDelay, long period, TimeUnit unit)
RScheduledExecutorServiceAsyncscheduleAtFixedRateAsync in interface RScheduledExecutorServiceAsynctask - the task to executeinitialDelay - the time to delay first executionperiod - the period between successive executionsunit - the time unit of the initialDelay and period parameterspublic RScheduledFuture<?> schedule(Runnable task, CronSchedule cronSchedule)
RScheduledExecutorServiceschedule in interface RScheduledExecutorServicetask - - command the task to executepublic RScheduledFuture<?> scheduleAsync(Runnable task, CronSchedule cronSchedule)
RScheduledExecutorServiceAsyncscheduleAsync in interface RScheduledExecutorServiceAsynctask - the task to executecronSchedule - cron schedule objectpublic RScheduledFuture<?> scheduleWithFixedDelay(Runnable task, long initialDelay, long delay, TimeUnit unit)
RScheduledExecutorServicescheduleWithFixedDelay in interface ScheduledExecutorServicescheduleWithFixedDelay in interface RScheduledExecutorServicetask - the task to executeinitialDelay - the time to delay first executiondelay - the delay between the termination of one
execution and the commencement of the nextunit - the time unit of the initialDelay and delay parametersget() method will throw an
exception upon cancellationpublic RScheduledFuture<?> scheduleWithFixedDelayAsync(Runnable task, long initialDelay, long delay, TimeUnit unit)
RScheduledExecutorServiceAsyncscheduleWithFixedDelayAsync in interface RScheduledExecutorServiceAsynctask - the task to executeinitialDelay - the time to delay first executiondelay - the delay between the termination of one
execution and the commencement of the nextunit - the time unit of the initialDelay and delay parameterspublic boolean cancelScheduledTask(String taskId)
RScheduledExecutorServicecancelScheduledTask in interface RScheduledExecutorServicetaskId - of taskpublic boolean cancelTask(String taskId)
RExecutorServicecancelTask in interface RExecutorServicetaskId - - id of tasktrue if task has been canceled successfullyRExecutorFuture.getTaskId()public <T> T invokeAny(Collection<? extends Callable<T>> tasks) throws InterruptedException, ExecutionException
invokeAny in interface ExecutorServiceInterruptedExceptionExecutionExceptionpublic <T> T invokeAny(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
invokeAny in interface ExecutorServiceInterruptedExceptionExecutionExceptionTimeoutExceptionpublic <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks) throws InterruptedException
invokeAll in interface ExecutorServiceInterruptedExceptionpublic <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException
invokeAll in interface ExecutorServiceInterruptedExceptionCopyright © 2014–2018 The Redisson Project. All rights reserved.