Class FailedFuture
java.lang.Object
com.kosdev.kos.commons.util.concurrent.future.FutureWork
com.kosdev.kos.commons.util.concurrent.future.FailedFuture
- All Implemented Interfaces:
Abortable,AttributeAware,Cancelable,ClientAttributeAware,Terminable,Runnable
A future that immediately fails when started. This is useful for
methods that expect to return a future but the expected future
cannot be returned as internal state will not allow it. This class
allows that method to preserve the contract and return a future
that will immediately fail with the specified reason code.
- Since:
- 1
- Version:
- 1
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.kosdev.kos.commons.util.ClientAttributeAware
ClientAttributeAware.Hidden -
Field Summary
Fields inherited from class com.kosdev.kos.commons.util.concurrent.future.FutureWork
REASON_errStartCallbackFailed, REASON_errTimedOut -
Constructor Summary
ConstructorsConstructorDescriptionFailedFuture(String name, String reason) Creates a future that will fail with the specified reason.FailedFuture(String name, String reason, ReasonData data) Creates a future that will fail with the specified reason and data. -
Method Summary
Methods inherited from class com.kosdev.kos.commons.util.concurrent.future.FutureWork
_getClientAttributeMap, abort, abort, abort, append, cancel, cancel, cancel, cancelTimeout, disableAbortAbandoned, execute, extend, fail, fail, fail, getAbortAbandonedTimeoutMs, getAttribute, getClientData, getData, getEndState, getEstimatedEndTimeMono, getEstimatedTimeMs, getId, getName, getNote, getProgress, getReason, getReasonData, getRemainingTimeMs, getRootFuture, getStartTimeMono, getTracker, interruptableSleep, interruptIfPending, isAbort, isCancel, isDone, isEndState, isFail, isInterruptable, isInterrupted, isRunComplete, isRunStarted, isSuccess, isTerminate, prepend, remove, removeAttribute, run, setAbortAbandonedTimeoutMs, setAttribute, setClientData, setData, setEstimatedTimeMs, setInterruptable, setNote, setParent, setProgress, setRemainingTimeMs, setRunnable, setTimeout, setTimeout, setTimeout, sleep, success, successAfterDelay, toString, waitUntilFinished, whenFinishedMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.kosdev.kos.commons.util.ClientAttributeAware
getClientAttribute, getClientAttributes, removeClientAttribute, setClientAttribute, setHiddenClientAttribute
-
Constructor Details
-
FailedFuture
Creates a future that will fail with the specified reason.- Parameters:
name- the name of this future (for diagnostics)reason- the reason for the failure- Since:
- 1
-
FailedFuture
Creates a future that will fail with the specified reason and data.- Parameters:
name- the name of this future (for diagnostics)reason- the reason for the failuredata- associated reason data- Since:
- 1
-