Class GridCompoundFuture<T,R>
java.lang.Object
org.apache.ignite.internal.util.future.GridFutureAdapter<R>
org.apache.ignite.internal.util.future.GridCompoundFuture<T,R>
- All Implemented Interfaces:
Serializable,org.apache.ignite.internal.IgniteInternalFuture<R>,IgniteInClosure<org.apache.ignite.internal.IgniteInternalFuture<T>>
public class GridCompoundFuture<T,R>
extends GridFutureAdapter<R>
implements IgniteInClosure<org.apache.ignite.internal.IgniteInternalFuture<T>>
Future composed of multiple inner futures.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal GridCompoundFuture<T,R> Adds a future to this compound future.final voidClosure body.booleancancel()Default no-op implementation that always returnsfalse.protected final voidclear()Clear futures.protected final org.apache.ignite.internal.IgniteInternalFuture<T>future(int idx) Returns future at the specified position in this list.final Collection<org.apache.ignite.internal.IgniteInternalFuture<T>>futures()Gets collection of futures.protected final intprotected final booleanprotected final booleanChecks if there are pending futures.protected booleanignoreFailure(Throwable err) Checks if this compound future should ignore this particular exception.final booleanprotected voidlogDebug(IgniteLogger log, String msg) protected voidlogError(IgniteLogger log, String msg, Throwable e) final GridCompoundFuture<T,R> Mark this future as initialized.protected booleanprocessFailure(Throwable err, org.apache.ignite.internal.IgniteInternalFuture<T> fut) Processes error thrown by some of the inner futures.toString()Methods inherited from class org.apache.ignite.internal.util.future.GridFutureAdapter
chain, chain, error, get, get, get, getUninterruptibly, ignoreInterrupts, isCancelled, isDone, isFailed, listen, logger, onCancelled, onDone, onDone, onDone, onDone, onDone, reset, result
-
Constructor Details
-
GridCompoundFuture
public GridCompoundFuture()Default constructor. -
GridCompoundFuture
- Parameters:
rdc- Reducer.
-
-
Method Details
-
apply
Closure body.- Specified by:
applyin interfaceIgniteInClosure<T>- Parameters:
fut- Closure argument.
-
cancel
Default no-op implementation that always returnsfalse. Futures that do support cancellation should override this method and callGridFutureAdapter.onCancelled()callback explicitly if cancellation indeed did happen.- Specified by:
cancelin interfaceorg.apache.ignite.internal.IgniteInternalFuture<T>- Overrides:
cancelin classGridFutureAdapter<R>- Returns:
Trueif future was canceled (i.e. was not finished prior to this call).- Throws:
IgniteCheckedException- If cancellation failed.
-
futures
Gets collection of futures.- Returns:
- Collection of futures.
-
ignoreFailure
Checks if this compound future should ignore this particular exception.- Parameters:
err- Exception to check.- Returns:
Trueif this error should be ignored.
-
processFailure
protected boolean processFailure(Throwable err, org.apache.ignite.internal.IgniteInternalFuture<T> fut) Processes error thrown by some of the inner futures.- Parameters:
err- Thrown exception.fut- Failed future.- Returns:
Trueif this error should be ignored.
-
hasPending
protected final boolean hasPending()Checks if there are pending futures. This is not the same asGridFutureAdapter.isDone()because child classes may overrideGridFutureAdapter.onDone(Object, Throwable)call and delay completion.- Returns:
Trueif there are pending futures.
-
add
Adds a future to this compound future.- Parameters:
fut- Future to add.
-
clear
protected final void clear()Clear futures. -
initialized
public final boolean initialized()- Returns:
Trueif this future was initialized. Initialization happens whenmarkInitialized()method is called on future.
-
markInitialized
Mark this future as initialized. -
logError
- Parameters:
log- IgniteLogger.msg- ShortMessage.e- Exception.
-
logDebug
- Parameters:
log- IgniteLogger.msg- ShortMessage.
-
future
Returns future at the specified position in this list.- Parameters:
idx- - index index of the element to return- Returns:
- Future.
-
futuresCountNoLock
protected final int futuresCountNoLock()- Returns:
- Futures size.
-
hasFutures
protected final boolean hasFutures()- Returns:
Trueif has at least one future.
-
toString
- Overrides:
toStringin classGridFutureAdapter<R>
-