Top Fields Constructors Methods
io.netty5.util.concurrent

pack-priv final Class RunnableScheduledFutureAdapter<V>

extends Object
implements AbstractScheduledEventExecutor.RunnableScheduledFutureNode<V>
Class Inheritance
All Implemented Interfaces
io.netty5.util.concurrent.AbstractScheduledEventExecutor.RunnableScheduledFutureNode, io.netty5.util.concurrent.RunnableScheduledFuture, java.lang.Comparable, io.netty5.util.concurrent.RunnableFuture, io.netty5.util.concurrent.Future, io.netty5.util.concurrent.AsynchronousResult, java.lang.Runnable, io.netty5.util.internal.PriorityQueueNode
Imports
io.netty5.util.internal.DefaultPriorityQueue, .StringUtil, java.util.concurrent.Callable, java.util.concurrent.atomic.AtomicLong

Field Summary

Modifier and TypeField and Description
private final Callable<V>
private long
private final AbstractScheduledEventExecutor
private final Future<V>
private final long
private static final AtomicLong
private final long
private final Promise<V>
private int

Constructor Summary

AccessConstructor and Description
pack-priv
RunnableScheduledFutureAdapter(AbstractScheduledEventExecutor executor, Promise<V> promise, Callable<V> callable, long deadlineNanos, long periodNanos)

Method Summary

Modifier and TypeMethod and Description
public RunnableScheduledFuture<V>
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.netty5.util.concurrent.RunnableScheduledFuture.addListener.

Adds the specified listener to this future.
public <C> RunnableScheduledFuture<V>
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.netty5.util.concurrent.RunnableScheduledFuture.addListener.

Adds the specified listener to this future.
public FutureCompletionStage<V>
asStage()

Implements io.netty5.util.concurrent.Future.asStage.

Returns a FutureCompletionStage that reflects the state of this Future and so will receive all updates as well.
public boolean
cancel()

Implements io.netty5.util.concurrent.AsynchronousResult.cancel.

Cancel this asynchronous operation, unless it has already been completed or is not cancellable.
public Throwable
cause()

Implements io.netty5.util.concurrent.AsynchronousResult.cause.

Returns the cause of the failed operation if the operation has failed.
public int
compareTo(RunnableScheduledFuture<?>
the object to be compared.
o
)

Implements java.lang.Comparable.compareTo.

Compares this object with the specified object for order.
public long
deadlineNanos()

Implements io.netty5.util.concurrent.RunnableScheduledFuture.deadlineNanos.

Returns the deadline in nanos when the run() method should be called again.
private static long
deadlineToDelayNanos(long currentTimeNanos, long deadlineNanos)

public long
delayNanos()

Implements io.netty5.util.concurrent.RunnableScheduledFuture.delayNanos.

Returns the delay in nanos when the run() method should be called again.
public long
delayNanos(long currentTimeNanos)

Implements io.netty5.util.concurrent.RunnableScheduledFuture.delayNanos.

