Package org.redisson
Class RedissonExecutorService
- java.lang.Object
-
- org.redisson.RedissonExecutorService
-
- All Implemented Interfaces:
Executor,ExecutorService,ScheduledExecutorService,RExecutorService,RExecutorServiceAsync,RScheduledExecutorService,RScheduledExecutorServiceAsync
public class RedissonExecutorService extends Object implements RScheduledExecutorService
- Author:
- Nikita Koksharov
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classRedissonExecutorService.ClassBody
-
Field Summary
Fields Modifier and Type Field Description static intSHUTDOWN_STATEstatic intTERMINATED_STATE-
Fields inherited from interface org.redisson.api.RExecutorService
MAPREDUCE_NAME
-
-
Constructor Summary
Constructors Constructor Description RedissonExecutorService(Codec codec, CommandAsyncExecutor commandExecutor, Redisson redisson, String name, QueueTransferService queueTransferService, ConcurrentMap<String,ResponseEntry> responses, ExecutorOptions options)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanawaitTermination(long timeout, TimeUnit unit)booleancancelTask(String taskId)Cancel task by idRFuture<Boolean>cancelTaskAsync(String taskId)Cancel task by idintcountActiveWorkers()Returns active workers amount available for tasks execution.protected TaskParameterscreateTaskParameters(Runnable task)protected TaskParameterscreateTaskParameters(Callable<?> task)booleandelete()Deletes executor request queue and state objectsRFuture<Boolean>deleteAsync()Deletes executor request queue and state objectsvoidexecute(Runnable task)voidexecute(Runnable... tasks)Submits tasks batch for execution synchronously.protected StringgenerateRequestId()StringgetName()Returns executor nameintgetTaskCount()Returns amount of tasks awaiting for execution and/or currently in execution.RFuture<Integer>getTaskCountAsync()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.RFuture<Set<String>>getTaskIdsAsync()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 executionRFuture<Boolean>hasTaskAsync(String taskId)Returnstrueif this Executor Service has task bytaskIdawaiting for execution and/or currently in execution<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> TinvokeAny(Collection<? extends Callable<T>> tasks)<T> TinvokeAny(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit)booleanisShutdown()booleanisTerminated()voidregisterWorkers(int workers)voidregisterWorkers(int workers, ExecutorService executor)voidregisterWorkers(WorkerOptions options)Register workersRScheduledFuture<?>schedule(Runnable task, long delay, TimeUnit unit)Synchronously schedules a Runnable task for execution asynchronously after the givendelay.RScheduledFuture<?>schedule(Runnable command, long delay, TimeUnit unit, long ttl, TimeUnit ttlUnit)Synchronously schedules a Runnable task with definedtimeToLiveparameter for execution asynchronously after the givendelay.RScheduledFuture<?>schedule(Runnable task, CronSchedule cronSchedule)Synchronously schedules a Runnable task for execution asynchronously cron schedule object.<V> RScheduledFuture<V>schedule(Callable<V> task, long delay, TimeUnit unit)Synchronously schedules a value-returning task for execution asynchronously after the givendelay.<V> RScheduledFuture<V>schedule(Callable<V> callable, long delay, TimeUnit unit, long timeToLive, TimeUnit ttlUnit)Synchronously schedules a value-returning task with definedtimeToLiveparameter for execution asynchronously after the givendelay.RScheduledFuture<?>scheduleAsync(Runnable task, long delay, TimeUnit unit)Schedules a Runnable task for execution asynchronously after the givendelay.RScheduledFuture<?>scheduleAsync(Runnable task, long delay, TimeUnit unit, long timeToLive, TimeUnit ttlUnit)Schedules a Runnable task with definedtimeToLiveparameter for execution asynchronously after the givendelay.RScheduledFuture<?>scheduleAsync(Runnable task, CronSchedule cronSchedule)Synchronously schedules a Runnable task for execution asynchronously cron schedule object.<V> RScheduledFuture<V>scheduleAsync(Callable<V> task, long delay, TimeUnit unit)Schedules a value-returning task for execution asynchronously after the givendelay.<V> RScheduledFuture<V>scheduleAsync(Callable<V> task, long delay, TimeUnit unit, long timeToLive, TimeUnit ttlUnit)Schedules a value-returning task with definedtimeToLiveparameter for execution asynchronously after the givendelay.RScheduledFuture<?>scheduleAtFixedRate(Runnable task, long initialDelay, long period, TimeUnit unit)Synchronously schedules a Runnable task for execution asynchronously after the giveninitialDelay, and subsequently with the givenperiod.RScheduledFuture<?>scheduleAtFixedRateAsync(Runnable task, long initialDelay, long period, TimeUnit unit)Schedules a Runnable task for execution asynchronously after the giveninitialDelay, and subsequently with the givenperiod.RScheduledFuture<?>scheduleWithFixedDelay(Runnable task, long initialDelay, long delay, TimeUnit unit)Synchronously schedules a Runnable task for execution asynchronously after the giveninitialDelay, and subsequently with the givendelaystarted from the task finishing moment.RScheduledFuture<?>scheduleWithFixedDelayAsync(Runnable task, long initialDelay, long delay, TimeUnit unit)Schedules a Runnable task for execution asynchronously after the giveninitialDelay, and subsequently with the givendelaystarted from the task finishing moment.voidshutdown()List<Runnable>shutdownNow()RExecutorFuture<?>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.RExecutorFuture<?>submitAsync(Runnable task)Submits task for execution asynchronouslyRExecutorBatchFuturesubmitAsync(Runnable... tasks)Submits tasks batch for execution asynchronously.RExecutorFuture<?>submitAsync(Runnable task, long timeToLive, TimeUnit timeUnit)Submits a task with definedtimeToLiveparameter for execution asynchronously.RExecutorBatchFuturesubmitAsync(Callable<?>... tasks)Submits tasks batch for execution asynchronously.<T> RExecutorFuture<T>submitAsync(Callable<T> task)Submits task for execution asynchronously<T> RExecutorFuture<T>submitAsync(Callable<T> task, long timeToLive, TimeUnit timeUnit)Submits a value-returning task with definedtimeToLiveparameter for execution asynchronously.
-
-
-
Field Detail
-
SHUTDOWN_STATE
public static final int SHUTDOWN_STATE
- See Also:
- Constant Field Values
-
TERMINATED_STATE
public static final int TERMINATED_STATE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
RedissonExecutorService
public RedissonExecutorService(Codec codec, CommandAsyncExecutor commandExecutor, Redisson redisson, String name, QueueTransferService queueTransferService, ConcurrentMap<String,ResponseEntry> responses, ExecutorOptions options)
-
-
Method Detail
-
generateRequestId
protected String generateRequestId()
-
getTaskCount
public int getTaskCount()
Description copied from interface:RExecutorServiceReturns amount of tasks awaiting for execution and/or currently in execution.- Specified by:
getTaskCountin interfaceRExecutorService- Returns:
- amount of tasks
-
getTaskCountAsync
public RFuture<Integer> getTaskCountAsync()
Description copied from interface:RExecutorServiceAsyncReturns amount of tasks awaiting for execution and/or currently in execution.- Specified by:
getTaskCountAsyncin interfaceRExecutorServiceAsync- Returns:
- amount of tasks
-
hasTask
public boolean hasTask(String taskId)
Description copied from interface:RExecutorServiceReturnstrueif this Executor Service has task bytaskIdawaiting for execution and/or currently in execution- Specified by:
hasTaskin interfaceRExecutorService- Parameters:
taskId- - id of task- Returns:
trueif this Executor Service has task
-
getTaskIds
public Set<String> getTaskIds()
Description copied from interface:RExecutorServiceReturns list of task ids awaiting for execution and/or currently in execution.- Specified by:
getTaskIdsin interfaceRExecutorService- Returns:
- task ids
-
getTaskIdsAsync
public RFuture<Set<String>> getTaskIdsAsync()
Description copied from interface:RExecutorServiceAsyncReturns list of task ids awaiting for execution and/or currently in execution.- Specified by:
getTaskIdsAsyncin interfaceRExecutorServiceAsync- Returns:
- task ids
-
hasTaskAsync
public RFuture<Boolean> hasTaskAsync(String taskId)
Description copied from interface:RExecutorServiceAsyncReturnstrueif this Executor Service has task bytaskIdawaiting for execution and/or currently in execution- Specified by:
hasTaskAsyncin interfaceRExecutorServiceAsync- Parameters:
taskId- - id of task- Returns:
trueif this Executor Service has task
-
countActiveWorkers
public int countActiveWorkers()
Description copied from interface:RExecutorServiceReturns active workers amount available for tasks execution.- Specified by:
countActiveWorkersin interfaceRExecutorService- Returns:
- workers amount
-
registerWorkers
public void registerWorkers(int workers)
- Specified by:
registerWorkersin interfaceRExecutorService
-
registerWorkers
public void registerWorkers(WorkerOptions options)
Description copied from interface:RExecutorServiceRegister workers- Specified by:
registerWorkersin interfaceRExecutorService- Parameters:
options- - worker options
-
registerWorkers
public void registerWorkers(int workers, ExecutorService executor)- Specified by:
registerWorkersin interfaceRExecutorService
-
execute
public void execute(Runnable... tasks)
Description copied from interface:RExecutorServiceSubmits 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.- Specified by:
executein interfaceRExecutorService- Parameters:
tasks- - tasks to execute
-
shutdown
public void shutdown()
- Specified by:
shutdownin interfaceExecutorService
-
getName
public String getName()
Description copied from interface:RExecutorServiceReturns executor name- Specified by:
getNamein interfaceRExecutorService- Returns:
- name of service
-
delete
public boolean delete()
Description copied from interface:RExecutorServiceDeletes executor request queue and state objects- Specified by:
deletein interfaceRExecutorService- Returns:
trueif any of objects were deleted
-
deleteAsync
public RFuture<Boolean> deleteAsync()
Description copied from interface:RExecutorServiceAsyncDeletes executor request queue and state objects- Specified by:
deleteAsyncin interfaceRExecutorServiceAsync- Returns:
trueif any of objects were deleted
-
shutdownNow
public List<Runnable> shutdownNow()
- Specified by:
shutdownNowin interfaceExecutorService
-
isShutdown
public boolean isShutdown()
- Specified by:
isShutdownin interfaceExecutorService
-
isTerminated
public boolean isTerminated()
- Specified by:
isTerminatedin interfaceExecutorService
-
awaitTermination
public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException- Specified by:
awaitTerminationin interfaceExecutorService- Throws:
InterruptedException
-
submit
public <T> RExecutorFuture<T> submit(Callable<T> task)
Description copied from interface:RExecutorServiceSynchronously 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- Specified by:
submitin interfaceRExecutorService- 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
public <T> RExecutorFuture<T> submit(Callable<T> task, long timeToLive, TimeUnit timeUnit)
Description copied from interface:RExecutorServiceSynchronously 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.- Specified by:
submitin interfaceRExecutorService- 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
-
submitAsync
public <T> RExecutorFuture<T> submitAsync(Callable<T> task, long timeToLive, TimeUnit timeUnit)
Description copied from interface:RExecutorServiceAsyncSubmits 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.- Specified by:
submitAsyncin interfaceRExecutorServiceAsync- 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
-
submitAsync
public <T> RExecutorFuture<T> submitAsync(Callable<T> task)
Description copied from interface:RExecutorServiceAsyncSubmits task for execution asynchronously- Specified by:
submitAsyncin interfaceRExecutorServiceAsync- Type Parameters:
T- type of return value- Parameters:
task- - task to execute- Returns:
- Future object
-
submit
public RExecutorBatchFuture submit(Callable<?>... tasks)
Description copied from interface:RExecutorServiceSynchronously 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.- Specified by:
submitin interfaceRExecutorService- Parameters:
tasks- - tasks to execute- Returns:
- Future object
-
createTaskParameters
protected TaskParameters createTaskParameters(Callable<?> task)
-
createTaskParameters
protected TaskParameters createTaskParameters(Runnable task)
-
submitAsync
public RExecutorBatchFuture submitAsync(Callable<?>... tasks)
Description copied from interface:RExecutorServiceAsyncSubmits 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.- Specified by:
submitAsyncin interfaceRExecutorServiceAsync- Parameters:
tasks- - tasks to execute- Returns:
- Future object
-
submit
public <T> RExecutorFuture<T> submit(Runnable task, T result)
Description copied from interface:RExecutorServiceSynchronously 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- Specified by:
submitin interfaceRExecutorService- 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
public RExecutorBatchFuture submit(Runnable... tasks)
Description copied from interface:RExecutorServiceSynchronously 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.- Specified by:
submitin interfaceRExecutorService- Parameters:
tasks- - tasks to execute- Returns:
- Future object
-
submitAsync
public RExecutorBatchFuture submitAsync(Runnable... tasks)
Description copied from interface:RExecutorServiceAsyncSubmits 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.- Specified by:
submitAsyncin interfaceRExecutorServiceAsync- Parameters:
tasks- - tasks to execute- Returns:
- Future object
-
submit
public RExecutorFuture<?> submit(Runnable task)
Description copied from interface:RExecutorServiceSynchronously submits a Runnable task for execution asynchronously. Returns a RExecutorFuture representing task completion. The Future'sgetmethod will returnnullupon successful completion.- Specified by:
submitin interfaceExecutorService- Specified by:
submitin interfaceRExecutorService- Parameters:
task- the task to submit- Returns:
- a Future representing pending completion of the task
-
submit
public RExecutorFuture<?> submit(Runnable task, long timeToLive, TimeUnit timeUnit)
Description copied from interface:RExecutorServiceSynchronously 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.- Specified by:
submitin interfaceRExecutorService- 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
-
submitAsync
public RExecutorFuture<?> submitAsync(Runnable task, long timeToLive, TimeUnit timeUnit)
Description copied from interface:RExecutorServiceAsyncSubmits 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.- Specified by:
submitAsyncin interfaceRExecutorServiceAsync- 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
-
submitAsync
public RExecutorFuture<?> submitAsync(Runnable task)
Description copied from interface:RExecutorServiceAsyncSubmits task for execution asynchronously- Specified by:
submitAsyncin interfaceRExecutorServiceAsync- Parameters:
task- - task to execute- Returns:
- Future object
-
schedule
public RScheduledFuture<?> schedule(Runnable task, long delay, TimeUnit unit)
Description copied from interface:RScheduledExecutorServiceSynchronously schedules a Runnable task for execution asynchronously after the givendelay. Returns a RScheduledFuture representing that task. The Future'sgetmethod will return the given result upon successful completion.- Specified by:
schedulein interfaceRScheduledExecutorService- Specified by:
schedulein interfaceScheduledExecutorService- Parameters:
task- 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 returnnullupon completion
-
scheduleAsync
public RScheduledFuture<?> scheduleAsync(Runnable task, long delay, TimeUnit unit)
Description copied from interface:RScheduledExecutorServiceAsyncSchedules a Runnable task for execution asynchronously after the givendelay. Returns a RScheduledFuture representing that task. The Future'sgetmethod will return the given result upon successful completion.- Specified by:
scheduleAsyncin interfaceRScheduledExecutorServiceAsync- Parameters:
task- the task to executedelay- the time from now to delay executionunit- the time unit of the delay parameter- Returns:
- RScheduledFuture with listeners support
-
schedule
public <V> RScheduledFuture<V> schedule(Callable<V> task, long delay, TimeUnit unit)
Description copied from interface:RScheduledExecutorServiceSynchronously schedules a value-returning task for execution asynchronously after the givendelay. Returns a RScheduledFuture representing that task. The Future'sgetmethod will return the given result upon successful completion.- Specified by:
schedulein interfaceRScheduledExecutorService- Specified by:
schedulein interfaceScheduledExecutorService- Type Parameters:
V- the type of the callable's result- Parameters:
task- 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
-
scheduleAsync
public <V> RScheduledFuture<V> scheduleAsync(Callable<V> task, long delay, TimeUnit unit)
Description copied from interface:RScheduledExecutorServiceAsyncSchedules a value-returning task for execution asynchronously after the givendelay. Returns a RScheduledFuture representing that task. The Future'sgetmethod will return the given result upon successful completion.- Specified by:
scheduleAsyncin interfaceRScheduledExecutorServiceAsync- Type Parameters:
V- the type of the callable's result- Parameters:
task- the function to executedelay- the time from now to delay executionunit- the time unit of the delay parameter- Returns:
- RScheduledFuture with listeners support
-
schedule
public RScheduledFuture<?> schedule(Runnable command, long delay, TimeUnit unit, long ttl, TimeUnit ttlUnit)
Description copied from interface:RScheduledExecutorServiceSynchronously schedules a Runnable task with definedtimeToLiveparameter for execution asynchronously after the givendelay. Returns a RScheduledFuture representing that task. The Future'sgetmethod will return the given result upon successful completion.- Specified by:
schedulein interfaceRScheduledExecutorService- Parameters:
command- the task to executedelay- the time from now to delay executionunit- the time unit of the delay parameterttl- - time to live intervalttlUnit- - unit of time to live interval- Returns:
- a ScheduledFuture representing pending completion of
the task and whose
get()method will returnnullupon completion
-
scheduleAsync
public RScheduledFuture<?> scheduleAsync(Runnable task, long delay, TimeUnit unit, long timeToLive, TimeUnit ttlUnit)
Description copied from interface:RScheduledExecutorServiceAsyncSchedules a Runnable task with definedtimeToLiveparameter for execution asynchronously after the givendelay. Returns a RScheduledFuture representing that task. The Future'sgetmethod will return the given result upon successful completion.- Specified by:
scheduleAsyncin interfaceRScheduledExecutorServiceAsync- Parameters:
task- 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:
- RScheduledFuture with listeners support
-
schedule
public <V> RScheduledFuture<V> schedule(Callable<V> callable, long delay, TimeUnit unit, long timeToLive, TimeUnit ttlUnit)
Description copied from interface:RScheduledExecutorServiceSynchronously schedules a value-returning task with definedtimeToLiveparameter for execution asynchronously after the givendelay. Returns a RScheduledFuture representing that task. The Future'sgetmethod will return the given result upon successful completion.- Specified by:
schedulein interfaceRScheduledExecutorService- 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
-
scheduleAsync
public <V> RScheduledFuture<V> scheduleAsync(Callable<V> task, long delay, TimeUnit unit, long timeToLive, TimeUnit ttlUnit)
Description copied from interface:RScheduledExecutorServiceAsyncSchedules a value-returning task with definedtimeToLiveparameter for execution asynchronously after the givendelay. Returns a RScheduledFuture representing that task. The Future'sgetmethod will return the given result upon successful completion.- Specified by:
scheduleAsyncin interfaceRScheduledExecutorServiceAsync- Type Parameters:
V- the type of the callable's result- Parameters:
task- 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:
- RScheduledFuture with listeners support
-
scheduleAtFixedRate
public RScheduledFuture<?> scheduleAtFixedRate(Runnable task, long initialDelay, long period, TimeUnit unit)
Description copied from interface:RScheduledExecutorServiceSynchronously 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:
scheduleAtFixedRatein interfaceRScheduledExecutorService- Specified by:
scheduleAtFixedRatein interfaceScheduledExecutorService- Parameters:
task- 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
-
scheduleAtFixedRateAsync
public RScheduledFuture<?> scheduleAtFixedRateAsync(Runnable task, long initialDelay, long period, TimeUnit unit)
Description copied from interface:RScheduledExecutorServiceAsyncSchedules 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:
scheduleAtFixedRateAsyncin interfaceRScheduledExecutorServiceAsync- Parameters:
task- 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:
- RScheduledFuture with listeners support
-
schedule
public RScheduledFuture<?> schedule(Runnable task, CronSchedule cronSchedule)
Description copied from interface:RScheduledExecutorServiceSynchronously 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.- Specified by:
schedulein interfaceRScheduledExecutorService- Parameters:
task- - command the task to executecronSchedule- - cron schedule object- Returns:
- future object
-
scheduleAsync
public RScheduledFuture<?> scheduleAsync(Runnable task, CronSchedule cronSchedule)
Description copied from interface:RScheduledExecutorServiceAsyncSynchronously 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.- Specified by:
scheduleAsyncin interfaceRScheduledExecutorServiceAsync- Parameters:
task- the task to executecronSchedule- cron schedule object- Returns:
- RScheduledFuture with listeners support
-
scheduleWithFixedDelay
public RScheduledFuture<?> scheduleWithFixedDelay(Runnable task, long initialDelay, long delay, TimeUnit unit)
Description copied from interface:RScheduledExecutorServiceSynchronously schedules a Runnable task for execution asynchronously after the giveninitialDelay, and subsequently with the givendelaystarted 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:
scheduleWithFixedDelayin interfaceRScheduledExecutorService- Specified by:
scheduleWithFixedDelayin interfaceScheduledExecutorService- Parameters:
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 parameters- Returns:
- a ScheduledFuture representing pending completion of
the task, and whose
get()method will throw an exception upon cancellation
-
scheduleWithFixedDelayAsync
public RScheduledFuture<?> scheduleWithFixedDelayAsync(Runnable task, long initialDelay, long delay, TimeUnit unit)
Description copied from interface:RScheduledExecutorServiceAsyncSchedules a Runnable task for execution asynchronously after the giveninitialDelay, and subsequently with the givendelaystarted 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:
scheduleWithFixedDelayAsyncin interfaceRScheduledExecutorServiceAsync- Parameters:
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 parameters- Returns:
- RScheduledFuture with listeners support
-
cancelTask
public boolean cancelTask(String taskId)
Description copied from interface:RExecutorServiceCancel task by id- Specified by:
cancelTaskin interfaceRExecutorService- Parameters:
taskId- - id of task- Returns:
trueif task has been canceled successfully- See Also:
RExecutorFuture.getTaskId()
-
cancelTaskAsync
public RFuture<Boolean> cancelTaskAsync(String taskId)
Description copied from interface:RExecutorServiceAsyncCancel task by id- Specified by:
cancelTaskAsyncin interfaceRExecutorServiceAsync- Parameters:
taskId- - id of task- Returns:
trueif task has been canceled successfully- See Also:
RExecutorFuture.getTaskId()
-
invokeAny
public <T> T invokeAny(Collection<? extends Callable<T>> tasks) throws InterruptedException, ExecutionException
- Specified by:
invokeAnyin interfaceExecutorService- Throws:
InterruptedExceptionExecutionException
-
invokeAny
public <T> T invokeAny(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
- Specified by:
invokeAnyin interfaceExecutorService- Throws:
InterruptedExceptionExecutionExceptionTimeoutException
-
invokeAll
public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks) throws InterruptedException
- Specified by:
invokeAllin interfaceExecutorService- Throws:
InterruptedException
-
invokeAll
public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException
- Specified by:
invokeAllin interfaceExecutorService- Throws:
InterruptedException
-
-