java.lang.Object
org.glassfish.grizzly.http.util.TimeStamp
- All Implemented Interfaces:
Serializable
Main tool for object expiry. Marks creation and access time of an "expirable" object, and extra properties like "id",
"valid", etc.
Used for objects that expire - originally Sessions, but also Contexts, Servlets, cache - or any other object that
expires.
- Author:
- Costin Manolache
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionlong
int
getId()
Each object can have an unique id, similar with name but providing faster access ( array vs.long
long
Inactive interval in millis - the time is computed in millis, convert to secs in the upper layergetName()
Return the "name" of the timestamp.boolean
isNew()
boolean
isValid()
void
recycle()
void
setCreationTime
(long time) void
setId
(int id) void
setMaxInactiveInterval
(long interval) void
setNew
(boolean isNew) void
Returns the owner of this stamp ( the object that is time-stamped ).void
setValid
(boolean isValid) void
touch
(long time) Access notification.
-
Constructor Details
-
TimeStamp
public TimeStamp()
-
-
Method Details
-
touch
public void touch(long time) Access notification. This method takes a time parameter in order to allow callers to efficiently manage expensive calls to System.currentTimeMillis() -
getName
Return the "name" of the timestamp. This can be used to associate unique identifier with each timestamped object. The name is a MessageBytes - i.e. a modifiable byte[] or char[]. -
getId
public int getId()Each object can have an unique id, similar with name but providing faster access ( array vs. hashtable lookup ) -
setId
public void setId(int id) -
setParent
Returns the owner of this stamp ( the object that is time-stamped ). For a -
getParent
-
setCreationTime
public void setCreationTime(long time) -
getLastAccessedTime
public long getLastAccessedTime() -
getMaxInactiveInterval
public long getMaxInactiveInterval()Inactive interval in millis - the time is computed in millis, convert to secs in the upper layer -
setMaxInactiveInterval
public void setMaxInactiveInterval(long interval) -
isValid
public boolean isValid() -
setValid
public void setValid(boolean isValid) -
isNew
public boolean isNew() -
setNew
public void setNew(boolean isNew) -
getCreationTime
public long getCreationTime() -
recycle
public void recycle()
-