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 voidcompleteExceptionally(Throwable exception) protected final voidcompleteSuccessfully(Object lockObj) protected final voidcompleteWithResult(Object lockObj, Object result) protected final Objectprotected final booleanisInProgress(Object lockObj) protected final booleanprotected final booleanwaitForCompletion(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:
getResultin classConcurrentExecutionStatus
-
register
- Specified by:
registerin classConcurrentExecutionStatus- Returns:
trueif registration was successful.
-
isInProgress
- Specified by:
isInProgressin classConcurrentExecutionStatus
-
completeSuccessfully
- Specified by:
completeSuccessfullyin classConcurrentExecutionStatus
-
completeWithResult
- Specified by:
completeWithResultin classConcurrentExecutionStatus
-
completeExceptionally
- Specified by:
completeExceptionallyin classConcurrentExecutionStatus
-
waitForCompletion
Waits until either exceptional or successful completion conditions are signalled.- Specified by:
waitForCompletionin classConcurrentExecutionStatus- Returns:
- Whether the completion was successful (
true) or exceptional (false).
-
waitForExceptionalCompletion
- Overrides:
waitForExceptionalCompletionin classConcurrentExecutionStatus
-