Top Description Methods
io.vertx.core

public Interface Future<T>

extends AsyncResult<T>
Known Direct Subinterfaces
io.vertx.core.Timer, io.vertx.core.impl.future.FutureInternal, io.vertx.core.CompositeFuture
Imports
io.vertx.codegen.annotations.Fluent, .GenIgnore, io.vertx.core.impl.ContextInternal, .Utils, io.vertx.core.impl.future.CompositeFutureImpl, .FailedFuture, .SucceededFuture, java.util.List, java.util.concurrent.CompletableFuture, .CompletionStage, .CountDownLatch, .TimeUnit, java.util.function.Function, .Supplier

Represents the result of an action that may, or may not, have occurred yet.

Author
Tim Fox

Method Summary

Modifier and TypeMethod and Description
public static CompositeFuture

Returns:

the composite future
all
(Future<?>
future
f1
,
Future<?>
future
f2
)

Return a composite future, succeeded when all futures are succeeded, failed when any future is failed.

public static CompositeFuture
all(Future<?> f1, Future<?> f2, Future<?> f3)

Like all(Future, Future) but with 3 futures.

public static CompositeFuture
all(Future<?> f1, Future<?> f2, Future<?> f3, Future<?> f4)

Like all(Future, Future) but with 4 futures.

public static CompositeFuture
all(Future<?> f1, Future<?> f2, Future<?> f3, Future<?> f4, Future<?> f5)

Like all(Future, Future) but with 5 futures.

public static CompositeFuture
all(Future<?> f1, Future<?> f2, Future<?> f3, Future<?> f4, Future<?> f5, Future<?> f6)

Like all(Future, Future) but with 6 futures.

public static CompositeFuture
all(List<? extends Future<?>> futures)

Like all(Future, Future) but with a list of futures.

public default Future<T>

Returns:

a future completed after the handler has been invoked
andThen
(Handler<AsyncResult<T>>
invoked upon completion of this future
handler
)

Invokes the given handler upon completion.

public static CompositeFuture

Returns:

the composite future
any
(Future<?>
future
f1
,
Future<?>
future
f2
)

Return a composite future, succeeded when any futures is succeeded, failed when all futures are failed.

public static CompositeFuture
any(Future<?> f1, Future<?> f2, Future<?> f3)

Like any(Future, Future) but with 3 futures.

public static CompositeFuture
any(Future<?> f1, Future<?> f2, Future<?> f3, Future<?> f4)

Like any(Future, Future) but with 4 futures.

public static CompositeFuture
any(Future<?> f1, Future<?> f2, Future<?> f3, Future<?> f4, Future<?> f5)

Like any(Future, Future) but with 5 futures.

public static CompositeFuture
any(Future<?> f1, Future<?> f2, Future<?> f3, Future<?> f4, Future<?> f5, Future<?> f6)

Like any(Future, Future) but with 6 futures.

public static CompositeFuture
any(List<? extends Future<?>> futures)

Like any(Future, Future) but with a list of futures.

public static <T> T

Returns:

the result
await
(Future<T>
the future to await
future
)

Park the current thread until the future is completed, when the future is completed the thread is un-parked and

  • the result value is returned when the future was completed with a result
  • otherwise, the failure is thrown
public Throwable

Returns:

the cause or null if the operation succeeded.
cause
()

Redeclares io.vertx.core.AsyncResult.cause.

A Throwable describing failure.

public default <U> Future<U>

Returns:

the composed future
compose
(Function<T, Future<U>>
the mapper function
mapper
)

Compose this future with a mapper function.

public <U> Future<U>

Returns:

the composed future
compose
(Function<T, Future<U>>
the function mapping the success
successMapper
,
Function<Throwable, Future<U>>
the function mapping the failure
failureMapper
)

Compose this future with a successMapper and failureMapper functions.

public <U> Future<T>

Returns:

the composed future
eventually
(Function<Void, Future<U>>
the function returning the future.
function
)
Deprecated instead use eventually(Supplier), this method will be removed in Vert.x 5

Compose this future with a function that will be always be called.

public default <U> Future<T>

Returns:

the composed future
eventually
(Supplier<Future<U>>
the function returning the future.
supplier
)

