Class LockTimeout

    • Constructor Detail

      • LockTimeout

        public LockTimeout​(Long timeout)
        Parameters:
        timeout - - duration that the lock will live for, in seconds
    • Method Detail

      • getSeconds

        public Long getSeconds()
        Returns:
        - the preferred timeout. Infinite is represents as Long.MAX_VALUE. Maybe null if no timeout provided
      • getOtherSeconds

        public Long[] getOtherSeconds()
        Returns:
        - an array of less preferred timeouts
      • getLockedUntil

        public LockTimeout.DateAndSeconds getLockedUntil​(Long defaultSeconds,
                                                         Long maxSeconds)
        Returns a current object which holds the expected end date/time, based on defaultSeconds and maxSeconds, as well as the actual seconds used in that calculation. This is handy for locking because we generally want to lock a resource until a specific date/time, but we also want to report back the timeout actually locked in terms of seconds
        Returns:
        - the current time + getSeconds()