Package org.apache.qpid.protonj2.engine
Interface Scheduler
- All Known Implementing Classes:
Netty4IOContext.NettyIOScheduler
,Netty5IOContext.NettyIOScheduler
public interface Scheduler
A basic scheduling service API that does not provide the full
ScheduledExecutorService
API which is generally not needed by the proton Engine
and might not be provided by
the component provided to the engine which performs scheduled services.-
Method Summary
Modifier and TypeMethodDescriptionvoid
boolean
Future<?>
Schedule the givenRunnable
for execution after the given delay.<V> Future<V>
Schedule the given task for execution after the given delay.Future<?>
scheduleAtFixedRate
(Runnable command, long initialDelay, long period, TimeUnit unit) Schedule the given task for execution after the given delay to repeat with the given period.Future<?>
scheduleWithFixedDelay
(Runnable command, long initialDelay, long delay, TimeUnit unit) Schedule the given task for execution after the given delay to repeat with the given period.
-
Method Details
-
isShutdown
boolean isShutdown()- Returns:
- if the
Scheduler
has been shutdown or not.
-
execute
Runs the givenRunnable
command at some point in the future on a the same thread of execution as all other API interactions with the protonEngine
. The execution can be queued or it could be run immediately so long as the execution occurs on the thread that has exclusive access to the engine.- Parameters:
command
- theRunnable
instance to execute.- Throws:
NullPointerException
- if the given command is null.RejectedExecutionException
- if the command cannot be run for some reason.
-
schedule
Schedule the givenRunnable
for execution after the given delay.- Parameters:
command
- The runnable action to scheduledelay
- The time value to wait before running the command.unit
- The time unit that define the units of the delay value.- Returns:
- a
Future
instance that can be awaited for completion of the task. - Throws:
NullPointerException
- if the given command is null.RejectedExecutionException
- if the command cannot be run for some reason.
-
schedule
Schedule the given task for execution after the given delay.- Type Parameters:
V
- The return type of the task- Parameters:
task
- The callable action action to scheduledelay
- The time value to wait before running the command.unit
- The time unit that define the units of the delay value.- Returns:
- a
Future
instance that can be awaited for completion of the task.
-
scheduleAtFixedRate
Schedule the given task for execution after the given delay to repeat with the given period.- Parameters:
command
- The runnable command to execute at the specified rate.initialDelay
- The initial delay before running the given command.period
- The time period in which to execute the given commandunit
- The units of the specified time period- Returns:
- a
Future
instance that can be awaited for completion of the task. - Throws:
NullPointerException
- if the given command is null.RejectedExecutionException
- if the command cannot be run for some reason.
-
scheduleWithFixedDelay
Schedule the given task for execution after the given delay to repeat with the given period.- Parameters:
command
- The runnable command to execute at the specified rate.initialDelay
- The initial delay before running the given command.delay
- The delay time between runs of the given command.unit
- The units of the specified time period- Returns:
- a
Future
instance that can be awaited for completion of the task. - Throws:
NullPointerException
- if the given command is null.RejectedExecutionException
- if the command cannot be run for some reason.
-