Compose this future with a supplier that will be always be called.

public Future<T>

Returns:

a future succeeded with the result or failed when the expectation returns false
expecting
(Expectation<? super T>
the expectation
expectation
)

Guard the control flow of this future with an expectation.

public boolean

Returns:

true if it failed or false otherwise
failed
()

Redeclares io.vertx.core.AsyncResult.failed.

Did it fail?

public static <
the result type
T
>
Future<T>

Returns:

the future
failedFuture
(Throwable
the failure cause as a Throwable
t
)

Create a failed future with the specified failure cause.

public static <
the result type
T
>
Future<T>

Returns:

the future
failedFuture
(String
the failure message
failureMessage
)

Create a failed future with the specified failure message.

public default <U> Future<U>
flatMap(Function<T, Future<U>> mapper)

Alias for compose(Function).

public static <
the result type
T
>
Future<T>

Returns:

a Vert.x future that resolves when completionStage resolves
fromCompletionStage
(CompletionStage<T>
a completion stage
completionStage
)

Bridges a CompletionStage object to a Vert.x future instance.

public static <
the result type
T
>
Future<T>

Returns:

a Vert.x future that resolves when completionStage resolves
fromCompletionStage
(CompletionStage<T>
a completion stage
completionStage
,
Context
a Vert.x context to dispatch to
context
)

Bridges a CompletionStage object to a Vert.x future instance.

public static <
the result type
T
>
Future<T>

Returns:

the future.
future
(Handler<Promise<T>>
the handler
handler
)

Create a future that hasn't completed yet and that is passed to the handler before it is returned.

public boolean

Returns:

true if completed, false if not
isComplete
()

Has the future completed?

public static CompositeFuture

Returns:

the composite future
join
(Future<?>
future
f1
,
Future<?>
future
f2
)

Return a composite future, succeeded when all futures are succeeded, failed when any future is failed.

public static CompositeFuture
join(Future<?> f1, Future<?> f2, Future<?> f3)

Like join(Future, Future) but with 3 futures.

public static CompositeFuture
join(Future<?> f1, Future<?> f2, Future<?> f3, Future<?> f4)

Like join(Future, Future) but with 4 futures.

public static CompositeFuture
join(Future<?> f1, Future<?> f2, Future<?> f3, Future<?> f4, Future<?> f5)

Like join(Future, Future) but with 5 futures.

public static CompositeFuture
join(Future<?> f1, Future<?> f2, Future<?> f3, Future<?> f4, Future<?> f5, Future<?> f6)

Like join(Future, Future) but with 6 futures.

public static CompositeFuture
join(List<? extends Future<?>> futures)

Like join(Future, Future) but with a list of futures.

public <U> Future<U>

Returns:

the mapped future
map
(Function<T, U>
the mapper function
mapper
)

Redeclares as abstract: io.vertx.core.AsyncResult.map, io.vertx.core.AsyncResult.map.

Apply a mapper function on this future.

public <V> Future<V>

Returns:

the mapped future
map
(V
the value that eventually completes the mapped future
value
)

Redeclares as abstract: io.vertx.core.AsyncResult.map.

Map the result of a future to a specific value.

public default <V> Future<V>

Returns:

the mapped future
mapEmpty
()

Overrides default io.vertx.core.AsyncResult.mapEmpty.

Map the result of a future to null.

public Future<T>

Returns:

a reference to this, so it can be used fluently
onComplete
(Handler<AsyncResult<T>>
the handler that will be called with the result
handler
)

Add a handler to be notified of the result.

public default Future<T>

Returns:

a reference to this, so it can be used fluently
onComplete
(Handler<T>
the handler that will be called with the succeeded result
successHandler
,
Handler<Throwable>
the handler that will be called with the failed result
failureHandler
)

Add handlers to be notified on succeeded result and failed result.

public default Future<T>

Returns:

a reference to this, so it can be used fluently
onFailure
(Handler<Throwable>
the handler that will be called with the failed result
handler
)

Add a handler to be notified of the failed result.

public default Future<T>

Returns:

a reference to this, so it can be used fluently
onSuccess
(Handler<T>
the handler that will be called with the succeeded result
handler
)

