Class MachineIdGuarder.None
- All Implemented Interfaces:
MachineIdGuarder
- Enclosing interface:
- MachineIdGuarder
This implementation provides empty methods that do nothing, useful for testing or when no guarding is needed.
-
Nested Class Summary
Nested classes/interfaces inherited from interface me.ahoo.cosid.machine.MachineIdGuarder
MachineIdGuarder.None -
Field Summary
Fields inherited from interface me.ahoo.cosid.machine.MachineIdGuarder
NONE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets the guardian state for all registered instances.booleanChecks if the machine ID guarder is currently running.voidregister(String namespace, InstanceId instanceId) Registers an instance ID within a specific namespace.voidstart()Starts the machine ID guarder.voidstop()Stops the machine ID guarder.voidunregister(String namespace, InstanceId instanceId) Unregisters an instance ID from a specific namespace.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface me.ahoo.cosid.machine.MachineIdGuarder
hasFailure
-
Constructor Details
-
None
public None()
-
-
Method Details
-
getGuardianStates
Gets the guardian state for all registered instances.This method returns a map of namespaced instance IDs to their current guardian state, including the timestamp of the last guarding operation and any errors that occurred.
This implementation returns an empty map since no instances are registered.
- Specified by:
getGuardianStatesin interfaceMachineIdGuarder- Returns:
- a map of namespaced instance IDs to their guardian state
-
register
Description copied from interface:MachineIdGuarderRegisters an instance ID within a specific namespace.This method associates the given instance ID with the provided namespace, allowing the guarder to track and manage machine IDs for conflict prevention.
- Specified by:
registerin interfaceMachineIdGuarder- Parameters:
namespace- the namespace to register the instance in, must not be nullinstanceId- the instance ID to register, must not be null
-
unregister
Description copied from interface:MachineIdGuarderUnregisters an instance ID from a specific namespace.This method removes the association of the given instance ID with the provided namespace, releasing any resources or locks held for that instance.
- Specified by:
unregisterin interfaceMachineIdGuarder- Parameters:
namespace- the namespace to unregister the instance from, must not be nullinstanceId- the instance ID to unregister, must not be null
-
start
public void start()Description copied from interface:MachineIdGuarderStarts the machine ID guarder.This method initializes the guarder and begins monitoring or guarding machine IDs. After calling start(), the guarder is considered running.
- Specified by:
startin interfaceMachineIdGuarder
-
stop
public void stop()Description copied from interface:MachineIdGuarderStops the machine ID guarder.This method shuts down the guarder and stops monitoring or guarding machine IDs. After calling stop(), the guarder is no longer running.
- Specified by:
stopin interfaceMachineIdGuarder
-
isRunning
public boolean isRunning()Description copied from interface:MachineIdGuarderChecks if the machine ID guarder is currently running.- Specified by:
isRunningin interfaceMachineIdGuarder- Returns:
- true if the guarder is running, false otherwise
-