Top Inners Fields Constructors Methods
io.netty5.util.concurrent

pack-priv Class PromiseTask<V>

extends DefaultPromise<V>
implements RunnableFuture<V>
Class Inheritance
All Implemented Interfaces
java.util.concurrent.RunnableFuture, java.util.concurrent.Future, java.lang.Runnable
Known Direct Subclasses
io.netty5.util.concurrent.UnorderedThreadPoolEventExecutor.RunnableScheduledFutureTask
Imports
java.util.concurrent.Callable, .RunnableFuture

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
protected final Callable<V>
Inherited from io.netty5.util.concurrent.DefaultPromise:
NULL_CONTEXT

Constructor Summary

AccessConstructor and Description
pack-priv
PromiseTask(EventExecutor executor, Runnable runnable, V result)

pack-priv
PromiseTask(EventExecutor executor, Callable<V> callable)

Method Summary

Modifier and TypeMethod and Description
public boolean
cancel(boolean
true if the thread executing this task should be interrupted (if the thread is known to the implementation); otherwise, in-progress tasks are allowed to complete
mayInterruptIfRunning
)

Overrides io.netty5.util.concurrent.DefaultPromise.cancel.

Implements java.util.concurrent.Future.cancel.

Attempts to cancel execution of this task.
public final 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 final int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.
public void
run()

Implements java.util.concurrent.RunnableFuture.run.

Sets this Future to the result of its computation unless it has been cancelled.
public final Promise<V>
setFailure(Throwable cause)

Overrides io.netty5.util.concurrent.DefaultPromise.setFailure.

Implements io.netty5.util.concurrent.Promise.setFailure.

Marks this promise as a failure and notifies all listeners attached to the future.
protected final Promise<V>
public final Promise<V>
setSuccess(V result)

Overrides io.netty5.util.concurrent.DefaultPromise.setSuccess.

Implements io.netty5.util.concurrent.Promise.setSuccess.

Marks this promise as a success and notifies all listeners attached to the future.
protected final Promise<V>
public final boolean
protected final boolean
pack-priv static <T> Callable<T>
toCallable(Runnable runnable, T result)

protected StringBuilder
public final boolean
tryFailure(Throwable cause)

Overrides io.netty5.util.concurrent.DefaultPromise.tryFailure.

Implements io.netty5.util.concurrent.Promise.tryFailure.

Marks this promise as a failure and notifies all listeners.
protected final boolean
public final boolean
trySuccess(V result)

Overrides io.netty5.util.concurrent.DefaultPromise.trySuccess.

Implements io.netty5.util.concurrent.Promise.trySuccess.

Marks this future as a success and notifies all listeners.
Inherited from io.netty5.util.concurrent.DefaultPromise:
acceptEitheracceptEitherAsyncacceptEitherAsyncaddListeneraddListenerapplyToEitherapplyToEitherAsyncapplyToEitherAsyncasFutureasStageawaitawaitcancelcausecheckDeadLockcheckDeadLockexceptionallyexecutorfuturegetgetgetNowhandlehandleAsynchandleAsyncisCancellableisCancelledisDoneisFailedisSuccessnewFailedPromisenewSuccessfulPromisenotifyListener0runAfterBothrunAfterBothAsyncrunAfterBothAsyncrunAfterEitherrunAfterEitherAsyncrunAfterEitherAsyncsafeExecutesyncthenAcceptthenAcceptAsyncthenAcceptAsyncthenAcceptBoththenAcceptBothAsyncthenAcceptBothAsyncthenApplythenApplyAsyncthenApplyAsyncthenCombinethenCombineAsyncthenCombineAsyncthenComposethenComposeAsyncthenComposeAsyncthenRunthenRunAsyncthenRunAsynctoStringwhenCompletewhenCompleteAsyncwhenCompleteAsync

Field Detail

taskback to summary
protected final Callable<V> task

Constructor Detail

PromiseTaskback to summary
pack-priv PromiseTask(EventExecutor executor, Runnable runnable, V result)
PromiseTaskback to summary
pack-priv PromiseTask(EventExecutor executor, Callable<V> callable)

Method Detail

cancelback to summary
public boolean cancel(boolean mayInterruptIfRunning)

Overrides io.netty5.util.concurrent.DefaultPromise.cancel.

Implements java.util.concurrent.Future.cancel.

Doc from java.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.

