EventExecutors that want to support scheduling.
| Modifier and Type | Class and Description |
|---|---|
| private static class | |
| pack-priv static interface |
| Modifier and Type | Field and Description |
|---|---|
| private static final AbstractScheduledEventExecutor. | |
| private static final Comparator | |
| private PriorityQueue | |
| pack-priv static final long |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| private <V> void | |
| protected final void | |
| pack-priv static long | |
| pack-priv static long | |
| protected long | |
| protected final boolean | |
| protected static long | Returns: initial value used for delay and computations based upon a monatomic time source.The initial value used for delay and computations based upon a monatomic time source. |
| private static boolean | |
| public static long | |
| protected static <V> RunnableScheduledFuture | newRunnableScheduledFuture(AbstractScheduledEventExecutor executor, Promise<V> promise, Callable<V> task, long deadlineNanos, long periodNanos)
Returns a new |
| protected <V> RunnableScheduledFuture | newScheduledTaskFor(Callable<V> callable, long deadlineNanos, long period)
Returns a |
| protected final long | nextScheduledTaskNano()
Return the nanoseconds when the next scheduled task is ready to be run or |
| pack-priv final RunnableScheduledFuture | |
| protected final RunnableScheduledFuture | |
| protected final RunnableScheduledFuture | pollScheduledTask(long nanoTime)
Return the |
| pack-priv final void | |
| public Future | schedule(Runnable
The task that should be executed in this command, long EventExecutorGroup after the given delay.A positive time delay, in the given time unit. delay, TimeUnit The non-null time unit for the delay. unit)Implements io. EventExecutor
in this group, and return a future that produces a null result when the task completes.
|
| public <V> Future | schedule(Callable<V>
The task that should be executed in this callable, long EventExecutorGroup after the given delay.A positive time delay, in the given time unit. delay, TimeUnit The non-null time unit for the delay. unit)Implements io. EventExecutor
in this group, and return a future that will return the result of the callable when the task completes.
|
| protected final <V> Future | |
| public Future | scheduleAtFixedRate(Runnable
The task that should be scheduled to execute at a fixed rate in this command, long EventExecutorGroup.The positive initial delay for the first task execution, in terms of the given time unit. initialDelay, long The positive period for the execution frequency to use after the first execution has started,
in terms of the given time unit. period, TimeUnit The non-null time unit for the delay and period. unit)Implements io. EventExecutor.
|
| pack-priv PriorityQueue | |
| public Future | scheduleWithFixedDelay(Runnable
The task that should be scheduled to execute with fixed delays in this command, long EventExecutorGroup.The positive initial delay for the first task execution, in terms of the given time unit. initialDelay, long The positive subsequent delay between task, to use after the first execution has completed,
in terms of the given time unit. delay, TimeUnit The non-null time unit for the delays. unit)Implements io. EventExecutor.
|
| EMPTY_RUNNABLE_SCHEDULED_FUTURE_NODES | back to summary |
|---|---|
| private static final AbstractScheduledEventExecutor. | |
| SCHEDULED_FUTURE_TASK_COMPARATOR | back to summary |
|---|---|
| private static final Comparator<AbstractScheduledEventExecutor. | |
| scheduledTaskQueue | back to summary |
|---|---|
| private PriorityQueue<AbstractScheduledEventExecutor. | |
| START_TIME | back to summary |
|---|---|
| pack-priv static final long START_TIME | |
| AbstractScheduledEventExecutor | back to summary |
|---|---|
| protected AbstractScheduledEventExecutor() | |
| add0 | back to summary |
|---|---|
| private <V> void add0(RunnableScheduledFuture<V> task) | |
| cancelScheduledTasks | back to summary |
|---|---|
| protected final void cancelScheduledTasks() Cancel all scheduled tasks.
This method MUST be called only when | |
| deadlineNanos | back to summary |
|---|---|
| pack-priv static long deadlineNanos(long nanoTime, long delay) | |
| defaultCurrentTimeNanos | back to summary |
|---|---|
| pack-priv static long defaultCurrentTimeNanos() | |
| getCurrentTimeNanos | back to summary |
|---|---|
| protected long getCurrentTimeNanos() Get the current time in nanoseconds by this executor's clock. This is not the same as
| |
| hasScheduledTasks | back to summary |
|---|---|
| protected final boolean hasScheduledTasks() Returns
This method MUST be called only when | |
| initialNanoTime | back to summary |
|---|---|
| protected static long initialNanoTime() The initial value used for delay and computations based upon a monatomic time source.
| |
| isNullOrEmpty | back to summary |
|---|---|
| private static boolean isNullOrEmpty(Queue<AbstractScheduledEventExecutor. | |
| nanoTime | back to summary |
|---|---|
| public static long nanoTime() The time elapsed since initialization of this class in nanoseconds. This may return a negative number just like
| |
| newRunnableScheduledFuture | back to summary |
|---|---|
| protected static <V> RunnableScheduledFuture Returns a new
This can be used if you want to override | |
| newScheduledTaskFor | back to summary |
|---|---|
| protected <V> RunnableScheduledFuture Returns a | |
| nextScheduledTaskNano | back to summary |
|---|---|
| protected final long nextScheduledTaskNano() Return the nanoseconds when the next scheduled task is ready to be run or
This method MUST be called only when | |
| peekScheduledTask | back to summary |
|---|---|
| pack-priv final RunnableScheduledFuture | |
| pollScheduledTask | back to summary |
|---|---|
protected final RunnableScheduledFuture
| |
| pollScheduledTask | back to summary |
|---|---|
| protected final RunnableScheduledFuture Return the
This method MUST be called only when | |
| removeScheduled | back to summary |
|---|---|
| pack-priv final void removeScheduled(final AbstractScheduledEventExecutor. | |
| schedule | back to summary |
|---|---|
| public Future Implements io. Doc from io. Schedule the given task for execution after the given delay, in the next available
| |
| schedule | back to summary |
|---|---|
| public <V> Future Implements io. Doc from io. Schedule the given task for execution after the given delay, in the next available
| |
| schedule | back to summary |
|---|---|
| protected final <V> Future Add the | |
| scheduleAtFixedRate | back to summary |
|---|---|
| public Future Implements io. Doc from io. Schedule the given task for periodic execution in the next available The task will be executed repeatedly until it either fails with an exception, or its future is cancelled. The future thus will never complete successfully.
| |
| scheduledTaskQueue | back to summary |
|---|---|
| pack-priv PriorityQueue | |
| scheduleWithFixedDelay | back to summary |
|---|---|
| public Future Implements io. Doc from io. Schedule the given task for periodic execution in the next available
This is in contrast to The task will be executed repeatedly until it either fails with an exception, or its future is cancelled. The future thus will never complete successfully.
| |
| Modifier and Type | Field and Description |
|---|---|
| private final RunnableScheduledFuture | |
| private int |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public RunnableScheduledFuture | addListener(FutureListener<? super V>
The listener to be called when this future completes. The listener will be passed this future as
an argument. listener)Implements io. |
| public <C> RunnableScheduledFuture | addListener(C
The context object that will be passed to the listener when this future completes. context, FutureContextListener<? super C, ? super V> The listener to be called when this future completes. The listener will be passed the given
context, and this future. listener)Implements io. |
| public FutureCompletionStage | asStage()
Implements io. FutureCompletionStage that reflects the state of this Future and so will receive all
updates as well.
|
| public boolean | cancel()
Implements io. |
| public Throwable | cause()
Implements io. |
| public int | compareTo(RunnableScheduledFuture<?>
the object to be compared. o)Implements java. |
| public long | deadlineNanos()
Implements io. run() method should be called again.
|
| public long | delayNanos()
Implements io. run() method should be called again.
|
| public long | delayNanos(long currentTimeNanos)
Implements io. currentTimeNanos into account) when the
run() method should be called again.
|
| public EventExecutor | executor()
Implements io. EventExecutor that is tied to this Promise or Future.
|
| public V | getNow()
Implements io. |
| public boolean | isCancellable()
Implements io. true if and only if the operation can be cancelled via cancel().
|
| public boolean | isCancelled()
Implements io. true if this operation has been cancelled.
|
| public boolean | isDone()
Implements io. true if this operation has been completed either successfully, unsuccessfully, or through
cancellation.
|
| public boolean | isFailed()
Implements io. true if and only if the operation was completed and failed.
|
| public boolean | isPeriodic()
Implements io. true if the task is periodic, which means it may be executed multiple times, as opposed to a
delayed task or a normal task, that only execute once.
|
| public boolean | isSuccess()
Implements io. true if and only if the operation was completed successfully.
|
| public int | priorityQueueIndex(DefaultPriorityQueue<?> queue)
Implements io. priorityQueueIndex(DefaultPriorityQueue, int) for the value corresponding to
queue.
|
| public void | priorityQueueIndex(DefaultPriorityQueue<?>
The queue for which the index is being set. queue, int The index as used by i)DefaultPriorityQueue.Implements io. DefaultPriorityQueue to maintain state for an element in the queue.
|
| public void |
| future | back to summary |
|---|---|
| private final RunnableScheduledFuture<V> future | |
| queueIndex | back to summary |
|---|---|
| private int queueIndex | |
| DefaultRunnableScheduledFutureNode | back to summary |
|---|---|
| pack-priv DefaultRunnableScheduledFutureNode(RunnableScheduledFuture<V> future) | |
| addListener | back to summary |
|---|---|
| public RunnableScheduledFuture Implements io. Doc from io. Adds the specified listener to this future. The specified listener is notified when this future is done. If this future is already completed, the specified listener is notified immediately.
| |
| addListener | back to summary |
|---|---|
| public <C> RunnableScheduledFuture Implements io. Doc from io. Adds the specified listener to this future. The specified listener is notified when this future is done. If this future is already completed, the specified listener is notified immediately.
| |
| asStage | back to summary |
|---|---|
| public FutureCompletionStage Implements io. Doc from io. Returns a
The returned
| |
| cancel | back to summary |
|---|---|
| public boolean cancel() Implements io. Doc from io. Cancel this asynchronous operation, unless it has already been completed or is not cancellable. A cancelled operation is considered to be done and failed.
If the cancellation was successful, the result of this operation will be that it has failed with a
Cancellation will not cause any threads working on the operation to be interrupted.
| |
| cause | back to summary |
|---|---|
| public Throwable cause() Implements io. Doc from io. Returns the cause of the failed operation if the operation has failed. | |
| compareTo | back to summary |
|---|---|
| public int compareTo(RunnableScheduledFuture<?> o) Implements java. Doc from java. Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object. The implementor must ensure The implementor must also ensure that the relation is transitive:
Finally, the implementor must ensure that
| |
| deadlineNanos | back to summary |
|---|---|
| public long deadlineNanos() Implements io. Doc from io. Returns the deadline in nanos when the
| |
| delayNanos | back to summary |
|---|---|
| public long delayNanos() Implements io. Doc from io. Returns the delay in nanos when the
| |
| delayNanos | back to summary |
|---|---|
| public long delayNanos(long currentTimeNanos) Implements io. Doc from io. Returns the delay in nanos (taking the given
| |
| executor | back to summary |
|---|---|
| public EventExecutor executor() Implements io. Doc from io. Returns the
| |
| getNow | back to summary |
|---|---|
| public V getNow() Implements io. Doc from io. Return the successful result of this asynchronous operation, if any.
If the operation has not yet been completed, then this will throw
| |
| isCancellable | back to summary |
|---|---|
| public boolean isCancellable() Implements io. Doc from io. Returns
| |
| isCancelled | back to summary |
|---|---|
| public boolean isCancelled() Implements io. Doc from io. Return
| |
| isDone | back to summary |
|---|---|
| public boolean isDone() Implements io. Doc from io. Return
| |
| isFailed | back to summary |
|---|---|
| public boolean isFailed() Implements io. Doc from io. Returns
| |
| isPeriodic | back to summary |
|---|---|
| public boolean isPeriodic() Implements io. Doc from io. Return
| |
| isSuccess | back to summary |
|---|---|
| public boolean isSuccess() Implements io. Doc from io. Returns
| |
| priorityQueueIndex | back to summary |
|---|---|
| public int priorityQueueIndex(DefaultPriorityQueue<?> queue) Implements io. Doc from io. Get the last value set by Throwing exceptions from this method will result in undefined behavior.
| |
| priorityQueueIndex | back to summary |
|---|---|
| public void priorityQueueIndex(DefaultPriorityQueue<?> queue, int i) Implements io. Doc from io. Used by Throwing exceptions from this method will result in undefined behavior.
| |
| run | back to summary |
|---|---|
| public void run() Implements java. Doc from java. Runs this operation.
| |