CompositeFuture

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

Methods

__construct

__construct() 

Like @see \io\vertx\jphp\core\CompositeFuture::all but with a list of futures.<p>

all( $arg0,  $arg1 = null,  $arg2 = null,  $arg3 = null,  $arg4 = null,  $arg5 = null) : \io\vertx\jphp\core\CompositeFuture
static

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] future param $f2 [Future] future all($f1, $f2)

Like @see \io\vertx\jphp\core\CompositeFuture::all but with 3 futures.

param $f1 [Future] param $f2 [Future] param $f3 [Future] all($f1, $f2, $f3)

Like @see \io\vertx\jphp\core\CompositeFuture::all but with 4 futures.

param $f1 [Future] param $f2 [Future] param $f3 [Future] param $f4 [Future] all($f1, $f2, $f3, $f4)

Like @see \io\vertx\jphp\core\CompositeFuture::all but with 5 futures.

param $f1 [Future] param $f2 [Future] param $f3 [Future] param $f4 [Future] param $f5 [Future] all($f1, $f2, $f3, $f4, $f5)

Like @see \io\vertx\jphp\core\CompositeFuture::all but with 6 futures.

param $f1 [Future] param $f2 [Future] param $f3 [Future] param $f4 [Future] param $f5 [Future] param $f6 [Future] all($f1, $f2, $f3, $f4, $f5, $f6)

Arguments

$arg0

array | Future

$arg1

Future

$arg2

Future

$arg3

Future

$arg4

Future

$arg5

Future

Response

\io\vertx\jphp\core\CompositeFuture

Like @see \io\vertx\jphp\core\CompositeFuture::any but with a list of futures.<p>

any( $arg0,  $arg1 = null,  $arg2 = null,  $arg3 = null,  $arg4 = null,  $arg5 = null) : \io\vertx\jphp\core\CompositeFuture
static

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] future param $f2 [Future] future any($f1, $f2)

Like @see \io\vertx\jphp\core\CompositeFuture::any but with 3 futures.

param $f1 [Future] param $f2 [Future] param $f3 [Future] any($f1, $f2, $f3)

Like @see \io\vertx\jphp\core\CompositeFuture::any but with 4 futures.

param $f1 [Future] param $f2 [Future] param $f3 [Future] param $f4 [Future] any($f1, $f2, $f3, $f4)

Like @see \io\vertx\jphp\core\CompositeFuture::any but with 5 futures.

param $f1 [Future] param $f2 [Future] param $f3 [Future] param $f4 [Future] param $f5 [Future] any($f1, $f2, $f3, $f4, $f5)

Like @see \io\vertx\jphp\core\CompositeFuture::any but with 6 futures.

param $f1 [Future] param $f2 [Future] param $f3 [Future] param $f4 [Future] param $f5 [Future] param $f6 [Future] any($f1, $f2, $f3, $f4, $f5, $f6)

Arguments

$arg0

array | Future

$arg1

Future

$arg2

Future

$arg3

Future

$arg4

Future

$arg5

Future

Response

\io\vertx\jphp\core\CompositeFuture

A Throwable describing failure. This will be null if the operation succeeded.

cause( $arg0 = null) : \Exception

cause()

Returns a cause of a wrapped future

param $index [integer] the wrapped future index cause($index)

Arguments

$arg0

integer

Response

\Exception

the cause or null if the operation succeeded.

Set this instance as result. Any handler will be called, if there is one, and the future will be marked as completed.

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)

Arguments

$arg0

CompositeFuture

completer

completer() : callable

Response

callable

an handler completing this future

Compose this future with a <code>mapper</code> function.<p>

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)

Arguments

$arg0

callable

$arg1

Future

Response

\io\vertx\jphp\core\Future

the composed future

Set the failure. Any handler will be called, if there is one, and the future will be marked as completed.

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)

Arguments

$arg0

string | \Exception

Did it fail?

failed( $arg0 = null) : boolean

