Class SingleConcurrentExecutionStatus
java.lang.Object
org.eclipse.epsilon.common.concurrent.ConcurrentExecutionStatus
org.eclipse.epsilon.common.concurrent.SingleConcurrentExecutionStatus
Utility class which allows for co-ordinating concurrent execution with waiting
semantics for successful and exceptional completion. This class is only suitable
for single-condition locking, where there is only one success condition registered
at any given time. Multiple conditions can be supported using serial thread confinement
or
MultiConcurrentExecutionStatus
.- Since:
- 1.6
- Author:
- Sina Madani
-
Field Summary
FieldsFields inherited from class org.eclipse.epsilon.common.concurrent.ConcurrentExecutionStatus
exception
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal void
completeExceptionally
(Throwable exception) protected final void
completeSuccessfully
(Object lockObj) protected final void
completeWithResult
(Object lockObj, Object result) protected final Object
protected final boolean
isInProgress
(Object lockObj) protected final boolean
protected final boolean
waitForCompletion
(Object lockObj, Supplier<Boolean> targetState) Waits until either exceptional or successful completion conditions are signalled.Methods inherited from class org.eclipse.epsilon.common.concurrent.ConcurrentExecutionStatus
completeExceptionallyBase, completeSuccessfully, completeWithResult, getException, getResult, isInProgress, register, waitForCompletion, waitForCompletion, waitForCompletion
-
Field Details
-
waitTimeout
protected long waitTimeout
-
-
Constructor Details
-
SingleConcurrentExecutionStatus
public SingleConcurrentExecutionStatus()
-
-
Method Details
-
getResult
- Specified by:
getResult
in classConcurrentExecutionStatus
-
register
- Specified by:
register
in classConcurrentExecutionStatus
- Returns:
true
if registration was successful.
-
isInProgress
- Specified by:
isInProgress
in classConcurrentExecutionStatus
-
completeSuccessfully
- Specified by:
completeSuccessfully
in classConcurrentExecutionStatus
-
completeWithResult
- Specified by:
completeWithResult
in classConcurrentExecutionStatus
-
completeExceptionally
- Specified by:
completeExceptionally
in classConcurrentExecutionStatus
-
waitForCompletion
Waits until either exceptional or successful completion conditions are signalled.- Specified by:
waitForCompletion
in classConcurrentExecutionStatus
- Returns:
- Whether the completion was successful (
true
) or exceptional (false
).
-
waitForExceptionalCompletion
- Overrides:
waitForExceptionalCompletion
in classConcurrentExecutionStatus
-