Add a handler to be notified of the succeeded result.

public Future<T>

Returns:

the mapped future
otherwise
(Function<Throwable, T>
the mapper function
mapper
)

Redeclares as abstract: io.vertx.core.AsyncResult.otherwise, io.vertx.core.AsyncResult.otherwise.

Apply a mapper function on this future.

public Future<T>

Returns:

the mapped future
otherwise
(T
the value that eventually completes the mapped future
value
)

Redeclares as abstract: io.vertx.core.AsyncResult.otherwise.

Map the failure of a future to a specific value.

public default Future<T>

Returns:

the mapped future
otherwiseEmpty
()

Overrides default io.vertx.core.AsyncResult.otherwiseEmpty.

Map the failure of a future to null.

public default Future<T>

Returns:

A recovered future
recover
(Function<Throwable, Future<T>>
A function which takes the exception of a failure and returns a new future.
mapper
)

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

public T

Returns:

the result or null if the operation failed.
result
()

Redeclares io.vertx.core.AsyncResult.result.

The result of the operation.

public boolean

Returns:

true if it succeded or false otherwise
succeeded
()

Redeclares io.vertx.core.AsyncResult.succeeded.

Did it succeed?

public static <
the result type
T
>
Future<T>

Returns:

the future
succeededFuture
()

Create a succeeded future with a null result

public static <
the result type
T
>
Future<T>

Returns:

the future
succeededFuture
(T
the result
result
)

Created a succeeded future with the specified result.

public Future<T>

Returns:

the timeout future
timeout
(long
the delay
delay
,
TimeUnit
the unit of the delay
unit
)

Returns a future succeeded or failed with the outcome of this future when it happens before the timeout fires.

public default CompletionStage<T>

Returns:

a CompletionStage that completes when this future resolves
toCompletionStage
()

Bridges this Vert.x future to a CompletionStage instance.

public <U> Future<U>

Returns:

the transformed future
transform
(Function<AsyncResult<T>, Future<U>>
the function mapping the future
mapper
)

Transform this future with a mapper functions.

Method Detail

allback to summary
public static CompositeFuture all(Future<?> f1, Future<?> f2)

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.

Parameters
f1:Future<?>

future

f2:Future<?>

future

Returns:CompositeFuture

the composite future

allback to summary
public static CompositeFuture all(Future<?> f1, Future<?> f2, Future<?> f3)

Like all(Future, Future) but with 3 futures.

allback to summary
public static CompositeFuture all(Future<?> f1, Future<?> f2, Future<?> f3, Future<?> f4)

Like all(Future, Future) but with 4 futures.

allback to summary
public static CompositeFuture all(Future<?> f1, Future<?> f2, Future<?> f3, Future<?> f4, Future<?> f5)

Like all(Future, Future) but with 5 futures.

allback to summary
public static CompositeFuture all(Future<?> f1, Future<?> f2, Future<?> f3, Future<?> f4, Future<?> f5, Future<?> f6)

Like all(Future, Future) but with 6 futures.

allback to summary
public static CompositeFuture all(List<? extends Future<?>> futures)

Like all(Future, Future) but with a list of futures.

When the list is empty, the returned future will be already completed.

andThenback to summary
public default Future<T> andThen(Handler<AsyncResult<T>> handler)

Invokes the given handler upon completion.

If the handler throws an exception, the returned future will be failed with this exception.

Parameters
handler:Handler<AsyncResult<T>>

invoked upon completion of this future

Returns:Future<T>

a future completed after the handler has been invoked

anyback to summary
public static CompositeFuture any(Future<?> f1, Future<?> f2)

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.

Parameters
f1:Future<?>

future

f2:Future<?>

future

Returns:CompositeFuture

the composite future

anyback to summary
public static CompositeFuture any(Future<?> f1, Future<?> f2, Future<?> f3)

Like any(Future, Future) but with 3 futures.

anyback to summary
public static CompositeFuture any(Future<?> f1, Future<?> f2, Future<?> f3, Future<?> f4)

Like any(Future, Future) but with 4 futures.

anyback to summary
public static CompositeFuture any(Future<?> f1, Future<?> f2, Future<?> f3, Future<?> f4, Future<?> f5)