failed()

Returns true if a wrapped future is failed

param $index [integer] the wrapped future index failed($index)

Arguments

$arg0

integer

Response

boolean

true if it failed or false otherwise

Has the future completed? <p> It's completed if it's either succeeded or failed.

isComplete( $arg0 = null) : boolean

isComplete()

Returns true if a wrapped future is completed

param $index [integer] the wrapped future index isComplete($index)

Arguments

$arg0

integer

Response

boolean

true if completed, false if not

Like @see \io\vertx\jphp\core\CompositeFuture::join but with a list of futures.<p>

join( $arg0,  $arg1 = null,  $arg2 = null,  $arg3 = null,  $arg4 = null,  $arg5 = null) : \io\vertx\jphp\core\CompositeFuture
static

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] future param $f2 [Future] future join($f1, $f2)

Like @see \io\vertx\jphp\core\CompositeFuture::join but with 3 futures.

param $f1 [Future] param $f2 [Future] param $f3 [Future] join($f1, $f2, $f3)

Like @see \io\vertx\jphp\core\CompositeFuture::join but with 4 futures.

param $f1 [Future] param $f2 [Future] param $f3 [Future] param $f4 [Future] join($f1, $f2, $f3, $f4)

Like @see \io\vertx\jphp\core\CompositeFuture::join but with 5 futures.

param $f1 [Future] param $f2 [Future] param $f3 [Future] param $f4 [Future] param $f5 [Future] join($f1, $f2, $f3, $f4, $f5)

Like @see \io\vertx\jphp\core\CompositeFuture::join but with 6 futures.

param $f1 [Future] param $f2 [Future] param $f3 [Future] param $f4 [Future] param $f5 [Future] param $f6 [Future] join($f1, $f2, $f3, $f4, $f5, $f6)

Arguments

$arg0

array | Future

$arg1

Future

$arg2

Future

$arg3

Future

$arg4

Future

$arg5

Future

Response

\io\vertx\jphp\core\CompositeFuture

Apply a <code>mapper</code> function on this future.<p>

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)

Arguments

$arg0

callable | mixed

Response

\io\vertx\jphp\core\Future

the mapped future

Map the result of a future to <code>null</code>.<p>

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.

Response

\io\vertx\jphp\core\Future

the mapped future

Apply a <code>mapper</code> function on this future.<p>

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)

Arguments

$arg0

CompositeFuture | callable

Response

\io\vertx\jphp\core\Future

the mapped future

Map the failure of a future to <code>null</code>.<p>

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.

Response

\io\vertx\jphp\core\Future

the mapped future

Handles a failure of this Future by returning the result of another Future.

recover( $arg0) : \io\vertx\jphp\core\Future<CompositeFuture>

If the mapper fails, then the returned future will be failed with this failure.

Arguments

$arg0

callable

Response

\io\vertx\jphp\core\Future

A recovered future

The result of the operation. This will be null if the operation failed.

result() : \io\vertx\jphp\core\CompositeFuture

Response

\io\vertx\jphp\core\CompositeFuture

the result or null if the operation failed.

Returns the result of a wrapped future

resultAt( $arg0) : mixed

Arguments

$arg0

integer

Response

mixed

setHandler

setHandler( $arg0) : $this

Arguments

$arg0

callable

Response

$this

size

size() : integer

Response

integer

the number of wrapped future

Did it succeed?

succeeded( $arg0 = null) : boolean

succeeded()

Returns true if a wrapped future is succeeded

param $index [integer] the wrapped future index succeeded($index)

Arguments

$arg0

integer

Response

boolean

true if it succeded or false otherwise

Try to set this instance as result. When it happens, any handler will be called, if there is one, and the future will be marked as completed.

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)

Arguments

$arg0

CompositeFuture

Response

boolean

false when the future is already completed

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.

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)

Arguments

$arg0

string | \Exception

Response

boolean

false when the future is already completed