| Constructor and Description |
|---|
CloseFuture() |
CloseFuture(Closeable resource) |
| Modifier and Type | Method and Description |
|---|---|
Throwable |
cause()
A Throwable describing failure.
|
void |
close(Promise<Void> promise)
Called by client
|
<U> Future<U> |
compose(Function<Void,Future<U>> successMapper,
Function<Throwable,Future<U>> failureMapper)
Compose this future with a
successMapper and failureMapper functions. |
<U> Future<Void> |
eventually(Function<Void,Future<U>> mapper)
Compose this future with a
mapper that will be always be called. |
boolean |
failed()
Did it fail?
|
void |
init(Closeable closeable) |
boolean |
isClosed() |
boolean |
isComplete()
Has the future completed?
|
<U> Future<U> |
map(Function<Void,U> mapper)
Apply a
mapper function on this future. |
<V> Future<V> |
map(V value)
Map the result of a future to a specific
value. |
Future<Void> |
onComplete(Handler<AsyncResult<Void>> handler)
Add a handler to be notified of the result.
|
Future<Void> |
otherwise(Function<Throwable,Void> mapper)
Apply a
mapper function on this future. |
Future<Void> |
otherwise(Void value)
Map the failure of a future to a specific
value. |
Void |
result()
The result of the operation.
|
boolean |
succeeded()
Did it succeed?
|
<U> Future<U> |
transform(Function<AsyncResult<Void>,Future<U>> mapper)
Transform this future with a
mapper functions. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcompose, failedFuture, failedFuture, flatMap, fromCompletionStage, fromCompletionStage, future, mapEmpty, onFailure, onSuccess, otherwiseEmpty, recover, succeededFuture, succeededFuture, toCompletionStagepublic CloseFuture()
public CloseFuture(Closeable resource)
public void init(Closeable closeable)
public boolean isClosed()
public boolean isComplete()
FutureIt's completed if it's either succeeded or failed.
isComplete in interface Future<Void>public Future<Void> onComplete(Handler<AsyncResult<Void>> handler)
FutureonComplete in interface Future<Void>handler - the handler that will be called with the resultpublic Void result()
Futurepublic Throwable cause()
Futurepublic boolean succeeded()
Futurepublic boolean failed()
Futurepublic <U> Future<U> compose(Function<Void,Future<U>> successMapper, Function<Throwable,Future<U>> failureMapper)
FuturesuccessMapper 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.
public <U> Future<Void> eventually(Function<Void,Future<U>> mapper)
Futuremapper that will be always be called.
When this future (the one on which eventually is called) completes, the mapper 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 mapper will not influence the the nature
of the returned future.
eventually in interface Future<Void>mapper - the function returning the future.public <U> Future<U> transform(Function<AsyncResult<Void>,Future<U>> mapper)
Futuremapper 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.
public <U> Future<U> map(Function<Void,U> mapper)
Futuremapper 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.
public <V> Future<V> map(V value)
Futurevalue.
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.
public Future<Void> otherwise(Function<Throwable,Void> mapper)
Futuremapper 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.
public Future<Void> otherwise(Void value)
Futurevalue.
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.
Copyright © 2021. All rights reserved.