public class RedissonExecutorService extends Object implements RScheduledExecutorService
Modifier and Type | Field and Description |
---|---|
static int |
SHUTDOWN_STATE |
static int |
TERMINATED_STATE |
Constructor and Description |
---|
RedissonExecutorService(Codec codec,
CommandExecutor commandExecutor,
Redisson redisson,
String name) |
Modifier and Type | Method and Description |
---|---|
boolean |
awaitTermination(long timeout,
TimeUnit unit) |
boolean |
cancelScheduledTask(String taskId)
Cancels scheduled task by id
|
boolean |
delete()
Deletes executor request queue and state objects
|
RFuture<Boolean> |
deleteAsync()
Deletes executor request queue and state objects
|
void |
execute(Runnable task) |
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 which executes each task
|
<V> ScheduledFuture<V> |
schedule(Callable<V> task,
long delay,
TimeUnit unit) |
RScheduledFuture<?> |
schedule(Runnable task,
CronSchedule cronSchedule)
Creates and executes a periodic action with cron schedule object.
|
ScheduledFuture<?> |
schedule(Runnable task,
long delay,
TimeUnit unit) |
<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.
|
ScheduledFuture<?> |
scheduleAtFixedRate(Runnable task,
long initialDelay,
long period,
TimeUnit unit) |
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.
|
ScheduledFuture<?> |
scheduleWithFixedDelay(Runnable task,
long initialDelay,
long delay,
TimeUnit unit) |
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() |
<T> Future<T> |
submit(Callable<T> task) |
Future<?> |
submit(Runnable task) |
<T> RFuture<T> |
submit(Runnable task,
T result) |
<T> RFuture<T> |
submitAsync(Callable<T> task)
Submit task for execution in async mode with listeners support
|
RFuture<?> |
submitAsync(Runnable task)
Submit task for execution in async mode with listeners support
|
public static final int SHUTDOWN_STATE
public static final int TERMINATED_STATE
public RedissonExecutorService(Codec codec, CommandExecutor commandExecutor, Redisson redisson, String name)
public void registerWorkers(int workers)
RExecutorService
registerWorkers
in interface RExecutorService
workers
- - workers amountpublic void registerWorkers(int workers, ExecutorService executor)
RExecutorService
registerWorkers
in interface RExecutorService
workers
- - workers amountexecutor
- - executor instancepublic void shutdown()
shutdown
in interface ExecutorService
public String getName()
RExecutorService
getName
in interface RExecutorService
public boolean delete()
RExecutorService
delete
in interface RExecutorService
true
if any of objects were deletedpublic RFuture<Boolean> deleteAsync()
RExecutorServiceAsync
deleteAsync
in interface RExecutorServiceAsync
true
if any of objects were deletedpublic List<Runnable> shutdownNow()
shutdownNow
in interface ExecutorService
public boolean isShutdown()
isShutdown
in interface ExecutorService
public boolean isTerminated()
isTerminated
in interface ExecutorService
public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException
awaitTermination
in interface ExecutorService
InterruptedException
public <T> Future<T> submit(Callable<T> task)
submit
in interface ExecutorService
public <T> RFuture<T> submitAsync(Callable<T> task)
RExecutorServiceAsync
submitAsync
in interface RExecutorServiceAsync
T
- type of return valuetask
- - task to executepublic <T> RFuture<T> submit(Runnable task, T result)
submit
in interface ExecutorService
public Future<?> submit(Runnable task)
submit
in interface ExecutorService
public RFuture<?> submitAsync(Runnable task)
RExecutorServiceAsync
submitAsync
in interface RExecutorServiceAsync
task
- - task to executepublic ScheduledFuture<?> schedule(Runnable task, long delay, TimeUnit unit)
schedule
in interface ScheduledExecutorService
public RScheduledFuture<?> scheduleAsync(Runnable task, long delay, TimeUnit unit)
RScheduledExecutorServiceAsync
scheduleAsync
in interface RScheduledExecutorServiceAsync
task
- the task to executedelay
- the time from now to delay executionunit
- the time unit of the delay parameterpublic <V> ScheduledFuture<V> schedule(Callable<V> task, long delay, TimeUnit unit)
schedule
in interface ScheduledExecutorService
public <V> RScheduledFuture<V> scheduleAsync(Callable<V> task, long delay, TimeUnit unit)
RScheduledExecutorServiceAsync
scheduleAsync
in interface RScheduledExecutorServiceAsync
V
- 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 ScheduledFuture<?> scheduleAtFixedRate(Runnable task, long initialDelay, long period, TimeUnit unit)
scheduleAtFixedRate
in interface ScheduledExecutorService
public RScheduledFuture<?> scheduleAtFixedRateAsync(Runnable task, long initialDelay, long period, TimeUnit unit)
RScheduledExecutorServiceAsync
scheduleAtFixedRateAsync
in interface RScheduledExecutorServiceAsync
task
- 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)
RScheduledExecutorService
schedule
in interface RScheduledExecutorService
task
- - command the task to executepublic RScheduledFuture<?> scheduleAsync(Runnable task, CronSchedule cronSchedule)
RScheduledExecutorServiceAsync
scheduleAsync
in interface RScheduledExecutorServiceAsync
task
- the task to executecronSchedule
- cron schedule objectpublic ScheduledFuture<?> scheduleWithFixedDelay(Runnable task, long initialDelay, long delay, TimeUnit unit)
scheduleWithFixedDelay
in interface ScheduledExecutorService
public RScheduledFuture<?> scheduleWithFixedDelayAsync(Runnable task, long initialDelay, long delay, TimeUnit unit)
RScheduledExecutorServiceAsync
scheduleWithFixedDelayAsync
in interface RScheduledExecutorServiceAsync
task
- 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)
RScheduledExecutorService
cancelScheduledTask
in interface RScheduledExecutorService
taskId
- - id of tasktrue
if task has been canceled successfullyRScheduledFuture.getTaskId()
public <T> T invokeAny(Collection<? extends Callable<T>> tasks) throws InterruptedException, ExecutionException
invokeAny
in interface ExecutorService
InterruptedException
ExecutionException
public <T> T invokeAny(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
invokeAny
in interface ExecutorService
InterruptedException
ExecutionException
TimeoutException
public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks) throws InterruptedException
invokeAll
in interface ExecutorService
InterruptedException
public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException
invokeAll
in interface ExecutorService
InterruptedException
Copyright © 2014–2017 The Redisson Project. All rights reserved.