Returns the delay in nanos (taking the given currentTimeNanos into account) when the run() method should be called again.
public boolean
equals(Object
the reference object with which to compare.
obj
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
public EventExecutor
public V
getNow()

Implements io.netty5.util.concurrent.AsynchronousResult.getNow.

Return the successful result of this asynchronous operation, if any.
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for the object.
public boolean
isCancellable()

Implements io.netty5.util.concurrent.AsynchronousResult.isCancellable.

Returns true if and only if the operation can be cancelled via cancel().
public boolean
isCancelled()

Implements io.netty5.util.concurrent.AsynchronousResult.isCancelled.

Return true if this operation has been cancelled.
public boolean
isDone()

Implements io.netty5.util.concurrent.AsynchronousResult.isDone.

Return true if this operation has been completed either successfully, unsuccessfully, or through cancellation.
public boolean
isFailed()

Implements io.netty5.util.concurrent.AsynchronousResult.isFailed.

Returns true if and only if the operation was completed and failed.
public boolean
isPeriodic()

Implements io.netty5.util.concurrent.RunnableScheduledFuture.isPeriodic.

Return 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.netty5.util.concurrent.AsynchronousResult.isSuccess.

Returns true if and only if the operation was completed successfully.
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.netty5.util.internal.PriorityQueueNode.priorityQueueIndex.

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

Implements java.lang.Runnable.run.

Runs this operation.
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

callableback to summary
private final Callable<V> callable
deadlineNanosback to summary
private long deadlineNanos
executorback to summary
private final AbstractScheduledEventExecutor executor
futureback to summary
private final Future<V> future
idback to summary
private final long id
NEXT_TASK_IDback to summary
private static final AtomicLong NEXT_TASK_ID
periodNanosback to summary
private final long periodNanos
promiseback to summary
private final Promise<V> promise
queueIndexback to summary
private int queueIndex

Constructor Detail

RunnableScheduledFutureAdapterback to summary
pack-priv RunnableScheduledFutureAdapter(AbstractScheduledEventExecutor executor, Promise<V> promise, Callable<V> callable, long deadlineNanos, long periodNanos)

Method Detail

addListenerback to summary
public RunnableScheduledFuture<V> addListener(FutureListener<? super V> listener)

Implements io.netty5.util.concurrent.RunnableScheduledFuture.addListener.

Doc from io.netty5.util.concurrent.Future.addListener.

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.

Parameters
listener:FutureListener<? super V>

The listener to be called when this future completes. The listener will be passed this future as an argument.

Returns:RunnableScheduledFuture<V>

this future object.

Annotations
@Override
addListenerback to summary
public <C> RunnableScheduledFuture<V> addListener(C context, FutureContextListener<? super C, ? super V> listener)

Implements io.netty5.util.concurrent.RunnableScheduledFuture.addListener.

Doc from io.netty5.util.concurrent.Future.addListener.

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.

Parameters
context:C

The context object that will be passed to the listener when this future completes.

listener: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.

Returns:RunnableScheduledFuture<V>

this future object.

Annotations
@Override
asStageback to summary
public FutureCompletionStage<V> asStage()

Implements io.netty5.util.concurrent.Future.asStage.

Doc from io.netty5.util.concurrent.Future.asStage.

Returns a FutureCompletionStage that reflects the state of this Future and so will receive all updates as well.

The returned FutureCompletionStage also implements the JDK java.util.concurrent.Future, and has blocking methods not found on the Netty Future interface, for awaiting the completion.

Annotations
@Override
cancelback to summary
public boolean cancel()

Implements io.netty5.util.concurrent.AsynchronousResult.cancel.

Doc from io.netty5.util.concurrent.AsynchronousResult.cancel.

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 CancellationException.

Cancellation will not cause any threads working on the operation to be interrupted.

Returns:boolean

true if the operation was cancelled by this call, otherwise false.

Annotations
@Override
causeback to summary
public Throwable cause()

Implements io.netty5.util.concurrent.AsynchronousResult.cause.

Doc from io.netty5.util.concurrent.AsynchronousResult.cause.

Returns the cause of the failed operation if the operation has failed.

Returns:Throwable

The cause of the failure, if any. Otherwise null if succeeded.

Annotations
@Override
compareToback to summary
public int compareTo(RunnableScheduledFuture<?> 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:RunnableScheduledFuture<?>

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()

Implements io.netty5.util.concurrent.RunnableScheduledFuture.deadlineNanos.

Doc from io.netty5.util.concurrent.RunnableScheduledFuture.deadlineNanos.

Returns the deadline in nanos when the run() method should be called again.

Annotations
@Override
deadlineToDelayNanosback to summary
private static long deadlineToDelayNanos(long currentTimeNanos, long deadlineNanos)
delayNanosback to summary
public long delayNanos()

Implements io.netty5.util.concurrent.RunnableScheduledFuture.delayNanos.

Doc from io.netty5.util.concurrent.RunnableScheduledFuture.delayNanos.

Returns the delay in nanos when the run() method should be called again.

Annotations
@Override
delayNanosback to summary
public long delayNanos(long currentTimeNanos)

Implements io.netty5.util.concurrent.RunnableScheduledFuture.delayNanos.

Doc from io.netty5.util.concurrent.RunnableScheduledFuture.delayNanos.

Returns the delay in nanos (taking the given currentTimeNanos into account) when the run() method should be called again.

Annotations
@Override
equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
obj:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
executorback to summary
public EventExecutor executor()

Implements io.netty5.util.concurrent.AsynchronousResult.executor.

Doc from io.netty5.util.concurrent.AsynchronousResult.executor.

Returns the EventExecutor that is tied to this Promise or Future.

Annotations
@Override
getNowback to summary
public V getNow()

Implements io.netty5.util.concurrent.AsynchronousResult.getNow.

Doc from io.netty5.util.concurrent.AsynchronousResult.getNow.

Return the successful result of this asynchronous operation, if any. If the operation has not yet been completed, then this will throw IllegalStateException. If the operation has been cancelled or failed with an exception, then this returns null. Note that asynchronous operations can also be completed successfully with a null result.

Returns:V

the result of this operation, if completed successfully.

Annotations
@Override
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object.

Annotations
@Override
isCancellableback to summary
public boolean isCancellable()

Implements io.netty5.util.concurrent.AsynchronousResult.isCancellable.

Doc from io.netty5.util.concurrent.AsynchronousResult.isCancellable.

Returns true if and only if the operation can be cancelled via cancel(). Note that this is inherently racy, as the operation could be made uncancellable at any time.

Returns:boolean

true if this operation can be cancelled.

Annotations
@Override
isCancelledback to summary
public boolean isCancelled()

Implements io.netty5.util.concurrent.AsynchronousResult.isCancelled.

Doc from io.netty5.util.concurrent.AsynchronousResult.isCancelled.

Return true if this operation has been cancelled.

Returns:boolean

true if this operation has been cancelled, otherwise false.

Annotations
@Override
isDoneback to summary
public boolean isDone()

Implements io.netty5.util.concurrent.AsynchronousResult.isDone.

Doc from io.netty5.util.concurrent.AsynchronousResult.isDone.

Return true if this operation has been completed either successfully, unsuccessfully, or through cancellation.

Returns:boolean

true if this operation has completed, otherwise false.

Annotations
@Override
isFailedback to summary
public boolean isFailed()

Implements io.netty5.util.concurrent.AsynchronousResult.isFailed.

Doc from io.netty5.util.concurrent.AsynchronousResult.isFailed.

Returns true if and only if the operation was completed and failed.

Annotations
@Override
isPeriodicback to summary
public boolean isPeriodic()

Implements io.netty5.util.concurrent.RunnableScheduledFuture.isPeriodic.

Doc from io.netty5.util.concurrent.RunnableScheduledFuture.isPeriodic.

Return 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.

Returns:boolean

true if this task is periodic, otherwise false.

Annotations
@Override
isSuccessback to summary
public boolean isSuccess()

Implements io.netty5.util.concurrent.AsynchronousResult.isSuccess.

Doc from io.netty5.util.concurrent.AsynchronousResult.isSuccess.

Returns true if and only if the operation was completed successfully.

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

Implements io.netty5.util.internal.PriorityQueueNode.priorityQueueIndex.

Doc from io.netty5.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.netty5.util.internal.PriorityQueueNode.priorityQueueIndex.

Doc from io.netty5.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()

Implements java.lang.Runnable.run.

Doc from java.lang.Runnable.run.

Runs this operation.

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override