Represents the writable side of an action that may, or may not, have occurred yet.
The @see \io\vertx\jphp\core\Promise::future method returns the @see \io\vertx\jphp\core\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
so it can be used as a callback.
package |
Default |
---|
__construct()
complete( $arg0 = null) : void
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.
param $result [mixed] the result complete($result)
mixed
fail( $arg0) : void
param $cause [\Exception] the failure cause fail($cause)
Calls @see \io\vertx\jphp\core\Promise::fail with the message
.
param $message [string] the failure message fail($message)
string | \Exception
failedPromise( $arg0) : \io\vertx\jphp\core\Promise<T>
param $cause [\Exception] the failure cause as a Throwable failedPromise($cause)
Create a failed promise with the specified failureMessage
.
param $failureMessage [string] the failure message failedPromise($failureMessage)
string | \Exception
\io\vertx\jphp\core\Promise
the promise
future() : \io\vertx\jphp\core\Future<T>
\io\vertx\jphp\core\Future
the {@link Future} associated with this promise, it can be used to be aware of the promise completion
promise() : \io\vertx\jphp\core\Promise<T>
\io\vertx\jphp\core\Promise
the promise
succeededPromise( $arg0 = null) : \io\vertx\jphp\core\Promise<T>
succeededPromise()
Created a succeeded promise with the specified result
.
param $result [mixed] the result succeededPromise($result)
mixed
\io\vertx\jphp\core\Promise
the promise
tryComplete( $arg0 = null) : boolean
tryComplete()
Like @see \io\vertx\jphp\core\Promise::complete but returns false
when the promise is already completed instead of throwing
an \java.lang.IllegalStateException, it returns true
otherwise.
param $result [mixed] the result tryComplete($result)
mixed
boolean
{@code false} when the future is already completed
tryFail( $arg0) : boolean
param $cause [\Exception] the failure cause tryFail($cause)
Calls @see \io\vertx\jphp\core\Promise::fail with the message
.
param $message [string] the failure message tryFail($message)
string | \Exception
boolean
{@code false} when the future is already completed