Class CosIdGuardDistribute

java.lang.Object
me.ahoo.cosid.machine.GuardDistribute
me.ahoo.cosid.spring.boot.starter.machine.CosIdGuardDistribute
All Implemented Interfaces:
MachineIdDistribute, org.springframework.beans.factory.DisposableBean

public class CosIdGuardDistribute extends GuardDistribute implements org.springframework.beans.factory.DisposableBean
The starter's GuardDistribute: it also reverts the machine ids it distributed when the context is destroyed without being stopped, for example when a bean fails while the context starts. Otherwise those machine ids would stay taken for the whole safe guard duration.

Each machine id is reverted once: on a normal shutdown CosIdMachineIdLifecycle reverts them through revert(NamespacedInstanceId), and destroy() has nothing left to do.

  • Constructor Details

  • Method Details

    • revert

      public void revert(NamespacedInstanceId distributedInstance)
      Revert the machine id of the instance, unless it was already reverted. The lease is released first, so that no id is generated with the machine id once it can be handed to another instance.
    • destroy

      public void destroy()
      Specified by:
      destroy in interface org.springframework.beans.factory.DisposableBean