Package io.vertx.mutiny.core
Class Promise<T>
java.lang.Object
io.vertx.mutiny.core.Promise<T>
- All Implemented Interfaces:
MutinyDelegate
- Direct Known Subclasses:
ApolloWSConnectionInitEvent,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 Handler<AsyncResult so it can be used as a callback.
original non Mutiny-ified interface using Vert.x codegen.-
Field Summary
FieldsModifier and TypeFieldDescription -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcomplete()voidbooleanvoidvoidio.smallrye.mutiny.Uni<T>future()Unlike the bare Vert.x variant, this method returns aUni.Blocking variant offuture().voidVariant offuture()that ignores the result of the operation.io.vertx.core.PromiseinthashCode()static <T> Promise<T>newInstance(io.vertx.core.Promise arg) static <T> Promise<T>newInstance(io.vertx.core.Promise arg, TypeArg<T> __typeArg_T) static <T> Promise<T>promise()toString()booleanbooleantryComplete(T result) booleanboolean
-
Field Details
-
__TYPE_ARG
-
__typeArg_0
-
-
Constructor Details
-
Promise
public Promise(io.vertx.core.Promise delegate) -
Promise
-
Promise
-
-
Method Details
-
getDelegate
public io.vertx.core.Promise getDelegate()- Specified by:
getDelegatein interfaceMutinyDelegate- Returns:
- the delegate used by this Mutiny object of generated type
-
toString
-
equals
-
hashCode
public int hashCode() -
promise
- Returns:
- the promise
-
complete
- Parameters:
result- the result
-
complete
public void complete() -
fail
- Parameters:
cause- the failure cause
-
fail
- Parameters:
message- the failure message
-
tryComplete
- Parameters:
result- the result- Returns:
falsewhen the future is already completed
-
tryComplete
public boolean tryComplete()- Returns:
falsewhen the future is already completed
-
tryFail
- Parameters:
cause- the failure cause- Returns:
falsewhen the future is already completed
-
tryFail
- Parameters:
message- the failure message- Returns:
- false when the future is already completed
-
future
Unlike the bare Vert.x variant, this method returns a
Uni. Don't forget to subscribe on it to trigger the operation.- Returns:
- the
unifiring the result of the operation when completed, or a failure if the operation failed.
-
futureAndAwait
Blocking variant offuture().This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Returns:
- the T instance produced by the operation.
-
futureAndForget
public void futureAndForget() -
newInstance
-
newInstance
-