Package io.milton.http
Class LockTimeout
- java.lang.Object
-
- io.milton.http.LockTimeout
-
- All Implemented Interfaces:
Serializable
public class LockTimeout extends Object implements Serializable
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classLockTimeout.DateAndSeconds
-
Constructor Summary
Constructors Constructor Description LockTimeout(Long timeout)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static LockTimeout.DateAndSecondsaddSeconds(Long l)LockTimeout.DateAndSecondsgetLockedUntil(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.Long[]getOtherSeconds()LonggetSeconds()static LockTimeoutparseTimeout(Request request)static LockTimeoutparseTimeout(String s)StringtoString()
-
-
-
Constructor Detail
-
LockTimeout
public LockTimeout(Long timeout)
- Parameters:
timeout- - duration that the lock will live for, in seconds
-
-
Method Detail
-
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
-
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)
-
-