Class Promise<T>
java.lang.Object
io.vertx.rxjava3.core.Promise<T>
- All Implemented Interfaces:
io.vertx.lang.rx.RxDelegate
- Direct Known Subclasses:
BaseBridgeEvent, ConnectionInitEvent
Represents the writable side of an action that may, or may not, have occurred yet.
The future() method returns the Future associated with a promise, the future
can be used for getting notified of the promise completion and retrieve its value.
A promise extends Completable so it can be used with Future.
NOTE: This class has been automatically generated from the original non RX-ified interface using Vert.x codegen.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcomplete()Callscomplete(null)voidSet the result.voidbooleanvoidvoidfuture()voidhandle(AsyncResult<T> asyncResult) Succeed or fail this promise with theAsyncResultevent.inthashCode()static <T> Promise<T> newInstance(Promise arg) static <T> Promise<T> newInstance(Promise arg, io.vertx.lang.rx.TypeArg<T> __typeArg_T) static <T> Promise<T> promise()Create a promise that hasn't completed yetrxFuture()voidsucceed()voidtoString()booleanCallstryComplete(null).booleantryComplete(T result) Likecomplete(T, Throwable)but returnsfalsewhen the promise is already completed instead of throwing anIllegalStateException, it returnstrueotherwise.booleanCallsfail(Throwable)with themessage.booleanLikefail(Throwable)but returnsfalsewhen the promise is already completed instead of throwing anIllegalStateException, it returnstrueotherwise.
-
Field Details
-
__TYPE_ARG
-
__typeArg_0
-
-
Constructor Details
-
Promise
-
Promise
-
-
Method Details
-
toString
-
equals
-
hashCode
-
getDelegate
- Specified by:
getDelegatein interfaceio.vertx.lang.rx.RxDelegate
-
promise
Create a promise that hasn't completed yet- Returns:
- the promise
-
complete
-
complete
Set the result. Any handler will be called, if there is one, and the promise will be marked as completed. Any handler set on the associated promise will be called.- Parameters:
result- the result
-
complete
public void complete()Callscomplete(null) -
succeed
-
succeed
public void succeed() -
fail
-
fail
-
tryComplete
Likecomplete(T, Throwable)but returnsfalsewhen the promise is already completed instead of throwing anIllegalStateException, it returnstrueotherwise.- Parameters:
result- the result- Returns:
falsewhen the future is already completed
-
tryComplete
public boolean tryComplete()CallstryComplete(null).- Returns:
falsewhen the future is already completed
-
tryFail
Likefail(Throwable)but returnsfalsewhen the promise is already completed instead of throwing anIllegalStateException, it returnstrueotherwise.- Parameters:
cause- the failure cause- Returns:
falsewhen the future is already completed
-
tryFail
Callsfail(Throwable)with themessage.- Parameters:
message- the failure message- Returns:
- false when the future is already completed
-
future
-
rxFuture
-
handle
Succeed or fail this promise with theAsyncResultevent.- Parameters:
asyncResult- the async result to handle
-
newInstance
-
newInstance
-