Top Fields Constructors Methods
io.netty.util.concurrent

pack-priv final Class ScheduledFutureTask<V>

extends PromiseTask<V>
implements ScheduledFuture<V>, PriorityQueueNode
Class Inheritance
All Implemented Interfaces
io.netty.util.internal.PriorityQueueNode, io.netty.util.concurrent.ScheduledFuture, java.util.concurrent.ScheduledFuture, java.util.concurrent.Future, java.util.concurrent.Delayed, java.lang.Comparable, io.netty.util.concurrent.Future
Annotations
@SuppressWarnings:ComparableImplementedButEqualsNotOverridden
Imports
io.netty.util.internal.DefaultPriorityQueue, .PriorityQueueNode, java.util.concurrent.Callable, .Delayed, .TimeUnit

Field Summary

Modifier and TypeField and Description
private long
private long
private final long
private int

Constructor Summary

AccessConstructor and Description
pack-priv
ScheduledFutureTask(AbstractScheduledEventExecutor executor, Runnable runnable, long nanoTime)

pack-priv
ScheduledFutureTask(AbstractScheduledEventExecutor executor, Runnable runnable, long nanoTime, long period)

pack-priv
ScheduledFutureTask(AbstractScheduledEventExecutor executor, Callable<V> callable, long nanoTime, long period)

pack-priv
ScheduledFutureTask(AbstractScheduledEventExecutor executor, Callable<V> callable, long nanoTime)

Method Summary

Modifier and TypeMethod and Description
public boolean
cancel(boolean
this value has no effect in this implementation.
mayInterruptIfRunning
)

Overrides io.netty.util.concurrent.PromiseTask.cancel.

Implements io.netty.util.concurrent.Future.cancel, java.util.concurrent.Future.cancel.

Attempts to cancel execution of this task.
pack-priv boolean
cancelWithoutRemove(boolean mayInterruptIfRunning)

public int
compareTo(Delayed
the object to be compared.
o
)

Implements java.lang.Comparable.compareTo.

Compares this object with the specified object for order.
public long
pack-priv static long
deadlineToDelayNanos(long currentTimeNanos, long deadlineNanos)

public long
public long
delayNanos(long currentTimeNanos)

protected EventExecutor
executor()

Overrides io.netty.util.concurrent.DefaultPromise.executor.

Get the executor used to notify listeners when this promise is complete.
public long
getDelay(TimeUnit
the time unit
unit
)

Implements java.util.concurrent.Delayed.getDelay.

Returns the remaining delay associated with this object, in the given time unit.
public int
public void
priorityQueueIndex(DefaultPriorityQueue<?>
The queue for which the index is being set.
queue
,
int
The index as used by DefaultPriorityQueue.
i
)

Implements io.netty.util.internal.PriorityQueueNode.priorityQueueIndex.

Used by DefaultPriorityQueue to maintain state for an element in the queue.
public void
run()

Overrides io.netty.util.concurrent.PromiseTask.run.

Implements java.util.concurrent.RunnableFuture.run.

Sets this Future to the result of its computation unless it has been cancelled.
private AbstractScheduledEventExecutor
pack-priv void
pack-priv ScheduledFutureTask<V>
setId(long id)

protected StringBuilder
private static long
validatePeriod(long period)

Inherited from io.netty.util.concurrent.PromiseTask:
equalshashCoderunTasksetFailuresetFailureInternalsetSuccesssetSuccessInternalsetUncancellablesetUncancellableInternaltryFailuretryFailureInternaltrySuccesstrySuccessInternal

Field Detail

deadlineNanosback to summary
private long deadlineNanos
idback to summary
private long id
periodNanosback to summary
private final long periodNanos
queueIndexback to summary
private int queueIndex

Constructor Detail

ScheduledFutureTaskback to summary
pack-priv ScheduledFutureTask(AbstractScheduledEventExecutor executor, Runnable runnable, long nanoTime)
ScheduledFutureTaskback to summary
pack-priv ScheduledFutureTask(AbstractScheduledEventExecutor executor, Runnable runnable, long nanoTime, long period)
ScheduledFutureTaskback to summary
pack-priv ScheduledFutureTask(AbstractScheduledEventExecutor executor, Callable<V> callable, long nanoTime, long period)
ScheduledFutureTaskback to summary
pack-priv ScheduledFutureTask(AbstractScheduledEventExecutor executor, Callable<V> callable, long nanoTime)

Method Detail

cancelback to summary
public boolean cancel(boolean mayInterruptIfRunning)

Overrides io.netty.util.concurrent.PromiseTask.cancel.

Implements io.netty.util.concurrent.Future.cancel, java.util.concurrent.Future.cancel.

Doc from io.netty.util.concurrent.Future.cancel.

