Class MachineIdGuarder.None

java.lang.Object
me.ahoo.cosid.machine.MachineIdGuarder.None
All Implemented Interfaces:
MachineIdGuarder
Enclosing interface:
MachineIdGuarder

public static class MachineIdGuarder.None extends Object implements MachineIdGuarder
A no-operation implementation of MachineIdGuarder.

This implementation provides empty methods that do nothing, useful for testing or when no guarding is needed.

  • Constructor Details

    • None

      public None()
  • Method Details

    • getGuardianStates

      public Map<NamespacedInstanceId,GuardianState> 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:
      getGuardianStates in interface MachineIdGuarder
      Returns:
      a map of namespaced instance IDs to their guardian state
    • register

      public void register(String namespace, InstanceId instanceId)
      Description copied from interface: MachineIdGuarder
      Registers 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:
      register in interface MachineIdGuarder
      Parameters:
      namespace - the namespace to register the instance in, must not be null
      instanceId - the instance ID to register, must not be null
    • unregister

      public void unregister(String namespace, InstanceId instanceId)
      Description copied from interface: MachineIdGuarder
      Unregisters 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:
      unregister in interface MachineIdGuarder
      Parameters:
      namespace - the namespace to unregister the instance from, must not be null
      instanceId - the instance ID to unregister, must not be null
    • start

      public void start()
      Description copied from interface: MachineIdGuarder
      Starts 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:
      start in interface MachineIdGuarder
    • stop

      public void stop()
      Description copied from interface: MachineIdGuarder
      Stops 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:
      stop in interface MachineIdGuarder
    • isRunning

      public boolean isRunning()
      Description copied from interface: MachineIdGuarder
      Checks if the machine ID guarder is currently running.
      Specified by:
      isRunning in interface MachineIdGuarder
      Returns:
      true if the guarder is running, false otherwise