Class ScheduledFutureTask<V>
java.lang.Object
io.netty.util.concurrent.AbstractFuture<V>
io.netty.util.concurrent.DefaultPromise<V>
io.netty.util.concurrent.PromiseTask<V>
io.netty.util.concurrent.ScheduledFutureTask<V>
- All Implemented Interfaces:
Future<V>, Promise<V>, ScheduledFuture<V>, PriorityQueueNode, Comparable<Delayed>, Runnable, Delayed, Future<V>, RunnableFuture<V>, ScheduledFuture<V>
final class ScheduledFutureTask<V>
extends PromiseTask<V>
implements ScheduledFuture<V>, PriorityQueueNode
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate longprivate longprivate final longprivate intFields inherited from class DefaultPromise
PROPERTY_MAX_LISTENER_STACK_DEPTHFields inherited from interface PriorityQueueNode
INDEX_NOT_IN_QUEUE -
Constructor Summary
ConstructorsConstructorDescriptionScheduledFutureTask(AbstractScheduledEventExecutor executor, Runnable runnable, long nanoTime) ScheduledFutureTask(AbstractScheduledEventExecutor executor, Runnable runnable, long nanoTime, long period) ScheduledFutureTask(AbstractScheduledEventExecutor executor, Callable<V> callable, long nanoTime) ScheduledFutureTask(AbstractScheduledEventExecutor executor, Callable<V> callable, long nanoTime, long period) -
Method Summary
Modifier and TypeMethodDescriptionbooleancancel(boolean mayInterruptIfRunning) If the cancellation was successful it will fail the future with aCancellationException.(package private) booleancancelWithoutRemove(boolean mayInterruptIfRunning) intlong(package private) static longdeadlineToDelayNanos(long currentTimeNanos, long deadlineNanos) longlongdelayNanos(long currentTimeNanos) protected EventExecutorexecutor()Get the executor used to notify listeners when this promise is complete.long(package private) longgetId()intpriorityQueueIndex(DefaultPriorityQueue<?> queue) Get the last value set byPriorityQueueNode.priorityQueueIndex(DefaultPriorityQueue, int)for the value corresponding toqueue.voidpriorityQueueIndex(DefaultPriorityQueue<?> queue, int i) Used byDefaultPriorityQueueto maintain state for an element in the queue.voidrun()private AbstractScheduledEventExecutor(package private) void(package private) ScheduledFutureTask<V> setId(long id) protected StringBuilderprivate static longvalidatePeriod(long period) Methods inherited from class PromiseTask
equals, hashCode, runTask, setFailure, setFailureInternal, setSuccess, setSuccessInternal, setUncancellable, setUncancellableInternal, tryFailure, tryFailureInternal, trySuccess, trySuccessInternalMethods inherited from class DefaultPromise
addListener, addListeners, await, await, await, awaitUninterruptibly, awaitUninterruptibly, awaitUninterruptibly, cause, checkDeadLock, get, get, getNow, isCancellable, isCancelled, isDone, isSuccess, notifyListener, notifyProgressiveListeners, removeListener, removeListeners, sync, syncUninterruptibly, toStringMethods inherited from interface Future
await, await, awaitUninterruptibly, awaitUninterruptibly, cause, getNow, isCancellable, isSuccessMethods inherited from interface Future
get, get, isCancelled, isDone
-
Field Details
-
id
private long id -
deadlineNanos
private long deadlineNanos -
periodNanos
private final long periodNanos -
queueIndex
private int queueIndex
-
-
Constructor Details
-
ScheduledFutureTask
ScheduledFutureTask(AbstractScheduledEventExecutor executor, Runnable runnable, long nanoTime) -
ScheduledFutureTask
ScheduledFutureTask(AbstractScheduledEventExecutor executor, Runnable runnable, long nanoTime, long period) -
ScheduledFutureTask
ScheduledFutureTask(AbstractScheduledEventExecutor executor, Callable<V> callable, long nanoTime, long period) -
ScheduledFutureTask
ScheduledFutureTask(AbstractScheduledEventExecutor executor, Callable<V> callable, long nanoTime)
-
-
Method Details
-
validatePeriod
private static long validatePeriod(long period) -
setId
-
getId
long getId() -
executor
Description copied from class:DefaultPromiseGet the executor used to notify listeners when this promise is complete.It is assumed this executor will protect against
StackOverflowErrorexceptions. The executor may be used to avoidStackOverflowErrorby executing aRunnableif the stack depth exceeds a threshold.- Overrides:
executorin classDefaultPromise<V>- Returns:
- The executor used to notify listeners when this promise is complete.
-
deadlineNanos
public long deadlineNanos() -
setConsumed
void setConsumed() -
delayNanos
public long delayNanos() -
deadlineToDelayNanos
static long deadlineToDelayNanos(long currentTimeNanos, long deadlineNanos) -
delayNanos
public long delayNanos(long currentTimeNanos) -
getDelay
-
compareTo
- Specified by:
compareToin interfaceComparable<V>
-
run
public void run()- Specified by:
runin interfaceRunnable- Specified by:
runin interfaceRunnableFuture<V>- Overrides:
runin classPromiseTask<V>
-
scheduledExecutor
-
cancel
public boolean cancel(boolean mayInterruptIfRunning) If the cancellation was successful it will fail the future with aCancellationException. -
cancelWithoutRemove
boolean cancelWithoutRemove(boolean mayInterruptIfRunning) -
toStringBuilder
- Overrides:
toStringBuilderin classPromiseTask<V>
-
priorityQueueIndex
Description copied from interface:PriorityQueueNodeGet the last value set byPriorityQueueNode.priorityQueueIndex(DefaultPriorityQueue, int)for the value corresponding toqueue.Throwing exceptions from this method will result in undefined behavior.
- Specified by:
priorityQueueIndexin interfacePriorityQueueNode
-
priorityQueueIndex
Description copied from interface:PriorityQueueNodeUsed byDefaultPriorityQueueto maintain state for an element in the queue.Throwing exceptions from this method will result in undefined behavior.
- Specified by:
priorityQueueIndexin interfacePriorityQueueNode- Parameters:
queue- The queue for which the index is being set.i- The index as used byDefaultPriorityQueue.
-