Top Description Methods
io.netty5.util.concurrent

public Interface Promise<V>

extends AsynchronousResult<V>
Known Direct Implementers
io.netty5.util.concurrent.DefaultPromise

Special Future which is writable.

Method Summary

Modifier and TypeMethod and Description
public Future<V>

Returns:

A future instance associated with this promise.
asFuture
()

Return the Future instance is associated with this promise.

public Promise<V>
setFailure(Throwable cause)

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

public Promise<V>
setSuccess(V result)

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

public boolean

Returns:

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

Make this promise impossible to cancel.

public boolean

Returns:

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.
tryFailure
(Throwable cause)

Marks this promise as a failure and notifies all listeners.

public boolean

Returns:

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.
trySuccess
(V result)

Marks this future as a success and notifies all listeners.

Inherited from io.netty5.util.concurrent.AsynchronousResult:
cancelcauseexecutorgetNowisCancellableisCancelledisDoneisFailedisSuccess

Method Detail

asFutureback to summary
public Future<V> asFuture()

Return the Future instance is associated with this promise. This future will be completed upon completion of this promise.

Returns:Future<V>

A future instance associated with this promise.

setFailureback to summary
public Promise<V> setFailure(Throwable cause)

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.

setSuccessback to summary
public Promise<V> setSuccess(V result)

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.

setUncancellableback to summary
public boolean 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.

tryFailureback to summary
public boolean tryFailure(Throwable cause)

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.

trySuccessback to summary
public boolean trySuccess(V result)

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.