Package org.redisson.api
Interface RScheduledExecutorService
- All Superinterfaces:
Executor
,ExecutorService
,RExecutorService
,RExecutorServiceAsync
,RScheduledExecutorServiceAsync
,ScheduledExecutorService
- All Known Implementing Classes:
RedissonExecutorService
public interface RScheduledExecutorService
extends RExecutorService, ScheduledExecutorService, RScheduledExecutorServiceAsync
Redis based implementation of
ScheduledExecutorService
- Author:
- Nikita Koksharov
-
Field Summary
Fields inherited from interface org.redisson.api.RExecutorService
MAPREDUCE_NAME
-
Method Summary
Modifier and TypeMethodDescriptionSynchronously schedules a Runnable task for execution asynchronously after the givendelay
.Synchronously schedules a Runnable task with definedtimeToLive
parameter for execution asynchronously after the givendelay
.schedule
(Runnable task, CronSchedule cronSchedule) Synchronously schedules a Runnable task for execution asynchronously cron schedule object.<V> RScheduledFuture<V>
Synchronously schedules a value-returning task for execution asynchronously after the givendelay
.<V> RScheduledFuture<V>
Synchronously schedules a value-returning task with definedtimeToLive
parameter for execution asynchronously after the givendelay
.scheduleAtFixedRate
(Runnable command, long initialDelay, long period, TimeUnit unit) Synchronously schedules a Runnable task for execution asynchronously after the giveninitialDelay
, and subsequently with the givenperiod
.scheduleWithFixedDelay
(Runnable command, long initialDelay, long delay, TimeUnit unit) Synchronously schedules a Runnable task for execution asynchronously after the giveninitialDelay
, and subsequently with the givendelay
started from the task finishing moment.Methods inherited from interface java.util.concurrent.ExecutorService
awaitTermination, invokeAll, invokeAll, invokeAny, invokeAny, isShutdown, isTerminated, shutdown, shutdownNow
Methods inherited from interface org.redisson.api.RExecutorService
cancelTask, countActiveWorkers, delete, execute, getName, getTaskCount, getTaskIds, hasTask, registerWorkers, registerWorkers, registerWorkers, submit, submit, submit, submit, submit, submit, submit
Methods inherited from interface org.redisson.api.RExecutorServiceAsync
cancelTaskAsync, deleteAsync, getTaskCountAsync, getTaskIdsAsync, hasTaskAsync, submitAsync, submitAsync, submitAsync, submitAsync, submitAsync, submitAsync
Methods inherited from interface org.redisson.api.RScheduledExecutorServiceAsync
scheduleAsync, scheduleAsync, scheduleAsync, scheduleAsync, scheduleAsync, scheduleAtFixedRateAsync, scheduleWithFixedDelayAsync
-
Method Details
-
schedule
Synchronously schedules a Runnable task for execution asynchronously after the givendelay
. Returns a RScheduledFuture representing that task. The Future'sget
method will return the given result upon successful completion.- Specified by:
schedule
in interfaceScheduledExecutorService
- Parameters:
command
- the task to executedelay
- the time from now to delay executionunit
- the time unit of the delay parameter- Returns:
- a ScheduledFuture representing pending completion of
the task and whose
get()
method will returnnull
upon completion
-
schedule
RScheduledFuture<?> schedule(Runnable command, long delay, TimeUnit unit, long timeToLive, TimeUnit ttlUnit) Synchronously schedules a Runnable task with definedtimeToLive
parameter for execution asynchronously after the givendelay
. Returns a RScheduledFuture representing that task. The Future'sget
method will return the given result upon successful completion.- Parameters:
command
- the task to executedelay
- the time from now to delay executionunit
- the time unit of the delay parametertimeToLive
- - time to live intervalttlUnit
- - unit of time to live interval- Returns:
- a ScheduledFuture representing pending completion of
the task and whose
get()
method will returnnull
upon completion
-
schedule
Synchronously schedules a value-returning task for execution asynchronously after the givendelay
. Returns a RScheduledFuture representing that task. The Future'sget
method will return the given result upon successful completion.- Specified by:
schedule
in interfaceScheduledExecutorService
- Type Parameters:
V
- the type of the callable's result- Parameters:
callable
- the function to executedelay
- the time from now to delay executionunit
- the time unit of the delay parameter- Returns:
- a ScheduledFuture that can be used to extract result or cancel
-
schedule
<V> RScheduledFuture<V> schedule(Callable<V> callable, long delay, TimeUnit unit, long timeToLive, TimeUnit ttlUnit) Synchronously schedules a value-returning task with definedtimeToLive
parameter for execution asynchronously after the givendelay
. Returns a RScheduledFuture representing that task. The Future'sget
method will return the given result upon successful completion.- Type Parameters:
V
- the type of the callable's result- Parameters:
callable
- the function to executedelay
- the time from now to delay executionunit
- the time unit of the delay parametertimeToLive
- - time to live intervalttlUnit
- - unit of time to live interval- Returns:
- a ScheduledFuture that can be used to extract result or cancel
-
scheduleAtFixedRate
RScheduledFuture<?> scheduleAtFixedRate(Runnable command, long initialDelay, long period, TimeUnit unit) Synchronously schedules a Runnable task for execution asynchronously after the giveninitialDelay
, and subsequently with the givenperiod
. Subsequent executions are stopped if any execution of the task throws an exception. Otherwise, task could be terminated via cancellation or termination of the executor.- Specified by:
scheduleAtFixedRate
in interfaceScheduledExecutorService
- Parameters:
command
- the task to executeinitialDelay
- the time to delay first executionperiod
- the period between successive executionsunit
- the time unit of the initialDelay and period parameters- Returns:
- a ScheduledFuture representing pending completion of
the task, and whose
get()
method will throw an exception upon cancellation
-
scheduleWithFixedDelay
RScheduledFuture<?> scheduleWithFixedDelay(Runnable command, long initialDelay, long delay, TimeUnit unit) Synchronously schedules a Runnable task for execution asynchronously after the giveninitialDelay
, and subsequently with the givendelay
started from the task finishing moment. Subsequent executions are stopped if any execution of the task throws an exception. Otherwise, task could be terminated via cancellation or termination of the executor.- Specified by:
scheduleWithFixedDelay
in interfaceScheduledExecutorService
- Parameters:
command
- 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 parameters- Returns:
- a ScheduledFuture representing pending completion of
the task, and whose
get()
method will throw an exception upon cancellation
-
schedule
Synchronously schedules a Runnable task for execution asynchronously cron schedule object. Subsequent executions are stopped if any execution of the task throws an exception. Otherwise, task could be terminated via cancellation or termination of the executor.- Parameters:
task
- - command the task to executecronSchedule
- - cron schedule object- Returns:
- future object
-