Top Description Inners Fields Constructors Methods
io.vertx.core.impl.future

public Class FutureImpl<T>

extends FutureBase<T>
Class Inheritance
Known Direct Subclasses
io.vertx.core.impl.future.Operation, io.vertx.core.impl.future.PromiseImpl, io.vertx.core.impl.TimerImpl, io.vertx.core.impl.future.CompositeFutureImpl
Imports
io.vertx.core.AsyncResult, .Future, .Handler, io.vertx.core.impl.ContextInternal, .NoStackTraceThrowable, java.util.ArrayList, .Objects

Future implementation.
Author
Julien Viet

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class

Field Summary

Modifier and TypeField and Description
private Listener<T>
private static final Object
private Object
Inherited from io.vertx.core.impl.future.FutureBase:
context

Constructor Summary

AccessConstructor and Description
protected
FutureImpl()

Create a future that hasn't completed yet

protected
FutureImpl(ContextInternal context)

Create a future that hasn't completed yet

Method Summary

Modifier and TypeMethod and Description
public void
addListener(Listener<T>
the listener
listener
)

Implements io.vertx.core.impl.future.FutureInternal.addListener.

Add a listener to the future result.

public synchronized Throwable
cause()

Implements io.vertx.core.Future.cause.

An exception describing failure.

public synchronized boolean
failed()

Implements io.vertx.core.Future.failed.

Did it fail?

protected void
public synchronized boolean
isComplete()

Implements io.vertx.core.Future.isComplete.

Has it completed?

public Future<T>
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
)

Overrides default io.vertx.core.Future.onComplete.

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

public Future<T>
onComplete(Handler<AsyncResult<T>>
the handler that will be called with the result
handler
)

Implements io.vertx.core.Future.onComplete.

Add a handler to be notified of the result.

public Future<T>
onFailure(Handler<Throwable>
the handler that will be called with the failed result
handler
)

Overrides default io.vertx.core.Future.onFailure.

Add a handler to be notified of the failed result.

public Future<T>
onSuccess(Handler<T>
the handler that will be called with the succeeded result
handler
)

Overrides default io.vertx.core.Future.onSuccess.

Add a handler to be notified of the succeeded result.

public void
removeListener(Listener<T>
the listener
l
)

Implements io.vertx.core.impl.future.FutureInternal.removeListener.

Remove a listener to the future result.

public synchronized T
result()

Implements io.vertx.core.Future.result.

The result of the operation.

public synchronized boolean
succeeded()

Implements io.vertx.core.Future.succeeded.

Did it succeed?

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public boolean
tryComplete(T result)

public boolean
Inherited from io.vertx.core.impl.future.FutureBase:
composecontextemitFailureemitSuccesseventuallyexpectingmapmapotherwiseotherwisetimeouttransform

Field Detail

listenerback to summary
private Listener<T> listener
NULL_VALUEback to summary
private static final Object NULL_VALUE
valueback to summary
private Object value

Constructor Detail

FutureImplback to summary
protected FutureImpl()

Create a future that hasn't completed yet

FutureImplback to summary
protected FutureImpl(ContextInternal context)

Create a future that hasn't completed yet

Method Detail

addListenerback to summary
public void addListener(Listener<T> listener)

Implements io.vertx.core.impl.future.FutureInternal.addListener.

Doc from io.vertx.core.impl.future.FutureInternal.addListener.

Add a listener to the future result.

Parameters
listener:Listener<T>

the listener

Annotations
@Override
causeback to summary
public synchronized Throwable cause()

Implements io.vertx.core.Future.cause.

An exception describing failure. This will be null if the operation succeeded.

Returns:Throwable

Doc from io.vertx.core.Future.cause.

the cause or null if the operation succeeded.

failedback to summary
public synchronized boolean failed()

Implements io.vertx.core.Future.failed.

Did it fail?

Returns:boolean

Doc from io.vertx.core.Future.failed.

true if it failed or false otherwise

formatValueback to summary
protected void formatValue(Object value, StringBuilder sb)
isCompleteback to summary
public synchronized boolean isComplete()

Implements io.vertx.core.Future.isComplete.

Has it completed?

Returns:boolean

Doc from io.vertx.core.Future.isComplete.

true if completed, false if not

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

Overrides default io.vertx.core.Future.onComplete.

Doc from io.vertx.core.Future.onComplete.

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

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

Implements io.vertx.core.Future.onComplete.

Doc from io.vertx.core.Future.onComplete.

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
@Override
onFailureback to summary
public Future<T> onFailure(Handler<Throwable> handler)

Overrides default io.vertx.core.Future.onFailure.

Doc from io.vertx.core.Future.onFailure.

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
@Override
onSuccessback to summary
public Future<T> onSuccess(Handler<T> handler)

Overrides default io.vertx.core.Future.onSuccess.

Doc from io.vertx.core.Future.onSuccess.

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
@Override
removeListenerback to summary
public void removeListener(Listener<T> l)

Implements io.vertx.core.impl.future.FutureInternal.removeListener.

Doc from io.vertx.core.impl.future.FutureInternal.removeListener.

Remove a listener to the future result.

Parameters
l:Listener<T>

the listener

Annotations
@Override
resultback to summary
public synchronized T result()

Implements io.vertx.core.Future.result.

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

Returns:T

Doc from io.vertx.core.Future.result.

the result or null if the operation failed.

succeededback to summary
public synchronized boolean succeeded()

Implements io.vertx.core.Future.succeeded.

Did it succeed?

Returns:boolean

Doc from io.vertx.core.Future.succeeded.

true if it succeded or false otherwise

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override
tryCompleteback to summary
public boolean tryComplete(T result)
tryFailback to summary
public boolean tryFail(Throwable cause)
io.vertx.core.impl.future back to summary

private Class FutureImpl.CauseHolder

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final Throwable

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

causeback to summary
private final Throwable cause

Constructor Detail

CauseHolderback to summary
pack-priv CauseHolder(Throwable cause)
io.vertx.core.impl.future back to summary

private Class FutureImpl.ListenerArray<T>

extends ArrayList<Listener<T>>
implements Listener<T>
Class Inheritance
All Implemented Interfaces
io.vertx.core.impl.future.Listener

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public void
onFailure(Throwable
the failure
failure
)

Implements io.vertx.core.impl.future.Listener.onFailure.

Signal the failure

public void
onSuccess(T
the value
value
)

Implements io.vertx.core.impl.future.Listener.onSuccess.

Signal the success.

Inherited from java.util.ArrayList:
addaddaddAlladdAlladdFirstaddLastclearclonecontainsensureCapacityequalsforEachgetgetFirstgetLasthashCodeindexOfisEmptyiteratorlastIndexOflistIteratorlistIteratorremoveremoveremoveAllremoveFirstremoveIfremoveLastremoveRangereplaceAllretainAllsetsizesortspliteratorsubListtoArraytoArraytrimToSize

Constructor Detail

ListenerArrayback to summary
private ListenerArray()

Method Detail

onFailureback to summary
public void onFailure(Throwable failure)

Implements io.vertx.core.impl.future.Listener.onFailure.

Doc from io.vertx.core.impl.future.Listener.onFailure.

Signal the failure

Parameters
failure:Throwable

the failure

Annotations
@Override
onSuccessback to summary
public void onSuccess(T value)

Implements io.vertx.core.impl.future.Listener.onSuccess.

Doc from io.vertx.core.impl.future.Listener.onSuccess.

Signal the success.

Parameters
value:T

the value

Annotations
@Override