Class LeaseManager

  • All Implemented Interfaces:
    ILeaseManager

    public class LeaseManager
    extends Object
    implements ILeaseManager
    Manages acquisition and maintenance of the lease we need before we are allowed to perform any schema changes
    • Method Detail

      • signalHeartbeat

        public void signalHeartbeat()
        Description copied from interface: ILeaseManager
        Marks the heartbeat flag true in the LeaseManager implementation to signal that forward progress is being made so the lease should continue to be held. Ignored (not required) if ILeaseManagerConfig.stayAlive() is true (which is default).
        Specified by:
        signalHeartbeat in interface ILeaseManager
      • hasLease

        public boolean hasLease()
        Description copied from interface: ILeaseManager
        Do we have the lease?
        Specified by:
        hasLease in interface ILeaseManager
        Returns:
      • shutdown

        public void shutdown()
        Stop the maintenance loop
      • waitForLease

        public boolean waitForLease​(int seconds)
        Initial call to try to obtain the lease within the given number of seconds If the lease is obtained, we set up a lease maintenance thread to refresh the lease as long as heartbeat has been set to true since it last ran
        Parameters:
        seconds -
        Returns:
      • cancelLease

        public boolean cancelLease()
        Cancel the lease if this instance is the current owner