Like any(Future, Future) but with 5 futures.

anyback to summary
public static CompositeFuture any(Future<?> f1, Future<?> f2, Future<?> f3, Future<?> f4, Future<?> f5, Future<?> f6)

Like any(Future, Future) but with 6 futures.

anyback to summary
public static CompositeFuture any(List<? extends Future<?>> futures)

Like any(Future, Future) but with a list of futures.

When the list is empty, the returned future will be already completed.

awaitback to summary
public static <T> T await(Future<T> future)

Park the current thread until the future is completed, when the future is completed the thread is un-parked and

  • the result value is returned when the future was completed with a result
  • otherwise, the failure is thrown
This method must be called from a virtual thread.
Parameters
future:Future<T>

the future to await

Returns:T

the result

Exceptions
IllegalStateException:
when called from an event-loop thread or a non Vert.x thread
causeback to summary
public Throwable cause()

Redeclares io.vertx.core.AsyncResult.cause.

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

Returns:Throwable

the cause or null if the operation succeeded.

Annotations
@Override
composeback to summary
public default <U> Future<U> compose(Function<T, Future<U>> mapper)

Compose this future with a mapper function.

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.

Parameters
mapper:Function<T, Future<U>>

the mapper function

Returns:Future<U>

the composed future

composeback to summary
public <U> Future<U> compose(Function<T, Future<U>> successMapper, Function<Throwable, Future<U>> failureMapper)

Compose this future with a successMapper and failureMapper functions.

When this future (the one on which compose is called) succeeds, the successMapper 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.

When this future (the one on which compose is called) fails, the failureMapper will be called with the failure and this mapper returns another future object. This returned future completion will complete the future returned by this method call.

If any mapper function throws an exception, the returned future will be failed with this exception.

Parameters
successMapper:Function<T, Future<U>>

the function mapping the success

failureMapper:Function<Throwable, Future<U>>

the function mapping the failure

Returns:Future<U>

the composed future

eventuallyback to summary
public <U> Future<T> eventually(Function<Void, Future<U>> function)

Deprecated

instead use eventually(Supplier), this method will be removed in Vert.x 5

Compose this future with a function that will be always be called.

When this future (the one on which eventually is called) completes, the function will be called and this mapper returns another future object. This returned future completion will complete the future returned by this method call with the original result of the future.

The outcome of the future returned by the function will not influence the nature of the returned future.

Parameters
function:Function<Void, Future<U>>

the function returning the future.

Returns:Future<T>

the composed future

Annotations
@Deprecated
eventuallyback to summary
public default <U> Future<T> eventually(Supplier<Future<U>> supplier)

Compose this future with a supplier that will be always be called.

When this future (the one on which eventually is called) completes, the supplier will be called and this mapper returns another future object. This returned future completion will complete the future returned by this method call with the original result of the future.

The outcome of the future returned by the supplier will not influence the nature of the returned future.

Parameters
supplier:Supplier<Future<U>>

the function returning the future.

Returns:Future<T>

the composed future

expectingback to summary
public Future<T> expecting(Expectation<? super T> expectation)

Guard the control flow of this future with an expectation.

When the future is completed with a success, the expectation is called with the result, when the expectation returns false the returned future is failed, otherwise the future is completed with the same result.

Expectations are usually lambda expressions:

return future.expecting(response -> response.statusCode() == 200);
Expectation instances can also be used:
future = future.expecting(HttpResponseExpectation.SC_OK);
Parameters
expectation:Expectation<? super T>

the expectation

Returns:Future<T>

a future succeeded with the result or failed when the expectation returns false

failedback to summary
public boolean failed()

Redeclares io.vertx.core.AsyncResult.failed.

Did it fail?

Returns:boolean

true if it failed or false otherwise

Annotations
@Override
failedFutureback to summary
public static <T> Future<T> failedFuture(Throwable t)

Create a failed future with the specified failure cause.

Parameters
<T>
the result type
t:Throwable

the failure cause as a Throwable

Returns:Future<T>

the future

failedFutureback to summary
public static <T> Future<T> failedFuture(String failureMessage)

Create a failed future with the specified failure message.

Parameters
<T>
the result type
failureMessage:String

