Package io.netty.util.concurrent
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,java.lang.Comparable<java.util.concurrent.Delayed>,java.lang.Runnable,java.util.concurrent.Delayed,java.util.concurrent.Future<V>,java.util.concurrent.RunnableFuture<V>,java.util.concurrent.ScheduledFuture<V>
final class ScheduledFutureTask<V> extends PromiseTask<V> implements ScheduledFuture<V>, PriorityQueueNode
-
-
Field Summary
Fields Modifier and Type Field Description private longdeadlineNanosprivate longidprivate longperiodNanosprivate intqueueIndexprivate static longSTART_TIME-
Fields inherited from interface io.netty.util.internal.PriorityQueueNode
INDEX_NOT_IN_QUEUE
-
-
Constructor Summary
Constructors Constructor Description ScheduledFutureTask(AbstractScheduledEventExecutor executor, java.lang.Runnable runnable, long nanoTime)ScheduledFutureTask(AbstractScheduledEventExecutor executor, java.lang.Runnable runnable, long nanoTime, long period)ScheduledFutureTask(AbstractScheduledEventExecutor executor, java.util.concurrent.Callable<V> callable, long nanoTime)ScheduledFutureTask(AbstractScheduledEventExecutor executor, java.util.concurrent.Callable<V> callable, long nanoTime, long period)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancancel(boolean mayInterruptIfRunning)If the cancellation was successful it will fail the future with aCancellationException.(package private) booleancancelWithoutRemove(boolean mayInterruptIfRunning)intcompareTo(java.util.concurrent.Delayed o)longdeadlineNanos()(package private) static longdeadlineNanos(long delay)(package private) static longdeadlineToDelayNanos(long deadlineNanos)longdelayNanos()longdelayNanos(long currentTimeNanos)protected EventExecutorexecutor()Get the executor used to notify listeners when this promise is complete.longgetDelay(java.util.concurrent.TimeUnit unit)(package private) static longinitialNanoTime()(package private) static longnanoTime()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 AbstractScheduledEventExecutorscheduledExecutor()(package private) voidsetConsumed()(package private) ScheduledFutureTask<V>setId(long id)protected java.lang.StringBuildertoStringBuilder()private static longvalidatePeriod(long period)-
Methods inherited from class io.netty.util.concurrent.PromiseTask
equals, hashCode, runTask, setFailure, setFailureInternal, setSuccess, setSuccessInternal, setUncancellable, setUncancellableInternal, tryFailure, tryFailureInternal, trySuccess, trySuccessInternal
-
Methods inherited from class io.netty.util.concurrent.DefaultPromise
addListener, addListeners, await, await, await, awaitUninterruptibly, awaitUninterruptibly, awaitUninterruptibly, cause, checkDeadLock, get, get, getNow, isCancellable, isCancelled, isDone, isSuccess, notifyListener, notifyProgressiveListeners, removeListener, removeListeners, sync, syncUninterruptibly, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface io.netty.util.concurrent.Future
await, await, awaitUninterruptibly, awaitUninterruptibly, cause, getNow, isCancellable, isSuccess
-
-
-
-
Constructor Detail
-
ScheduledFutureTask
ScheduledFutureTask(AbstractScheduledEventExecutor executor, java.lang.Runnable runnable, long nanoTime)
-
ScheduledFutureTask
ScheduledFutureTask(AbstractScheduledEventExecutor executor, java.lang.Runnable runnable, long nanoTime, long period)
-
ScheduledFutureTask
ScheduledFutureTask(AbstractScheduledEventExecutor executor, java.util.concurrent.Callable<V> callable, long nanoTime, long period)
-
ScheduledFutureTask
ScheduledFutureTask(AbstractScheduledEventExecutor executor, java.util.concurrent.Callable<V> callable, long nanoTime)
-
-
Method Detail
-
nanoTime
static long nanoTime()
-
deadlineNanos
static long deadlineNanos(long delay)
-
initialNanoTime
static long initialNanoTime()
-
validatePeriod
private static long validatePeriod(long period)
-
setId
ScheduledFutureTask<V> setId(long id)
-
executor
protected EventExecutor 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 deadlineNanos)
-
delayNanos
public long delayNanos(long currentTimeNanos)
-
getDelay
public long getDelay(java.util.concurrent.TimeUnit unit)
- Specified by:
getDelayin interfacejava.util.concurrent.Delayed
-
compareTo
public int compareTo(java.util.concurrent.Delayed o)
- Specified by:
compareToin interfacejava.lang.Comparable<V>
-
run
public void run()
- Specified by:
runin interfacejava.lang.Runnable- Specified by:
runin interfacejava.util.concurrent.RunnableFuture<V>- Overrides:
runin classPromiseTask<V>
-
scheduledExecutor
private AbstractScheduledEventExecutor 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
protected java.lang.StringBuilder toStringBuilder()
- Overrides:
toStringBuilderin classPromiseTask<V>
-
priorityQueueIndex
public int priorityQueueIndex(DefaultPriorityQueue<?> queue)
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
public void priorityQueueIndex(DefaultPriorityQueue<?> queue, int i)
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.
-
-