Top Inners Fields Constructors Methods
io.netty.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.netty.util.concurrent.ScheduledFutureTask, io.netty.util.concurrent.UnorderedThreadPoolEventExecutor.RunnableScheduledFutureTask
Imports
java.util.concurrent.Callable, .RunnableFuture

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class

Field Summary

Modifier and TypeField and Description
private static final Runnable
private static final Runnable
private static final Runnable
private Object

Constructor Summary

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

pack-priv
PromiseTask(EventExecutor executor, Runnable runnable)

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.netty.util.concurrent.DefaultPromise.cancel.

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

Attempts to cancel execution of this task.
private boolean
clearTaskAfterCompletion(boolean done, Runnable result)

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.
pack-priv V
public final Promise<V>
setFailure(Throwable cause)

Overrides io.netty.util.concurrent.DefaultPromise.setFailure.

Implements io.netty.util.concurrent.Promise.setFailure.

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

Overrides io.netty.util.concurrent.DefaultPromise.setSuccess.

Implements io.netty.util.concurrent.Promise.setSuccess.

Marks this future as a success and notifies all listeners.
protected final Promise<V>
public final boolean
protected final boolean
protected StringBuilder
public final boolean
tryFailure(Throwable cause)

Overrides io.netty.util.concurrent.DefaultPromise.tryFailure.

Implements io.netty.util.concurrent.Promise.tryFailure.

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

Overrides io.netty.util.concurrent.DefaultPromise.trySuccess.

Implements io.netty.util.concurrent.Promise.trySuccess.

Marks this future as a success and notifies all listeners.
protected final boolean
Inherited from io.netty.util.concurrent.DefaultPromise:
addListeneraddListenersawaitawaitawaitawaitUninterruptiblyawaitUninterruptiblyawaitUninterruptiblycausecheckDeadLockexecutorgetgetgetNowisCancellableisCancelledisDoneisSuccessnotifyListenernotifyProgressiveListenersremoveListenerremoveListenerssyncsyncUninterruptiblytoString

Field Detail

CANCELLEDback to summary
private static final Runnable CANCELLED
COMPLETEDback to summary
private static final Runnable COMPLETED
FAILEDback to summary
private static final Runnable FAILED
taskback to summary
private Object task

Constructor Detail

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

Method Detail

cancelback to summary
public boolean cancel(boolean mayInterruptIfRunning)

Overrides io.netty.util.concurrent.DefaultPromise.cancel.

Implements java.util.concurrent.Future.cancel, io.netty.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
clearTaskAfterCompletionback to summary
private boolean clearTaskAfterCompletion(boolean done, Runnable result)
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
runTaskback to summary
pack-priv V runTask() throws Throwable
Annotations
@SuppressWarnings:unchecked
setFailureback to summary
public final Promise<V> setFailure(Throwable cause)

Overrides io.netty.util.concurrent.DefaultPromise.setFailure.

Implements io.netty.util.concurrent.Promise.setFailure.

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

Marks this future as a failure and notifies all listeners. 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.netty.util.concurrent.DefaultPromise.setSuccess.

Implements io.netty.util.concurrent.Promise.setSuccess.

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

Marks this future as a success and notifies all listeners. 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.netty.util.concurrent.DefaultPromise.setUncancellable.

Implements io.netty.util.concurrent.Promise.setUncancellable.

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

Make this future impossible to cancel.

Returns:boolean

true if and only if successfully marked this future as uncancellable or it is already done without being cancelled. false if this future has been cancelled already.

Annotations
@Override
setUncancellableInternalback to summary
protected final boolean setUncancellableInternal()
toStringBuilderback to summary
protected StringBuilder toStringBuilder()

Overrides io.netty.util.concurrent.DefaultPromise.toStringBuilder.

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

Overrides io.netty.util.concurrent.DefaultPromise.tryFailure.

Implements io.netty.util.concurrent.Promise.tryFailure.

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

Marks this future as a failure and notifies all listeners.

Returns:boolean

true if and only if successfully marked this future as a failure. Otherwise false because this future 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.netty.util.concurrent.DefaultPromise.trySuccess.

Implements io.netty.util.concurrent.Promise.trySuccess.

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

Marks this future as a success and notifies all listeners.

Returns:boolean

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

Annotations
@Override
trySuccessInternalback to summary
protected final boolean trySuccessInternal(V result)
io.netty.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
io.netty.util.concurrent back to summary

private Class PromiseTask.SentinelRunnable

extends Object
implements Runnable
Class Inheritance
All Implemented Interfaces
java.lang.Runnable

Field Summary

Modifier and TypeField and Description
private final String

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
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:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

nameback to summary
private final String name

Constructor Detail

SentinelRunnableback to summary
pack-priv SentinelRunnable(String name)

Method Detail

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