the failure message

Returns:Future<T>

the future

flatMapback to summary
public default <U> Future<U> flatMap(Function<T, Future<U>> mapper)

Alias for compose(Function).

fromCompletionStageback to summary
public static <T> Future<T> fromCompletionStage(CompletionStage<T> completionStage)

Bridges a CompletionStage object to a Vert.x future instance.

The Vert.x future handling methods will be called from the thread that completes completionStage.

Parameters
<T>
the result type
completionStage:CompletionStage<T>

a completion stage

Returns:Future<T>

a Vert.x future that resolves when completionStage resolves

Annotations
@GenIgnore
fromCompletionStageback to summary
public static <T> Future<T> fromCompletionStage(CompletionStage<T> completionStage, Context context)

Bridges a CompletionStage object to a Vert.x future instance.

The Vert.x future handling methods will be called on the provided context.

Parameters
<T>
the result type
completionStage:CompletionStage<T>

a completion stage

context:Context

a Vert.x context to dispatch to

Returns:Future<T>

a Vert.x future that resolves when completionStage resolves

Annotations
@GenIgnore
futureback to summary
public static <T> Future<T> future(Handler<Promise<T>> handler)

Create a future that hasn't completed yet and that is passed to the handler before it is returned.

Parameters
<T>
the result type
handler:Handler<Promise<T>>

the handler

Returns:Future<T>

the future.

isCompleteback to summary
public boolean isComplete()

Has the future completed?

It's completed if it's either succeeded or failed.

Returns:boolean

true if completed, false if not

joinback to summary
public static CompositeFuture join(Future<?> f1, Future<?> f2)

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.

Parameters
f1:Future<?>

future

f2:Future<?>

future

Returns:CompositeFuture

the composite future

joinback to summary
public static CompositeFuture join(Future<?> f1, Future<?> f2, Future<?> f3)

Like join(Future, Future) but with 3 futures.

joinback to summary
public static CompositeFuture join(Future<?> f1, Future<?> f2, Future<?> f3, Future<?> f4)

Like join(Future, Future) but with 4 futures.

joinback to summary
public static CompositeFuture join(Future<?> f1, Future<?> f2, Future<?> f3, Future<?> f4, Future<?> f5)

Like join(Future, Future) but with 5 futures.

joinback to summary
public static CompositeFuture join(Future<?> f1, Future<?> f2, Future<?> f3, Future<?> f4, Future<?> f5, Future<?> f6)

Like join(Future, Future) but with 6 futures.

joinback to summary
public static CompositeFuture join(List<? extends Future<?>> futures)

Like join(Future, Future) but with a list of futures.

When the list is empty, the returned future will be already completed.

mapback to summary
public <U> Future<U> map(Function<T, U> mapper)

Redeclares as abstract: io.vertx.core.AsyncResult.map, io.vertx.core.AsyncResult.map.

Apply a mapper function on this future.

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.

Parameters
mapper:Function<T, U>

the mapper function

Returns:Future<U>

the mapped future

mapback to summary
public <V> Future<V> map(V value)

Redeclares as abstract: io.vertx.core.AsyncResult.map.

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.

Parameters
value:V

the value that eventually completes the mapped future

Returns:Future<V>

the mapped future

mapEmptyback to summary
public default <V> Future<V> mapEmpty()

Overrides default io.vertx.core.AsyncResult.mapEmpty.

Map the result of a future to null.

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.

Returns:Future<V>

the mapped future

Annotations
@Override
onCompleteback to summary
public Future<T> onComplete(Handler<AsyncResult<T>> handler)

Add a handler to be notified of the result.

Warning

this is a terminal operation. If several handlers are registered, there is no guarantee that they will be invoked in order of registration.

Parameters
handler:Handler<AsyncResult<T>>

the handler that will be called with the result

Returns:Future<T>

a reference to this, so it can be used fluently

Annotations
@Fluent
onCompleteback to summary
public default Future<T> onComplete(Handler<T> successHandler, Handler<Throwable> failureHandler)

Add handlers to be notified on succeeded result and failed result.

Warning

this is a terminal operation. If several handlers are registered, there is no guarantee that they will be invoked in order of registration.

