Class GemFireOperationsSessionRepository
java.lang.Object
org.springframework.session.data.gemfire.AbstractGemFireOperationsSessionRepository
org.springframework.session.data.gemfire.GemFireOperationsSessionRepository
- All Implemented Interfaces:
org.springframework.beans.factory.Aware
,org.springframework.context.ApplicationEventPublisherAware
,org.springframework.session.FindByIndexNameSessionRepository<org.springframework.session.Session>
,org.springframework.session.SessionRepository<org.springframework.session.Session>
The
GemFireOperationsSessionRepository
class is a Spring SessionRepository
implementation
that interfaces with and uses Apache Geode or Pivotal GemFire to back and store Spring Sessions.- Since:
- 1.1.0
- See Also:
-
GemfireOperations
Session
SessionRepository
AbstractGemFireOperationsSessionRepository
-
Nested Class Summary
Nested classes/interfaces inherited from class org.springframework.session.data.gemfire.AbstractGemFireOperationsSessionRepository
AbstractGemFireOperationsSessionRepository.DeltaCapableGemFireSession, AbstractGemFireOperationsSessionRepository.DeltaCapableGemFireSessionAttributes, AbstractGemFireOperationsSessionRepository.GemFireSession<T extends AbstractGemFireOperationsSessionRepository.GemFireSessionAttributes>, AbstractGemFireOperationsSessionRepository.GemFireSessionAttributes, AbstractGemFireOperationsSessionRepository.SessionEventHandlerCacheListenerAdapter, AbstractGemFireOperationsSessionRepository.SessionIdInterestRegisteringCacheListener
-
Field Summary
Fields inherited from interface org.springframework.session.FindByIndexNameSessionRepository
PRINCIPAL_NAME_INDEX_NAME
-
Constructor Summary
ConstructorDescriptionGemFireOperationsSessionRepository
(org.springframework.data.gemfire.GemfireOperations template) Constructs a new instance ofGemFireOperationsSessionRepository
initialized with the requiredGemfireOperations
object used to perform data access operations for managing (HTTP)Session
state. -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.session.Session
Constructs a newSession
instance backed by GemFire.void
deleteById
(String sessionId) Deletes (removes) any existingSession
from GemFire.org.springframework.session.Session
Finds an existing, non-expiredSession
by ID.findByIndexNameAndIndexValue
(String indexName, String indexValue) protected String
prepareQuery
(String indexName) Prepares the appropriate Pivotal GemFire OQL query based on the indexed Session attribute name.void
save
(org.springframework.session.Session session) Saves the specifiedSession
to Apache Geode or Pivotal GemFire.Methods inherited from class org.springframework.session.data.gemfire.AbstractGemFireOperationsSessionRepository
commit, configure, delete, getApplicationEventPublisher, getIsDirtyPredicate, getLogger, getMaxInactiveInterval, getMaxInactiveIntervalInSeconds, getSessionEventHandler, getSessionsRegion, getSessionsRegionName, getSessionsTemplate, getTemplate, handleDeleted, isRegisterInterestEnabled, isUsingDataSerialization, newSessionEventHandler, newSessionIdInterestRegistrar, publishEvent, registerInterest, registerInterest, resolvePool, setApplicationEventPublisher, setIsDirtyPredicate, setMaxInactiveInterval, setMaxInactiveIntervalInSeconds, setUseDataSerialization, touch, unregisterInterest, unregisterInterest
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.session.FindByIndexNameSessionRepository
findByPrincipalName
-
Field Details
-
FIND_SESSIONS_BY_INDEX_NAME_AND_INDEX_VALUE_QUERY
- See Also:
-
FIND_SESSIONS_BY_PRINCIPAL_NAME_QUERY
- See Also:
-
-
Constructor Details
-
GemFireOperationsSessionRepository
public GemFireOperationsSessionRepository(org.springframework.data.gemfire.GemfireOperations template) Constructs a new instance ofGemFireOperationsSessionRepository
initialized with the requiredGemfireOperations
object used to perform data access operations for managing (HTTP)Session
state.- Parameters:
template
-GemfireOperations
object used to access and manageSession
state in GemFire.- See Also:
-
GemfireOperations
-
-
Method Details
-
createSession
@NonNull public org.springframework.session.Session createSession()Constructs a newSession
instance backed by GemFire.- Returns:
- an instance of
Session
backed by GemFire. - See Also:
-
findById
Finds an existing, non-expiredSession
by ID. If theSession
is expired, then theSession
is deleted and null is returned.- Parameters:
sessionId
-String
containing theID
} of theSession
to get.- Returns:
- an existing
Session
by ID or null if noSession
exists or theSession
expired. - See Also:
-
AbstractGemFireOperationsSessionRepository.GemFireSession.from(Session)
GemfireTemplate.get(Object)
Session
AbstractGemFireOperationsSessionRepository.getSessionsTemplate()
prepare(Session)
AbstractGemFireOperationsSessionRepository.delete(Session)
-
findByIndexNameAndIndexValue
public Map<String,org.springframework.session.Session> findByIndexNameAndIndexValue(String indexName, String indexValue) - Parameters:
indexName
-name
of the indexedSession
attribute. (e.g.FindByIndexNameSessionRepository.PRINCIPAL_NAME_INDEX_NAME
).indexValue
-value
of the indexedSession
attribute to search on (e.g. username).- Returns:
- a mapping of
Session.getId()
Session IDs} toSession
objects. - See Also:
-
GemfireTemplate.find(String, Object...)
Session
Map
AbstractGemFireOperationsSessionRepository.getSessionsTemplate()
prepareQuery(String)
prepare(Session)
-
prepareQuery
Prepares the appropriate Pivotal GemFire OQL query based on the indexed Session attribute name.- Parameters:
indexName
- a String indicating the name of the indexed Session attribute.- Returns:
- an appropriate Pivotal GemFire OQL statement for querying on a particular indexed Session attribute.
- See Also:
-
save
public void save(@Nullable org.springframework.session.Session session) Saves the specifiedSession
to Apache Geode or Pivotal GemFire. Warning, the save method should never be called asynchronously and concurrently, from a separate Thread, while the caller continues to modify the givenSession
from the forking Thread or data loss can occur! There is a reason why this method is blocking!- Parameters:
session
- theSession
to save.- See Also:
-
GemfireOperations.put(Object, Object)
Session
isNonNullAndDirty(Session)
doSave(Session)
-
deleteById
Deletes (removes) any existingSession
from GemFire. This operation also results in a SessionDeletedEvent.- Parameters:
sessionId
- a String indicating the ID of the Session to remove from GemFire.- See Also:
-
GemfireOperations.remove(Object)
AbstractGemFireOperationsSessionRepository.handleDeleted(String, Session)
-