Class FailedFuture
java.lang.Object
com.tccc.kos.commons.util.concurrent.future.FutureWork
com.tccc.kos.commons.util.concurrent.future.FailedFuture
- All Implemented Interfaces:
Abortable
,Cancelable
,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.0
- Version:
- 2022-05-05
-
Field Summary
Fields inherited from class com.tccc.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.tccc.kos.commons.util.concurrent.future.FutureWork
abort, abort, abort, append, cancel, cancel, cancel, cancelTimeout, disableAbortAbandoned, execute, fail, fail, fail, getAbortAbandonedTimeoutMs, getClientData, getData, getEndState, getEstimatedEndTimeMono, getEstimatedTimeMs, getId, getName, getNote, getProgress, getReason, getReasonData, getRemainingTimeMs, getRootFuture, getStartTimeMono, getTracker, interruptIfPending, isAbort, isCancel, isDone, isFail, isInterruptable, isInterrupted, isRunComplete, isRunStarted, isSuccess, isTerminate, prepend, remove, run, setAbortAbandonedTimeoutMs, setData, setEstimatedTimeMs, setInterruptable, setNote, setParent, setProgress, setRemainingTimeMs, setRunnable, setState, setState, setTimeout, setTimeout, setTimeout, success, toString, waitUntilFinished, whenFinished
-
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
-
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
-