public interface DistributedPrimitive
Modifier and Type | Interface and Description |
---|---|
static class |
DistributedPrimitive.Status
Status of distributed primitive.
|
static class |
DistributedPrimitive.Type
Type of distributed primitive.
|
Modifier and Type | Field and Description |
---|---|
static long |
DEFAULT_OPERATION_TIMEOUT_MILLIS
Default timeout for primitive operations.
|
Modifier and Type | Method and Description |
---|---|
default void |
addStatusChangeListener(Consumer<DistributedPrimitive.Status> listener)
Registers a listener to be called when the primitive's status changes.
|
default ApplicationId |
applicationId()
Returns the application owning this primitive.
|
default CompletableFuture<Void> |
destroy()
Purges state associated with this primitive.
|
String |
name()
Returns the name of this primitive.
|
DistributedPrimitive.Type |
primitiveType()
Returns the type of primitive.
|
default void |
removeStatusChangeListener(Consumer<DistributedPrimitive.Status> listener)
Unregisters a previously registered listener to be called when the primitive's status changes.
|
default Collection<Consumer<DistributedPrimitive.Status>> |
statusChangeListeners()
Returns the collection of status change listeners previously registered.
|
static final long DEFAULT_OPERATION_TIMEOUT_MILLIS
String name()
DistributedPrimitive.Type primitiveType()
default ApplicationId applicationId()
default CompletableFuture<Void> destroy()
Implementations 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.
CompletableFuture
that is completed when the operation completesdefault void addStatusChangeListener(Consumer<DistributedPrimitive.Status> listener)
listener
- The listener to be called when the status changes.default void removeStatusChangeListener(Consumer<DistributedPrimitive.Status> listener)
listener
- The listener to unregisterdefault Collection<Consumer<DistributedPrimitive.Status>> statusChangeListeners()