Class AbstractGemFireOperationsSessionRepository.GemFireSession<T extends AbstractGemFireOperationsSessionRepository.GemFireSessionAttributes>
java.lang.Object
org.springframework.session.data.gemfire.AbstractGemFireOperationsSessionRepository.GemFireSession<T>
- All Implemented Interfaces:
Comparable<org.springframework.session.Session>
,org.springframework.session.Session
- Direct Known Subclasses:
AbstractGemFireOperationsSessionRepository.DeltaCapableGemFireSession
- Enclosing class:
- AbstractGemFireOperationsSessionRepository
public static class AbstractGemFireOperationsSessionRepository.GemFireSession<T extends AbstractGemFireOperationsSessionRepository.GemFireSessionAttributes>
extends Object
implements Comparable<org.springframework.session.Session>, org.springframework.session.Session
AbstractGemFireOperationsSessionRepository.GemFireSession
is a Abstract Data Type (ADT) for a Spring Session
that stores and manages
Session
state in Apache Geode or Pivotal GemFire.-
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionprotected
Constructs a new, default instance ofAbstractGemFireOperationsSessionRepository.GemFireSession
initialized with a generatedSession Identifier
.protected
GemFireSession
(String id) Constructs a new instance ofAbstractGemFireOperationsSessionRepository.GemFireSession
initialized with the givenSession Identifier
.protected
GemFireSession
(org.springframework.session.Session session) Constructs a new instance ofAbstractGemFireOperationsSessionRepository.GemFireSession
copied from the givenSession
. -
Method Summary
Modifier and TypeMethodDescriptionChange theidentifier
of thisSession
.protected void
commit()
int
compareTo
(org.springframework.session.Session session) configureWith
(Duration maxInactiveInterval) Builder method to configure themax inactive interval
before thisAbstractGemFireOperationsSessionRepository.GemFireSession
will expire.configureWith
(IsDirtyPredicate dirtyPredicate) Builder method to configure theIsDirtyPredicate
strategy interface implementation to determine whether users'application domain objects
stored in thisAbstractGemFireOperationsSessionRepository.GemFireSession
are dirty.copy
(org.springframework.session.Session session) Copy (i.e.static <T extends AbstractGemFireOperationsSessionRepository.GemFireSessionAttributes>
AbstractGemFireOperationsSessionRepository.GemFireSession<T>create()
Factory method used to construct a new, default instance ofAbstractGemFireOperationsSessionRepository.GemFireSession
.boolean
from
(org.springframework.session.Session session) Returns the givenSession
if theSession
is aAbstractGemFireOperationsSessionRepository.GemFireSession
or return a copy of the givenSession
as aAbstractGemFireOperationsSessionRepository.GemFireSession
.<T> T
getAttribute
(String attributeName) getId()
protected IsDirtyPredicate
boolean
hasDelta()
Determines whether thisAbstractGemFireOperationsSessionRepository.GemFireSession
has any changes (i.e.int
hashCode()
boolean
protected T
newSessionAttributes
(Object lock) Constructs a newAbstractGemFireOperationsSessionRepository.GemFireSessionAttributes
object to store and manage Session attributes.void
removeAttribute
(String attributeName) void
setAttribute
(String attributeName, Object attributeValue) protected void
setIsDirtyPredicate
(IsDirtyPredicate dirtyPredicate) void
setLastAccessedTime
(Instant lastAccessedTime) void
setMaxInactiveInterval
(Duration maxInactiveInterval) void
setPrincipalName
(String principalName) toString()
protected void
protected void
triggerDelta
(boolean delta) Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.springframework.session.Session
getAttributeOrDefault, getRequiredAttribute
-
Field Details
-
GEMFIRE_SESSION_TO_STRING
- See Also:
-
SPRING_SECURITY_CONTEXT
- See Also:
-
-
Constructor Details
-
GemFireSession
protected GemFireSession()Constructs a new, default instance ofAbstractGemFireOperationsSessionRepository.GemFireSession
initialized with a generatedSession Identifier
.- See Also:
-
GemFireSession(String)
generateSessionId()
-
GemFireSession
Constructs a new instance ofAbstractGemFireOperationsSessionRepository.GemFireSession
initialized with the givenSession Identifier
. Additionally, thecreationTime
is set toInstant.now()
,lastAccessedTime
is set tocreationTime
and themaxInactiveInterval
is set toDuration.ZERO
.- Parameters:
id
-String
containing the unique identifier for thisSession
.- See Also:
-
validateSessionId(String)
-
GemFireSession
protected GemFireSession(org.springframework.session.Session session) Constructs a new instance ofAbstractGemFireOperationsSessionRepository.GemFireSession
copied from the givenSession
.- Parameters:
session
-Session
to copy.- Throws:
IllegalArgumentException
- ifSession
is null.- See Also:
-
Session
-
-
Method Details
-
create
public static <T extends AbstractGemFireOperationsSessionRepository.GemFireSessionAttributes> AbstractGemFireOperationsSessionRepository.GemFireSession<T> create()Factory method used to construct a new, default instance ofAbstractGemFireOperationsSessionRepository.GemFireSession
.- Type Parameters:
T
-Sub-type
ofAbstractGemFireOperationsSessionRepository.GemFireSessionAttributes
.- Returns:
- a new
AbstractGemFireOperationsSessionRepository.GemFireSession
. - See Also:
-
copy
public static AbstractGemFireOperationsSessionRepository.GemFireSession copy(@NonNull org.springframework.session.Session session) Copy (i.e. clone) the givenSession
.- Parameters:
session
-Session
to copy/clone.- Returns:
- a new instance of
AbstractGemFireOperationsSessionRepository.GemFireSession
copied from the givenSession
. - See Also:
-
from
public static AbstractGemFireOperationsSessionRepository.GemFireSession from(@NonNull org.springframework.session.Session session) Returns the givenSession
if theSession
is aAbstractGemFireOperationsSessionRepository.GemFireSession
or return a copy of the givenSession
as aAbstractGemFireOperationsSessionRepository.GemFireSession
.- Parameters:
session
-Session
to evaluate and possibly copy.- Returns:
- the given
Session
if theSession
is aAbstractGemFireOperationsSessionRepository.GemFireSession
or return a copy of the givenSession
as aAbstractGemFireOperationsSessionRepository.GemFireSession
. - See Also:
-
newSessionAttributes
Constructs a newAbstractGemFireOperationsSessionRepository.GemFireSessionAttributes
object to store and manage Session attributes.- Parameters:
lock
-Object
used as the mutex for concurrent access and Thread-safety.- Returns:
- the new
AbstractGemFireOperationsSessionRepository.GemFireSessionAttributes
. - See Also:
-
changeSessionId
Change theidentifier
of thisSession
.- Specified by:
changeSessionId
in interfaceorg.springframework.session.Session
- Returns:
- the new
identifier
of of thisSession
. - See Also:
-
generateSessionId()
triggerDelta()
getId()
-
commit
protected void commit() -
hasDelta
public boolean hasDelta()Determines whether thisAbstractGemFireOperationsSessionRepository.GemFireSession
has any changes (i.e. a delta). Changes exist if thisGemFireSession's
ID
,last accessed time
,max inactive interval
or any of theseattributes
have changed.- Returns:
- a boolean value indicating whether this
AbstractGemFireOperationsSessionRepository.GemFireSession
has any changes. - See Also:
-
triggerDelta
protected void triggerDelta() -
triggerDelta
protected void triggerDelta(boolean delta) -
getId
- Specified by:
getId
in interfaceorg.springframework.session.Session
-
setAttribute
- Specified by:
setAttribute
in interfaceorg.springframework.session.Session
-
removeAttribute
- Specified by:
removeAttribute
in interfaceorg.springframework.session.Session
-
getAttribute
- Specified by:
getAttribute
in interfaceorg.springframework.session.Session
-
getAttributeNames
- Specified by:
getAttributeNames
in interfaceorg.springframework.session.Session
-
getAttributes
-
getCreationTime
- Specified by:
getCreationTime
in interfaceorg.springframework.session.Session
-
isExpired
public boolean isExpired()- Specified by:
isExpired
in interfaceorg.springframework.session.Session
-
setIsDirtyPredicate
-
getIsDirtyPredicate
-
setLastAccessedTime
- Specified by:
setLastAccessedTime
in interfaceorg.springframework.session.Session
-
getLastAccessedTime
- Specified by:
getLastAccessedTime
in interfaceorg.springframework.session.Session
-
setMaxInactiveInterval
- Specified by:
setMaxInactiveInterval
in interfaceorg.springframework.session.Session
-
getMaxInactiveInterval
- Specified by:
getMaxInactiveInterval
in interfaceorg.springframework.session.Session
-
setPrincipalName
-
getPrincipalName
-
configureWith
public AbstractGemFireOperationsSessionRepository.GemFireSession<T> configureWith(Duration maxInactiveInterval) Builder method to configure themax inactive interval
before thisAbstractGemFireOperationsSessionRepository.GemFireSession
will expire.- Parameters:
maxInactiveInterval
-Duration
specifying the maximum time thisAbstractGemFireOperationsSessionRepository.GemFireSession
can remain inactive before expiration.- Returns:
- this
AbstractGemFireOperationsSessionRepository.GemFireSession
. - See Also:
-
configureWith
public AbstractGemFireOperationsSessionRepository.GemFireSession<T> configureWith(IsDirtyPredicate dirtyPredicate) Builder method to configure theIsDirtyPredicate
strategy interface implementation to determine whether users'application domain objects
stored in thisAbstractGemFireOperationsSessionRepository.GemFireSession
are dirty.- Parameters:
dirtyPredicate
-IsDirtyPredicate
strategy interface implementation that determines whether the users'application domain objects
stored in thisAbstractGemFireOperationsSessionRepository.GemFireSession
are dirty.- Returns:
- this
AbstractGemFireOperationsSessionRepository.GemFireSession
. - See Also:
-
compareTo
public int compareTo(org.springframework.session.Session session) - Specified by:
compareTo
in interfaceComparable<T extends AbstractGemFireOperationsSessionRepository.GemFireSessionAttributes>
-
equals
-
hashCode
public int hashCode() -
toString
-