Parameters
mayInterruptIfRunning:boolean

true if the thread executing this task should be interrupted (if the thread is known to the implementation); otherwise, in-progress tasks are allowed to complete

Returns:boolean

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
equalsback to summary
public final 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
hashCodeback to summary
public final int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this 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
runback to summary
public void 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
setFailureback to summary
public final Promise<V> setFailure(Throwable cause)

Overrides io.netty5.util.concurrent.DefaultPromise.setFailure.

Implements io.netty5.util.concurrent.Promise.setFailure.

Doc from io.netty5.util.concurrent.Promise.setFailure.

Marks this promise as a failure and notifies all listeners attached to the future.

If it is success or failed already it will throw an IllegalStateException.

Annotations
@Override
setFailureInternalback to summary
protected final Promise<V> setFailureInternal(Throwable cause)
setSuccessback to summary
public final Promise<V> setSuccess(V result)

Overrides io.netty5.util.concurrent.DefaultPromise.setSuccess.

Implements io.netty5.util.concurrent.Promise.setSuccess.

Doc from io.netty5.util.concurrent.Promise.setSuccess.

Marks this promise as a success and notifies all listeners attached to the future.

If it is success or failed already it will throw an IllegalStateException.

Annotations
@Override
setSuccessInternalback to summary
protected final Promise<V> setSuccessInternal(V result)
setUncancellableback to summary
public final boolean setUncancellable()

Overrides io.netty5.util.concurrent.DefaultPromise.setUncancellable.

Implements io.netty5.util.concurrent.Promise.setUncancellable.

Doc from io.netty5.util.concurrent.Promise.setUncancellable.

Make this promise impossible to cancel.

Returns:boolean

true if and only if successfully marked this promise as uncancellable. Otherwise false if this promise has been cancelled already, or has completed.

Annotations
@Override
setUncancellableInternalback to summary
protected final boolean setUncancellableInternal()
toCallableback to summary
pack-priv static <T> Callable<T> toCallable(Runnable runnable, T result)
toStringBuilderback to summary
protected StringBuilder toStringBuilder()

Overrides io.netty5.util.concurrent.DefaultPromise.toStringBuilder.

Annotations
@Override
tryFailureback to summary
public final boolean tryFailure(Throwable cause)

Overrides io.netty5.util.concurrent.DefaultPromise.tryFailure.

Implements io.netty5.util.concurrent.Promise.tryFailure.

Doc from io.netty5.util.concurrent.Promise.tryFailure.

Marks this promise as a failure and notifies all listeners.

Returns:boolean

true if and only if successfully marked this promise as a failure. Otherwise false because this promise is already marked as either a success or a failure.

Annotations
@Override
tryFailureInternalback to summary
protected final boolean tryFailureInternal(Throwable cause)
trySuccessback to summary
public final boolean trySuccess(V result)

Overrides io.netty5.util.concurrent.DefaultPromise.trySuccess.

Implements io.netty5.util.concurrent.Promise.trySuccess.

Doc from io.netty5.util.concurrent.Promise.trySuccess.

Marks this future as a success and notifies all listeners.

Returns:boolean

true if and only if successfully marked this promise as a success. Otherwise false because this promise is already marked as either a success or a failure.

Annotations
@Override
io.netty5.util.concurrent back to summary

private final Class PromiseTask.RunnableAdapter<T>

extends Object
implements Callable<T>
Class Inheritance
All Implemented Interfaces
java.util.concurrent.Callable

Field Summary

Modifier and TypeField and Description
pack-priv final T
pack-priv final Runnable

Constructor Summary

AccessConstructor and Description
pack-priv
RunnableAdapter(Runnable task, T result)

Method Summary

Modifier and TypeMethod and Description
public T
call()

Implements java.util.concurrent.Callable.call.

Computes a result, or throws an exception if unable to do so.
public String
toString()

Overrides java.lang.Object.toString.

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

Field Detail

resultback to summary
pack-priv final T result
taskback to summary
pack-priv final Runnable task

Constructor Detail

RunnableAdapterback to summary
pack-priv RunnableAdapter(Runnable task, T result)

Method Detail

callback to summary
public T call()

Implements java.util.concurrent.Callable.call.

Doc from java.util.concurrent.Callable.call.

Computes a result, or throws an exception if unable to do so.

Returns:T

computed result

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