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 longDEFAULT_OPERATION_TIMEOUT_MILLISDefault timeout for primitive operations. -
Method Summary
Modifier and Type Method Description default voidaddStateChangeListener(java.util.function.Consumer<PrimitiveState> listener)Registers a listener to be called when the primitive's state changes.Stringname()Returns the name of this primitive.PrimitiveProtocolprotocol()Returns the primitive protocol.default voidremoveStateChangeListener(java.util.function.Consumer<PrimitiveState> listener)Unregisters a previously registered listener to be called when the primitive's state changes.PrimitiveTypetype()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
-