Class LockTimeout

java.lang.Object
io.milton.http.LockTimeout
All Implemented Interfaces:
Serializable

public class LockTimeout extends Object implements Serializable
See Also:
  • Constructor Details

    • LockTimeout

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

    • parseTimeout

      public static LockTimeout parseTimeout(Request request)
    • parseTimeout

      public static LockTimeout parseTimeout(String s)
    • 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
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • 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()
    • addSeconds

      public static LockTimeout.DateAndSeconds addSeconds(Long l)