com.bradmcevoy.http
Class LockTimeout

java.lang.Object
  extended by com.bradmcevoy.http.LockTimeout
All Implemented Interfaces:
java.io.Serializable

public class LockTimeout
extends java.lang.Object
implements java.io.Serializable

See Also:
Serialized Form

Nested Class Summary
static class LockTimeout.DateAndSeconds
           
 
Constructor Summary
LockTimeout(java.lang.Long timeout)
           
 
Method Summary
static LockTimeout.DateAndSeconds addSeconds(java.lang.Long l)
           
 LockTimeout.DateAndSeconds getLockedUntil(java.lang.Long defaultSeconds, java.lang.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.
 java.lang.Long[] getOtherSeconds()
           
 java.lang.Long getSeconds()
           
static LockTimeout parseTimeout(Request request)
           
static LockTimeout parseTimeout(java.lang.String s)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LockTimeout

public LockTimeout(java.lang.Long timeout)
Method Detail

parseTimeout

public static LockTimeout parseTimeout(Request request)

parseTimeout

public static LockTimeout parseTimeout(java.lang.String s)

getSeconds

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

getOtherSeconds

public java.lang.Long[] getOtherSeconds()
Returns:
- an array of less preferred timeouts

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getLockedUntil

public LockTimeout.DateAndSeconds getLockedUntil(java.lang.Long defaultSeconds,
                                                 java.lang.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(java.lang.Long l)


Copyright © 2011. All Rights Reserved.