Package io.atomix.primitive
Interface DistributedPrimitive
- All Known Subinterfaces:
AsyncPrimitive
,SyncPrimitive
- All Known Implementing Classes:
AbstractAsyncPrimitive
,Synchronous
public interface DistributedPrimitive
Interface for all distributed primitives.
-
Field Summary
Fields Modifier and Type Field Description static long
DEFAULT_OPERATION_TIMEOUT_MILLIS
Default timeout for primitive operations. -
Method Summary
Modifier and Type Method Description default void
addStateChangeListener(java.util.function.Consumer<PrimitiveState> listener)
Registers a listener to be called when the primitive's state changes.String
name()
Returns the name of this primitive.PrimitiveProtocol
protocol()
Returns the primitive protocol.default void
removeStateChangeListener(java.util.function.Consumer<PrimitiveState> listener)
Unregisters a previously registered listener to be called when the primitive's state changes.PrimitiveType
type()
Returns the type of primitive.
-
Field Details
-
DEFAULT_OPERATION_TIMEOUT_MILLIS
static final long DEFAULT_OPERATION_TIMEOUT_MILLISDefault timeout for primitive operations.- See Also:
- Constant Field Values
-
-
Method Details
-
name
String name()Returns the name of this primitive.- Returns:
- name
-
type
PrimitiveType type()Returns the type of primitive.- Returns:
- primitive type
-
protocol
PrimitiveProtocol protocol()Returns the primitive protocol.- Returns:
- the primitive protocol
-
addStateChangeListener
Registers a listener to be called when the primitive's state changes.- Parameters:
listener
- The listener to be called when the state changes.
-
removeStateChangeListener
Unregisters a previously registered listener to be called when the primitive's state changes.- Parameters:
listener
- The listener to unregister
-