public abstract class ExecutingDistributedPrimitive extends DelegatingDistributedPrimitive
Executor.DistributedPrimitive.Status, DistributedPrimitive.TypeDEFAULT_OPERTATION_TIMEOUT_MILLIS| Modifier | Constructor and Description |
|---|---|
protected |
ExecutingDistributedPrimitive(DistributedPrimitive primitive,
Executor orderedExecutor,
Executor threadPoolExecutor) |
| Modifier and Type | Method and Description |
|---|---|
void |
addStatusChangeListener(Consumer<DistributedPrimitive.Status> listener)
Registers a listener to be called when the primitive's status changes.
|
protected <T> CompletableFuture<T> |
asyncFuture(CompletableFuture<T> future)
Creates a future to be completed asynchronously on the provided ordered and thread pool executors.
|
CompletableFuture<Void> |
destroy()
Purges state associated with this primitive.
|
void |
removeStatusChangeListener(Consumer<DistributedPrimitive.Status> listener)
Unregisters a previously registered listener to be called when the primitive's status changes.
|
applicationId, equals, hashCode, name, primitiveType, statusChangeListeners, toStringprotected ExecutingDistributedPrimitive(DistributedPrimitive primitive, Executor orderedExecutor, Executor threadPoolExecutor)
protected <T> CompletableFuture<T> asyncFuture(CompletableFuture<T> future)
T - future result typefuture - the future to be completed asynchronouslyCompletableFuture to be completed asynchronously using the primitive thread modelpublic CompletableFuture<Void> destroy()
DistributedPrimitiveImplementations can override and provide appropriate clean up logic for purging any state state associated with the primitive. Whether modifications made within the destroy method have local or global visibility is left unspecified.
destroy in interface DistributedPrimitivedestroy in class DelegatingDistributedPrimitiveCompletableFuture that is completed when the operation completespublic void addStatusChangeListener(Consumer<DistributedPrimitive.Status> listener)
DistributedPrimitiveaddStatusChangeListener in interface DistributedPrimitiveaddStatusChangeListener in class DelegatingDistributedPrimitivelistener - The listener to be called when the status changes.public void removeStatusChangeListener(Consumer<DistributedPrimitive.Status> listener)
DistributedPrimitiveremoveStatusChangeListener in interface DistributedPrimitiveremoveStatusChangeListener in class DelegatingDistributedPrimitivelistener - The listener to unregister