Class AbstractGemFireOperationsSessionRepository
java.lang.Object
org.springframework.session.data.gemfire.AbstractGemFireOperationsSessionRepository
- 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>
- Direct Known Subclasses:
GemFireOperationsSessionRepository
,GemFireOperationsSessionRepositorySupport
public abstract class AbstractGemFireOperationsSessionRepository
extends Object
implements org.springframework.context.ApplicationEventPublisherAware, org.springframework.session.FindByIndexNameSessionRepository<org.springframework.session.Session>
AbstractGemFireOperationsSessionRepository
is an abstract base class encapsulating functionality
common to all implementations that support SessionRepository
operations backed by Apache Geode.- Since:
- 1.1.0
- See Also:
-
Duration
Instant
UUID
DataSerializable
DataSerializer
Delta
EntryEvent
Operation
Region
RegionAttributes
Pool
PoolManager
CacheListenerAdapter
ApplicationEvent
ApplicationEventPublisher
ApplicationEventPublisherAware
GemfireOperations
FindByIndexNameSessionRepository
Session
SessionRepository
GemFireHttpSessionConfiguration
EnableGemFireHttpSession
SessionChangedEvent
DeltaAwareDirtyPredicate
IsDirtyPredicate
SessionIdHolder
AbstractSessionEvent
SessionCreatedEvent
SessionDeletedEvent
SessionDestroyedEvent
SessionExpiredEvent
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static class
static class
AbstractGemFireOperationsSessionRepository.GemFireSession<T extends AbstractGemFireOperationsSessionRepository.GemFireSessionAttributes>
AbstractGemFireOperationsSessionRepository.GemFireSession
is a Abstract Data Type (ADT) for a SpringSession
that stores and managesSession
state in Apache Geode or Pivotal GemFire.static class
TheAbstractGemFireOperationsSessionRepository.GemFireSessionAttributes
class is a container for Session attributes implementing both theDataSerializable
andDelta
Pivotal GemFire interfaces for efficient storage and distribution (replication) in GemFire.protected static class
protected static class
-
Field Summary
Fields inherited from interface org.springframework.session.FindByIndexNameSessionRepository
PRINCIPAL_NAME_INDEX_NAME
-
Constructor Summary
ModifierConstructorDescriptionprotected
Protected, default constructor used by extensions ofAbstractGemFireOperationsSessionRepository
in order to affect and assessSessionRepository
configuration and state.AbstractGemFireOperationsSessionRepository
(org.springframework.data.gemfire.GemfireOperations template) Constructs a new instance ofAbstractGemFireOperationsSessionRepository
initialized with a requiredGemfireOperations
object, which is used to perform Apache Geode or Pivotal GemFire data access operations on the cacheRegion
storing and managingSession
state to support thisSessionRepository
and its operations. -
Method Summary
Modifier and TypeMethodDescriptionprotected org.springframework.session.Session
commit
(org.springframework.session.Session session) Commits the givenSession
.protected org.springframework.session.Session
configure
(org.springframework.session.Session session) protected org.springframework.session.Session
delete
(org.springframework.session.Session session) Deletes the givenSession
from Apache Geode / Pivotal GemFire.protected org.springframework.context.ApplicationEventPublisher
Returns a reference to the configuredApplicationEventPublisher
used to publishSession
events
corresponding to Apache Geode/Pivotal GemFire cache events.Returns the configuredIsDirtyPredicate
strategy interface implementation used to determine whether the users' application domain objects are dirty or not.protected org.slf4j.Logger
Return a reference to theLogger
used to log messages.Returns themaximum interval
in which aSession
can remain inactive before theSession
is considered expired.int
Returns the maximum interval in seconds in which aSession
can remain inactive before theSession
is considered expired.protected Optional<AbstractGemFireOperationsSessionRepository.SessionEventHandlerCacheListenerAdapter>
protected org.apache.geode.cache.Region<Object,
org.springframework.session.Session> Returns a reference to the configured Apache Geode / Pivotal GemFire cacheRegion
used to store and manage (HTTP)Session
data.protected String
org.springframework.data.gemfire.GemfireOperations
Returns a reference to thetemplate
used to perform data access operations and other interactions on the cacheRegion
storing and managingSession
state and backing thisSessionRepository
.org.springframework.data.gemfire.GemfireOperations
Deprecated.protected void
handleDeleted
(String sessionId, org.springframework.session.Session session) Handles the deletion of the givenSession
.protected boolean
Determines whetherRegion
register interest is enabled in the current Apache Geode / Pivotal GemFire configuration.protected static boolean
Determines whether the DataSerialization framework has been configured.Constructs a new instance ofAbstractGemFireOperationsSessionRepository.SessionEventHandlerCacheListenerAdapter
.Constructs a new instance ofAbstractGemFireOperationsSessionRepository.SessionIdInterestRegisteringCacheListener
.protected void
publishEvent
(org.springframework.context.ApplicationEvent event) Publishes the specifiedApplicationEvent
to the Spring container thereby notifying other (potentially) interested application components/beans.protected void
registerInterest
(Object sessionId) Registers interest on theSession.getId()
ID} of aSession
.protected org.springframework.session.Session
registerInterest
(org.springframework.session.Session session) Registers interest in the givenSession
in order to receive notifications and updates.protected org.apache.geode.cache.client.Pool
resolvePool
(String name) void
setApplicationEventPublisher
(org.springframework.context.ApplicationEventPublisher applicationEventPublisher) Sets the configuredApplicationEventPublisher
used to publishSession
events
corresponding to Apache Geode/Pivotal GemFire cache events.void
setIsDirtyPredicate
(IsDirtyPredicate dirtyPredicate) Configures theIsDirtyPredicate
strategy interface used to determine whether the users' application domain objects are dirty or not.void
setMaxInactiveInterval
(Duration maxInactiveInterval) Sets themaximum interval
in which aSession
can remain inactive before theSession
is considered expired.void
setMaxInactiveIntervalInSeconds
(int maxInactiveIntervalInSeconds) Sets the maximum interval in seconds in which aSession
can remain inactive before theSession
is considered expired.void
setUseDataSerialization
(boolean useDataSerialization) Sets a condition indicating whether the DataSerialization framework has been configured.protected org.springframework.session.Session
touch
(org.springframework.session.Session session) protected void
unregisterInterest
(Object sessionId) Unregisters interest on theSession.getId()
ID} of aSession
.protected org.springframework.session.Session
unregisterInterest
(org.springframework.session.Session session) Unregisters interest in the givenSession
in order to stop notifications and updates.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
findByIndexNameAndIndexValue, findByPrincipalName
Methods inherited from interface org.springframework.session.SessionRepository
createSession, deleteById, findById, save
-
Constructor Details
-
AbstractGemFireOperationsSessionRepository
protected AbstractGemFireOperationsSessionRepository()Protected, default constructor used by extensions ofAbstractGemFireOperationsSessionRepository
in order to affect and assessSessionRepository
configuration and state. -
AbstractGemFireOperationsSessionRepository
public AbstractGemFireOperationsSessionRepository(org.springframework.data.gemfire.GemfireOperations template) Constructs a new instance ofAbstractGemFireOperationsSessionRepository
initialized with a requiredGemfireOperations
object, which is used to perform Apache Geode or Pivotal GemFire data access operations on the cacheRegion
storing and managingSession
state to support thisSessionRepository
and its operations.- Parameters:
template
-GemfireOperations
object used to interact with the Apache Geode or Pivotal GemFire cacheRegion
storing and managingSession
state; must not be null.- Throws:
IllegalArgumentException
- ifGemfireOperations
is null.- See Also:
-
GemfireOperations
resolveSessionsRegion(GemfireOperations)
initializeSessionsRegion(Region)
newLogger()
-
-
Method Details
-
resolvePool
-
newSessionEventHandler
protected AbstractGemFireOperationsSessionRepository.SessionEventHandlerCacheListenerAdapter newSessionEventHandler()Constructs a new instance ofAbstractGemFireOperationsSessionRepository.SessionEventHandlerCacheListenerAdapter
. -
newSessionIdInterestRegistrar
protected AbstractGemFireOperationsSessionRepository.SessionIdInterestRegisteringCacheListener newSessionIdInterestRegistrar()Constructs a new instance ofAbstractGemFireOperationsSessionRepository.SessionIdInterestRegisteringCacheListener
. -
setApplicationEventPublisher
public void setApplicationEventPublisher(@NonNull org.springframework.context.ApplicationEventPublisher applicationEventPublisher) Sets the configuredApplicationEventPublisher
used to publishSession
events
corresponding to Apache Geode/Pivotal GemFire cache events.- Specified by:
setApplicationEventPublisher
in interfaceorg.springframework.context.ApplicationEventPublisherAware
- Parameters:
applicationEventPublisher
-ApplicationEventPublisher
used to publishSession
-based events; must not be null.- Throws:
IllegalArgumentException
- ifApplicationEventPublisher
is null.- See Also:
-
ApplicationEventPublisher
-
getApplicationEventPublisher
@NonNull protected org.springframework.context.ApplicationEventPublisher getApplicationEventPublisher()Returns a reference to the configuredApplicationEventPublisher
used to publishSession
events
corresponding to Apache Geode/Pivotal GemFire cache events.- Returns:
- the configured
ApplicationEventPublisher
used to publishSession
events
. - See Also:
-
ApplicationEventPublisher
-
setIsDirtyPredicate
Configures theIsDirtyPredicate
strategy interface used to determine whether the users' application domain objects are dirty or not.- Parameters:
dirtyPredicate
-IsDirtyPredicate
strategy interface implementation used to determine whether the users' application domain objects are dirty or not.- See Also:
-
getIsDirtyPredicate
Returns the configuredIsDirtyPredicate
strategy interface implementation used to determine whether the users' application domain objects are dirty or not. Defaults toGemFireHttpSessionConfiguration.DEFAULT_IS_DIRTY_PREDICATE
.- Returns:
- the configured
IsDirtyPredicate
strategy interface used to determine whether the users' application domain objects are dirty or not. - See Also:
-
getLogger
protected org.slf4j.Logger getLogger()Return a reference to theLogger
used to log messages.- Returns:
- a reference to the
Logger
used to log messages. - See Also:
-
Log
-
setMaxInactiveInterval
Sets themaximum interval
in which aSession
can remain inactive before theSession
is considered expired. -
getMaxInactiveInterval
Returns themaximum interval
in which aSession
can remain inactive before theSession
is considered expired. -
setMaxInactiveIntervalInSeconds
public void setMaxInactiveIntervalInSeconds(int maxInactiveIntervalInSeconds) Sets the maximum interval in seconds in which aSession
can remain inactive before theSession
is considered expired.- Parameters:
maxInactiveIntervalInSeconds
- an integer value specifying the maximum interval in seconds that aSession
can remain inactive before theSession
is considered expired.- See Also:
-
getMaxInactiveIntervalInSeconds
public int getMaxInactiveIntervalInSeconds()Returns the maximum interval in seconds in which aSession
can remain inactive before theSession
is considered expired.- Returns:
- an integer value specifying the maximum interval in seconds that a
Session
can remain inactive before theSession
is considered expired. - See Also:
-
isRegisterInterestEnabled
protected boolean isRegisterInterestEnabled()Determines whetherRegion
register interest is enabled in the current Apache Geode / Pivotal GemFire configuration.- Returns:
- a boolean value indicating whether interest registration is enabled.
-
getSessionEventHandler
protected Optional<AbstractGemFireOperationsSessionRepository.SessionEventHandlerCacheListenerAdapter> getSessionEventHandler() -
getSessionsRegion
@NonNull protected org.apache.geode.cache.Region<Object,org.springframework.session.Session> getSessionsRegion()Returns a reference to the configured Apache Geode / Pivotal GemFire cacheRegion
used to store and manage (HTTP)Session
data.- Returns:
- a reference to the configured
Sessions
Region
. - See Also:
-
Session
Region
-
getSessionsRegionName
- Returns:
- a
String
containing the fully qualified name of the cacheRegion
used to store and manageSession
data. - See Also:
-
getSessionsTemplate
@NonNull public org.springframework.data.gemfire.GemfireOperations getSessionsTemplate()Returns a reference to thetemplate
used to perform data access operations and other interactions on the cacheRegion
storing and managingSession
state and backing thisSessionRepository
.- Returns:
- a reference to the
template
used to interact theRegion
storing and managingSession
state. - See Also:
-
GemfireOperations
-
getTemplate
Deprecated. -
setUseDataSerialization
public void setUseDataSerialization(boolean useDataSerialization) Sets a condition indicating whether the DataSerialization framework has been configured.- Parameters:
useDataSerialization
- boolean indicating whether the DataSerialization framework has been configured.
-
isUsingDataSerialization
protected static boolean isUsingDataSerialization()Determines whether the DataSerialization framework has been configured.- Returns:
- a boolean indicating whether the DataSerialization framework has been configured.
- See Also:
-
resolveSystemUsingDataSerialization()
-
commit
@Nullable protected org.springframework.session.Session commit(@Nullable org.springframework.session.Session session) Commits the givenSession
.- Parameters:
session
-Session
to commit, iff theSession
is committable.- Returns:
- the given
Session
- See Also:
-
configure
@Nullable protected org.springframework.session.Session configure(@Nullable org.springframework.session.Session session) -
delete
@Nullable protected org.springframework.session.Session delete(@NonNull org.springframework.session.Session session) Deletes the givenSession
from Apache Geode / Pivotal GemFire.- Parameters:
session
-Session
to delete.- Returns:
- null.
- See Also:
-
Session.getId()
Session
SessionRepository.deleteById(String)
-
handleDeleted
Handles the deletion of the givenSession
.- Parameters:
sessionId
-String
containing theSession.getId()
of the givenSession
.session
- deletedSession
.- See Also:
-
publishEvent
protected void publishEvent(org.springframework.context.ApplicationEvent event) Publishes the specifiedApplicationEvent
to the Spring container thereby notifying other (potentially) interested application components/beans.- Parameters:
event
-ApplicationEvent
to publish.- See Also:
-
ApplicationEventPublisher.publishEvent(ApplicationEvent)
ApplicationEvent
-
registerInterest
protected org.springframework.session.Session registerInterest(@Nullable org.springframework.session.Session session) Registers interest in the givenSession
in order to receive notifications and updates.- Parameters:
session
-Session
of interest to this application that will be registered.- Returns:
- the given
Session
. - See Also:
-
Session.getId()
Session
registerInterest(Object)
-
registerInterest
Registers interest on theSession.getId()
ID} of aSession
. And, only registers interest in the given Session ID iff we have not already registered interest in this Session ID before.- Parameters:
sessionId
-ID
of theSession
of interest to this application.- See Also:
-
Region.registerInterest(Object, InterestResultPolicy, boolean, boolean)
isRegisterInterestEnabled()
-
touch
@NonNull protected org.springframework.session.Session touch(@NonNull org.springframework.session.Session session) - Parameters:
session
-Session
to touch.- Returns:
- the
Session
. - See Also:
-
Session.setLastAccessedTime(Instant)
Session
Instant.now()
-
unregisterInterest
protected org.springframework.session.Session unregisterInterest(@Nullable org.springframework.session.Session session) Unregisters interest in the givenSession
in order to stop notifications and updates.- Parameters:
session
-Session
no longer of any interest to this application that will be unregistered.- Returns:
- the given
Session
. - See Also:
-
Session.getId()
Session
unregisterInterest(Object)
-
unregisterInterest
Unregisters interest on theSession.getId()
ID} of aSession
.- Parameters:
sessionId
-ID
of theSession
no longer of any interest to this application.- See Also:
-
Region.unregisterInterest(Object)
isRegisterInterestEnabled()
-
getSessionsTemplate()
.