Attempts to cancel execution of this task. This method has no effect if the task is already completed or cancelled, or could not be cancelled for some other reason. Otherwise, if this task has not started when cancel is called, this task should never run. If the task has already started, then the mayInterruptIfRunning parameter determines whether the thread executing this task (when known by the implementation) is interrupted in an attempt to stop the task.

The return value from this method does not necessarily indicate whether the task is now cancelled; use isCancelled. If the cancellation was successful it will fail the future with a CancellationException.

Parameters
mayInterruptIfRunning:boolean

this value has no effect in this implementation.

Returns:boolean

Doc from java.util.concurrent.Future.cancel.

false if the task could not be cancelled, typically because it has already completed; true otherwise. If two or more threads cause a task to be cancelled, then at least one of them returns true. Implementations may provide stronger guarantees.

Annotations
@Override
cancelWithoutRemoveback to summary
pack-priv boolean cancelWithoutRemove(boolean mayInterruptIfRunning)
compareToback to summary
public int compareTo(Delayed o)

Implements java.lang.Comparable.compareTo.

Doc from java.lang.Comparable.compareTo.

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 signum(x.compareTo(y)) == -signum(y.compareTo(x)) for all x and y. (This implies that x.compareTo(y) must throw an exception if and only if y.compareTo(x) throws an exception.)

The implementor must also ensure that the relation is transitive: (x.compareTo(y) > 0 && y.compareTo(z) > 0) implies x.compareTo(z) > 0.

Finally, the implementor must ensure that x.compareTo(y)==0 implies that signum(x.compareTo(z)) == signum(y.compareTo(z)), for all z.

Parameters
o:Delayed

the object to be compared.

Returns:int

a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

Annotations
@Override
deadlineNanosback to summary
public long deadlineNanos()
deadlineToDelayNanosback to summary
pack-priv static long deadlineToDelayNanos(long currentTimeNanos, long deadlineNanos)
delayNanosback to summary
public long delayNanos()
delayNanosback to summary
public long delayNanos(long currentTimeNanos)
executorback to summary
protected EventExecutor executor()

Overrides io.netty.util.concurrent.DefaultPromise.executor.

Doc from io.netty.util.concurrent.DefaultPromise.executor.

Get the executor used to notify listeners when this promise is complete.

It is assumed this executor will protect against StackOverflowError exceptions. The executor may be used to avoid StackOverflowError by executing a Runnable if the stack depth exceeds a threshold.

Returns:EventExecutor

The executor used to notify listeners when this promise is complete.

Annotations
@Override
getDelayback to summary
public long getDelay(TimeUnit unit)

Implements java.util.concurrent.Delayed.getDelay.

Doc from java.util.concurrent.Delayed.getDelay.

Returns the remaining delay associated with this object, in the given time unit.

Parameters
unit:TimeUnit

the time unit

Returns:long

the remaining delay; zero or negative values indicate that the delay has already elapsed

Annotations
@Override
priorityQueueIndexback to summary
public int priorityQueueIndex(DefaultPriorityQueue<?> queue)

Implements io.netty.util.internal.PriorityQueueNode.priorityQueueIndex.

Doc from io.netty.util.internal.PriorityQueueNode.priorityQueueIndex.

Get the last value set by priorityQueueIndex(DefaultPriorityQueue, int) for the value corresponding to queue.

Throwing exceptions from this method will result in undefined behavior.

Annotations
@Override
priorityQueueIndexback to summary
public void priorityQueueIndex(DefaultPriorityQueue<?> queue, int i)

Implements io.netty.util.internal.PriorityQueueNode.priorityQueueIndex.

Doc from io.netty.util.internal.PriorityQueueNode.priorityQueueIndex.

Used by DefaultPriorityQueue to maintain state for an element in the queue.

Throwing exceptions from this method will result in undefined behavior.

Parameters
queue:DefaultPriorityQueue<?>

The queue for which the index is being set.

i:int

The index as used by DefaultPriorityQueue.

Annotations
@Override
runback to summary
public void run()

Overrides io.netty.util.concurrent.PromiseTask.run.

Implements java.util.concurrent.RunnableFuture.run.

Doc from java.util.concurrent.RunnableFuture.run.

Sets this Future to the result of its computation unless it has been cancelled.

Annotations
@Override
scheduledExecutorback to summary
private AbstractScheduledEventExecutor scheduledExecutor()
setConsumedback to summary
pack-priv void setConsumed()
setIdback to summary
pack-priv ScheduledFutureTask<V> setId(long id)
toStringBuilderback to summary
protected StringBuilder toStringBuilder()

Overrides io.netty.util.concurrent.PromiseTask.toStringBuilder.

Annotations
@Override
validatePeriodback to summary
private static long validatePeriod(long period)