public static class AbstractGemFireOperationsSessionRepository.GemFireSession extends java.lang.Object implements java.lang.Comparable<ExpiringSession>, com.gemstone.gemfire.DataSerializable, com.gemstone.gemfire.Delta, ExpiringSession
ExpiringSession
that stores and manages Session state information in GemFire. This class implements
GemFire's DataSerializable
interface to better handle replication of Session
state information across the GemFire cluster.Modifier and Type | Field and Description |
---|---|
protected static boolean |
DEFAULT_ALLOW_JAVA_SERIALIZATION |
protected static java.lang.String |
SPRING_SECURITY_CONTEXT |
protected static java.text.DateFormat |
TO_STRING_DATE_FORMAT |
Modifier | Constructor and Description |
---|---|
protected |
GemFireSession() |
protected |
GemFireSession(ExpiringSession session) |
protected |
GemFireSession(java.lang.String id) |
Modifier and Type | Method and Description |
---|---|
protected boolean |
allowJavaSerialization() |
int |
compareTo(ExpiringSession session) |
static AbstractGemFireOperationsSessionRepository.GemFireSession |
copy(ExpiringSession session) |
static AbstractGemFireOperationsSessionRepository.GemFireSession |
create(int maxInactiveIntervalInSeconds) |
boolean |
equals(java.lang.Object obj) |
static AbstractGemFireOperationsSessionRepository.GemFireSession |
from(ExpiringSession session) |
void |
fromData(java.io.DataInput in) |
void |
fromDelta(java.io.DataInput in) |
<T> T |
getAttribute(java.lang.String attributeName)
Gets the Object associated with the specified name or null if no Object is
associated to that name.
|
java.util.Set<java.lang.String> |
getAttributeNames()
Gets the attribute names that have a value associated with it.
|
AbstractGemFireOperationsSessionRepository.GemFireSessionAttributes |
getAttributes() |
long |
getCreationTime()
Gets the time when this session was created in milliseconds since midnight of
1/1/1970 GMT.
|
java.lang.String |
getId()
Gets a unique string that identifies the
Session . |
long |
getLastAccessedTime()
Gets the last time this
Session was accessed expressed in milliseconds
since midnight of 1/1/1970 GMT. |
int |
getMaxInactiveIntervalInSeconds()
Gets the maximum inactive interval in seconds between requests before this session
will be invalidated.
|
java.lang.String |
getPrincipalName() |
boolean |
hasDelta() |
int |
hashCode() |
boolean |
isExpired()
Returns true if the session is expired.
|
void |
removeAttribute(java.lang.String attributeName)
Removes the attribute with the provided attribute name.
|
void |
setAttribute(java.lang.String attributeName,
java.lang.Object attributeValue)
Sets the attribute value for the provided attribute name.
|
void |
setLastAccessedTime(long lastAccessedTime)
Sets the last accessed time in milliseconds since midnight of 1/1/1970 GMT.
|
void |
setMaxInactiveIntervalInSeconds(int maxInactiveIntervalInSeconds)
Sets the maximum inactive interval in seconds between requests before this session
will be invalidated.
|
void |
setPrincipalName(java.lang.String principalName) |
void |
toData(java.io.DataOutput out) |
void |
toDelta(java.io.DataOutput out) |
java.lang.String |
toString() |
protected static final boolean DEFAULT_ALLOW_JAVA_SERIALIZATION
protected static final java.text.DateFormat TO_STRING_DATE_FORMAT
protected static final java.lang.String SPRING_SECURITY_CONTEXT
protected GemFireSession()
protected GemFireSession(java.lang.String id)
protected GemFireSession(ExpiringSession session)
public static AbstractGemFireOperationsSessionRepository.GemFireSession create(int maxInactiveIntervalInSeconds)
public static AbstractGemFireOperationsSessionRepository.GemFireSession copy(ExpiringSession session)
public static AbstractGemFireOperationsSessionRepository.GemFireSession from(ExpiringSession session)
protected boolean allowJavaSerialization()
public java.lang.String getId()
Session
Session
.public long getCreationTime()
ExpiringSession
getCreationTime
in interface ExpiringSession
public void setAttribute(java.lang.String attributeName, java.lang.Object attributeValue)
Session
Session.removeAttribute(String)
.setAttribute
in interface Session
attributeName
- the attribute name to setattributeValue
- the value of the attribute to set. If null, the attribute
will be removed.public void removeAttribute(java.lang.String attributeName)
Session
removeAttribute
in interface Session
attributeName
- the name of the attribute to removepublic <T> T getAttribute(java.lang.String attributeName)
Session
getAttribute
in interface Session
T
- The return type of the attributeattributeName
- the name of the attribute to getpublic java.util.Set<java.lang.String> getAttributeNames()
Session
Session.getAttribute(String)
to
obtain the attribute value.getAttributeNames
in interface Session
Session.getAttribute(String)
public AbstractGemFireOperationsSessionRepository.GemFireSessionAttributes getAttributes()
public boolean isExpired()
ExpiringSession
isExpired
in interface ExpiringSession
public void setLastAccessedTime(long lastAccessedTime)
ExpiringSession
setLastAccessedTime
in interface ExpiringSession
lastAccessedTime
- the last accessed time in milliseconds since midnight of
1/1/1970 GMTpublic long getLastAccessedTime()
ExpiringSession
Session
was accessed expressed in milliseconds
since midnight of 1/1/1970 GMT.getLastAccessedTime
in interface ExpiringSession
public void setMaxInactiveIntervalInSeconds(int maxInactiveIntervalInSeconds)
ExpiringSession
setMaxInactiveIntervalInSeconds
in interface ExpiringSession
maxInactiveIntervalInSeconds
- the number of seconds that the Session
should be kept alive
between client requests.public int getMaxInactiveIntervalInSeconds()
ExpiringSession
getMaxInactiveIntervalInSeconds
in interface ExpiringSession
public void setPrincipalName(java.lang.String principalName)
public java.lang.String getPrincipalName()
public void toData(java.io.DataOutput out) throws java.io.IOException
toData
in interface com.gemstone.gemfire.DataSerializable
java.io.IOException
public void fromData(java.io.DataInput in) throws java.lang.ClassNotFoundException, java.io.IOException
fromData
in interface com.gemstone.gemfire.DataSerializable
java.lang.ClassNotFoundException
java.io.IOException
public boolean hasDelta()
hasDelta
in interface com.gemstone.gemfire.Delta
public void toDelta(java.io.DataOutput out) throws java.io.IOException
toDelta
in interface com.gemstone.gemfire.Delta
java.io.IOException
public void fromDelta(java.io.DataInput in) throws java.io.IOException
fromDelta
in interface com.gemstone.gemfire.Delta
java.io.IOException
public int compareTo(ExpiringSession session)
compareTo
in interface java.lang.Comparable<ExpiringSession>
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object