Class LeaseManager

  • All Implemented Interfaces:
    ILeaseManager

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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean cancelLease()
      Cancel the lease if this instance is the current owner
      boolean hasLease()
      Do we have the lease?
      void signalHeartbeat()
      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.
      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
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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:
      • 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