The composite future wraps a list of @see \io\vertx\jphp\core\Future futures, it is useful when several futures needs to be coordinated.
The handlers set for the coordinated futures are overridden by the handler of the composite future.
| package |
Default |
|---|
__construct()
all( $arg0, $arg1 = null, $arg2 = null, $arg3 = null, $arg4 = null, $arg5 = null) : \io\vertx\jphp\core\CompositeFuture
When the list is empty, the returned future will be already completed.
param $futures [array] all($futures)
Return a composite future, succeeded when all futures are succeeded, failed when any future is failed.
The returned future fails as soon as one of f1 or f2 fails.
param $f1 [Future
Like @see \io\vertx\jphp\core\CompositeFuture::all but with 3 futures.
param $f1 [Future
Like @see \io\vertx\jphp\core\CompositeFuture::all but with 4 futures.
param $f1 [Future
Like @see \io\vertx\jphp\core\CompositeFuture::all but with 5 futures.
param $f1 [Future
Like @see \io\vertx\jphp\core\CompositeFuture::all but with 6 futures.
param $f1 [Future
array | Future
Future
Future
Future
Future
Future
\io\vertx\jphp\core\CompositeFuture
any( $arg0, $arg1 = null, $arg2 = null, $arg3 = null, $arg4 = null, $arg5 = null) : \io\vertx\jphp\core\CompositeFuture
When the list is empty, the returned future will be already completed.
param $futures [array] any($futures)
Return a composite future, succeeded when any futures is succeeded, failed when all futures are failed.
The returned future succeeds as soon as one of f1 or f2 succeeds.
param $f1 [Future
Like @see \io\vertx\jphp\core\CompositeFuture::any but with 3 futures.
param $f1 [Future
Like @see \io\vertx\jphp\core\CompositeFuture::any but with 4 futures.
param $f1 [Future
Like @see \io\vertx\jphp\core\CompositeFuture::any but with 5 futures.
param $f1 [Future
Like @see \io\vertx\jphp\core\CompositeFuture::any but with 6 futures.
param $f1 [Future
array | Future
Future
Future
Future
Future
Future
\io\vertx\jphp\core\CompositeFuture
cause( $arg0 = null) : \Exception
cause()
Returns a cause of a wrapped future
param $index [integer] the wrapped future index cause($index)
integer
\Exceptionthe cause or null if the operation succeeded.
complete( $arg0 = null) : void
complete()
Set the result. Any handler will be called, if there is one, and the future will be marked as completed.
param $result [CompositeFuture] the result complete($result)
CompositeFuture
completer() : callable
callablean handler completing this future
compose( $arg0, $arg1 = null) : \io\vertx\jphp\core\Future<U>
When this future (the one on which compose is called) succeeds, the mapper will be called with
the completed value and this mapper returns another future object. This returned future completion will complete
the future returned by this method call.
If the mapper throws an exception, the returned future will be failed with this exception.
When this future fails, the failure will be propagated to the returned future and the mapper
will not be called.
param $mapper [callable] the mapper function compose($mapper)
Compose this future with a provided next future.
When this (the one on which compose is called) future succeeds, the handler will be called with
the completed value, this handler should complete the next future.
If the handler throws an exception, the returned future will be failed with this exception.
When this future fails, the failure will be propagated to the next future and the handler
will not be called.
param $handler [callable] the handler param $next [Future] the next future compose($handler, $next)
callable
Future
\io\vertx\jphp\core\Futurethe composed future
fail( $arg0) : void
param $cause [\Exception] the failure cause fail($cause)
Try to set the failure. When it happens, any handler will be called, if there is one, and the future will be marked as completed.
param $failureMessage [string] the failure message fail($failureMessage)
string | \Exception
failed( $arg0 = null) : boolean
failed()
Returns true if a wrapped future is failed
param $index [integer] the wrapped future index failed($index)
integer
booleantrue if it failed or false otherwise
isComplete( $arg0 = null) : boolean
isComplete()
Returns true if a wrapped future is completed
param $index [integer] the wrapped future index isComplete($index)
integer
booleantrue if completed, false if not
join( $arg0, $arg1 = null, $arg2 = null, $arg3 = null, $arg4 = null, $arg5 = null) : \io\vertx\jphp\core\CompositeFuture
When the list is empty, the returned future will be already completed.
param $futures [array] join($futures)
Return a composite future, succeeded when all futures are succeeded, failed when any future is failed.
It always wait until all its futures are completed and will not fail as soon as one of f1 or f2 fails.
param $f1 [Future
Like @see \io\vertx\jphp\core\CompositeFuture::join but with 3 futures.
param $f1 [Future
Like @see \io\vertx\jphp\core\CompositeFuture::join but with 4 futures.
param $f1 [Future
Like @see \io\vertx\jphp\core\CompositeFuture::join but with 5 futures.
param $f1 [Future
Like @see \io\vertx\jphp\core\CompositeFuture::join but with 6 futures.
param $f1 [Future
array | Future
Future
Future
Future
Future
Future
\io\vertx\jphp\core\CompositeFuture
map( $arg0) : \io\vertx\jphp\core\Future<U>
When this future succeeds, the mapper will be called with the completed value and this mapper
returns a value. This value will complete the future returned by this method call.
If the mapper throws an exception, the returned future will be failed with this exception.
When this future fails, the failure will be propagated to the returned future and the mapper
will not be called.
param $mapper [callable] the mapper function map($mapper)
Map the result of a future to a specific value.
When this future succeeds, this value will complete the future returned by this method call.
When this future fails, the failure will be propagated to the returned future.
param $value [mixed] the value that eventually completes the mapped future map($value)
callable | mixed
\io\vertx\jphp\core\Futurethe mapped future
mapEmpty() : \io\vertx\jphp\core\Future<V>
This is a conveniency for future.map((T) null) or future.map((Void) null).
When this future succeeds, null will complete the future returned by this method call.
When this future fails, the failure will be propagated to the returned future.
\io\vertx\jphp\core\Futurethe mapped future
otherwise( $arg0) : \io\vertx\jphp\core\Future<CompositeFuture>
When this future fails, the mapper will be called with the completed value and this mapper
returns a value. This value will complete the future returned by this method call.
If the mapper throws an exception, the returned future will be failed with this exception.
When this future succeeds, the result will be propagated to the returned future and the mapper
will not be called.
param $mapper [callable] the mapper function otherwise($mapper)
Map the failure of a future to a specific value.
When this future fails, this value will complete the future returned by this method call.
When this future succeeds, the result will be propagated to the returned future.
param $value [CompositeFuture] the value that eventually completes the mapped future otherwise($value)
CompositeFuture | callable
\io\vertx\jphp\core\Futurethe mapped future
otherwiseEmpty() : \io\vertx\jphp\core\Future<CompositeFuture>
This is a convenience for future.otherwise((T) null).
When this future fails, the null value will complete the future returned by this method call.
When this future succeeds, the result will be propagated to the returned future.
\io\vertx\jphp\core\Futurethe mapped future
recover( $arg0) : \io\vertx\jphp\core\Future<CompositeFuture>
If the mapper fails, then the returned future will be failed with this failure.
callable
\io\vertx\jphp\core\FutureA recovered future
result() : \io\vertx\jphp\core\CompositeFuture
resultAt( $arg0) : mixed
integer
mixed
setHandler( $arg0) : $this
callable
$this
size() : integer
integerthe number of wrapped future
succeeded( $arg0 = null) : boolean
succeeded()
Returns true if a wrapped future is succeeded
param $index [integer] the wrapped future index succeeded($index)
integer
booleantrue if it succeded or false otherwise
tryComplete( $arg0 = null) : boolean
tryComplete()
Set the failure. Any handler will be called, if there is one, and the future will be marked as completed.
param $result [CompositeFuture] the result tryComplete($result)
CompositeFuture
booleanfalse when the future is already completed
tryFail( $arg0) : boolean
param $cause [\Exception] the failure cause tryFail($cause)
Try to set the failure. When it happens, any handler will be called, if there is one, and the future will be marked as completed.
param $failureMessage [string] the failure message tryFail($failureMessage)
string | \Exception
booleanfalse when the future is already completed