Parameters
successHandler:Handler<T>

the handler that will be called with the succeeded result

failureHandler:Handler<Throwable>

the handler that will be called with the failed result

Returns:Future<T>

a reference to this, so it can be used fluently

onFailureback to summary
public default Future<T> onFailure(Handler<Throwable> handler)

Add a handler to be notified of the failed result.

Warning

this is a terminal operation. If several handlers are registered, there is no guarantee that they will be invoked in order of registration.

Parameters
handler:Handler<Throwable>

the handler that will be called with the failed result

Returns:Future<T>

a reference to this, so it can be used fluently

Annotations
@Fluent
onSuccessback to summary
public default Future<T> onSuccess(Handler<T> handler)

Add a handler to be notified of the succeeded result.

Warning

this is a terminal operation. If several handlers are registered, there is no guarantee that they will be invoked in order of registration.

Parameters
handler:Handler<T>

the handler that will be called with the succeeded result

Returns:Future<T>

a reference to this, so it can be used fluently

Annotations
@Fluent
otherwiseback to summary
public Future<T> otherwise(Function<Throwable, T> mapper)

Redeclares as abstract: io.vertx.core.AsyncResult.otherwise, io.vertx.core.AsyncResult.otherwise.

Apply a mapper function on this future.

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.

Parameters
mapper:Function<Throwable, T>

the mapper function

Returns:Future<T>

the mapped future

otherwiseback to summary
public Future<T> otherwise(T value)

Redeclares as abstract: io.vertx.core.AsyncResult.otherwise.

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.

Parameters
value:T

the value that eventually completes the mapped future

Returns:Future<T>

the mapped future

otherwiseEmptyback to summary
public default Future<T> otherwiseEmpty()

Overrides default io.vertx.core.AsyncResult.otherwiseEmpty.

Map the failure of a future to null.

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.

Returns:Future<T>

the mapped future

recoverback to summary
public default Future<T> recover(Function<Throwable, Future<T>> mapper)

Handles a failure of this Future by returning the result of another Future. If the mapper fails, then the returned future will be failed with this failure.

Parameters
mapper:Function<Throwable, Future<T>>

A function which takes the exception of a failure and returns a new future.

Returns:Future<T>

A recovered future

resultback to summary
public T result()

Redeclares io.vertx.core.AsyncResult.result.

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

Returns:T

the result or null if the operation failed.

Annotations
@Override
succeededback to summary
public boolean succeeded()

Redeclares io.vertx.core.AsyncResult.succeeded.

Did it succeed?

Returns:boolean

true if it succeded or false otherwise

Annotations
@Override
succeededFutureback to summary
public static <T> Future<T> succeededFuture()

Create a succeeded future with a null result

Parameters
<T>
the result type
Returns:Future<T>

the future

succeededFutureback to summary
public static <T> Future<T> succeededFuture(T result)

Created a succeeded future with the specified result.

Parameters
<T>
the result type
result:T

the result

Returns:Future<T>

the future

timeoutback to summary
public Future<T> timeout(long delay, TimeUnit unit)

Returns a future succeeded or failed with the outcome of this future when it happens before the timeout fires. When the timeout fires before, the future is failed with a java.util.concurrent.TimeoutException, guaranteeing the returned future to complete within the specified delay.

Parameters
delay:long

the delay

unit:TimeUnit

the unit of the delay

Returns:Future<T>

the timeout future

toCompletionStageback to summary
public default CompletionStage<T> toCompletionStage()

Bridges this Vert.x future to a CompletionStage instance.

The CompletionStage handling methods will be called from the thread that resolves this future.

Returns:CompletionStage<T>

a CompletionStage that completes when this future resolves

Annotations
@GenIgnore
transformback to summary
public <U> Future<U> transform(Function<AsyncResult<T>, Future<U>> mapper)

Transform this future with a mapper functions.

When this future (the one on which transform is called) completes, the mapper will be called with the async result and this mapper returns another future object. This returned future completion will complete the future returned by this method call.

If any mapper function throws an exception, the returned future will be failed with this exception.

Parameters
mapper:Function<AsyncResult<T>, Future<U>>

the function mapping the future

Returns:Future<U>

the transformed future