Spring Session for VMware GemFire
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:
-
DurationInstantUUIDDataSerializableDataSerializerDeltaEntryEventOperationRegionRegionAttributesPoolPoolManagerCacheListenerAdapterApplicationEventApplicationEventPublisherApplicationEventPublisherAwareGemfireOperationsFindByIndexNameSessionRepositorySessionSessionRepositoryGemFireHttpSessionConfigurationEnableGemFireHttpSessionSessionChangedEventDeltaAwareDirtyPredicateIsDirtyPredicateSessionIdHolderAbstractSessionEventSessionCreatedEventSessionDeletedEventSessionDestroyedEventSessionExpiredEvent
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic classAbstractGemFireOperationsSessionRepository.GemFireSession<T extends AbstractGemFireOperationsSessionRepository.GemFireSessionAttributes>AbstractGemFireOperationsSessionRepository.GemFireSessionis a Abstract Data Type (ADT) for a SpringSessionthat stores and managesSessionstate in Apache Geode or Pivotal GemFire.static classTheAbstractGemFireOperationsSessionRepository.GemFireSessionAttributesclass is a container for Session attributes implementing both theDataSerializableandDeltaPivotal GemFire interfaces for efficient storage and distribution (replication) in GemFire.protected static classprotected static class -
Field Summary
Fields inherited from interface org.springframework.session.FindByIndexNameSessionRepository
PRINCIPAL_NAME_INDEX_NAME -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedProtected, default constructor used by extensions ofAbstractGemFireOperationsSessionRepositoryin order to affect and assessSessionRepositoryconfiguration and state.AbstractGemFireOperationsSessionRepository(org.springframework.data.gemfire.GemfireOperations template) Constructs a new instance ofAbstractGemFireOperationsSessionRepositoryinitialized with a requiredGemfireOperationsobject, which is used to perform Apache Geode or Pivotal GemFire data access operations on the cacheRegionstoring and managingSessionstate to support thisSessionRepositoryand its operations. -
Method Summary
Modifier and TypeMethodDescriptionprotected org.springframework.session.Sessioncommit(org.springframework.session.Session session) Commits the givenSession.protected org.springframework.session.Sessionconfigure(org.springframework.session.Session session) protected org.springframework.session.Sessiondelete(org.springframework.session.Session session) Deletes the givenSessionfrom Apache Geode / Pivotal GemFire.protected org.springframework.context.ApplicationEventPublisherReturns a reference to the configuredApplicationEventPublisherused to publishSessioneventscorresponding to Apache Geode/Pivotal GemFire cache events.Returns the configuredIsDirtyPredicatestrategy interface implementation used to determine whether the users' application domain objects are dirty or not.protected org.slf4j.LoggerReturn a reference to theLoggerused to log messages.Returns themaximum intervalin which aSessioncan remain inactive before theSessionis considered expired.intReturns the maximum interval in seconds in which aSessioncan remain inactive before theSessionis 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 cacheRegionused to store and manage (HTTP)Sessiondata.protected Stringorg.springframework.data.gemfire.GemfireOperationsReturns a reference to thetemplateused to perform data access operations and other interactions on the cacheRegionstoring and managingSessionstate and backing thisSessionRepository.org.springframework.data.gemfire.GemfireOperationsDeprecated.protected voidhandleDeleted(String sessionId, org.springframework.session.Session session) Handles the deletion of the givenSession.protected booleanDetermines whetherRegionregister interest is enabled in the current Apache Geode / Pivotal GemFire configuration.protected static booleanDetermines whether the DataSerialization framework has been configured.Constructs a new instance ofAbstractGemFireOperationsSessionRepository.SessionEventHandlerCacheListenerAdapter.Constructs a new instance ofAbstractGemFireOperationsSessionRepository.SessionIdInterestRegisteringCacheListener.protected voidpublishEvent(org.springframework.context.ApplicationEvent event) Publishes the specifiedApplicationEventto the Spring container thereby notifying other (potentially) interested application components/beans.protected voidregisterInterest(Object sessionId) Registers interest on theSession.getId()ID} of aSession.protected org.springframework.session.SessionregisterInterest(org.springframework.session.Session session) Registers interest in the givenSessionin order to receive notifications and updates.protected org.apache.geode.cache.client.PoolresolvePool(String name) voidsetApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher applicationEventPublisher) Sets the configuredApplicationEventPublisherused to publishSessioneventscorresponding to Apache Geode/Pivotal GemFire cache events.voidsetIsDirtyPredicate(IsDirtyPredicate dirtyPredicate) Configures theIsDirtyPredicatestrategy interface used to determine whether the users' application domain objects are dirty or not.voidsetMaxInactiveInterval(Duration maxInactiveInterval) Sets themaximum intervalin which aSessioncan remain inactive before theSessionis considered expired.voidsetMaxInactiveIntervalInSeconds(int maxInactiveIntervalInSeconds) Sets the maximum interval in seconds in which aSessioncan remain inactive before theSessionis considered expired.voidsetUseDataSerialization(boolean useDataSerialization) Sets a condition indicating whether the DataSerialization framework has been configured.protected org.springframework.session.Sessiontouch(org.springframework.session.Session session) protected voidunregisterInterest(Object sessionId) Unregisters interest on theSession.getId()ID} of aSession.protected org.springframework.session.SessionunregisterInterest(org.springframework.session.Session session) Unregisters interest in the givenSessionin order to stop notifications and updates.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.session.FindByIndexNameSessionRepository
findByIndexNameAndIndexValue, findByPrincipalNameMethods inherited from interface org.springframework.session.SessionRepository
createSession, deleteById, findById, save
-
Constructor Details
-
AbstractGemFireOperationsSessionRepository
protected AbstractGemFireOperationsSessionRepository()Protected, default constructor used by extensions ofAbstractGemFireOperationsSessionRepositoryin order to affect and assessSessionRepositoryconfiguration and state. -
AbstractGemFireOperationsSessionRepository
public AbstractGemFireOperationsSessionRepository(org.springframework.data.gemfire.GemfireOperations template) Constructs a new instance ofAbstractGemFireOperationsSessionRepositoryinitialized with a requiredGemfireOperationsobject, which is used to perform Apache Geode or Pivotal GemFire data access operations on the cacheRegionstoring and managingSessionstate to support thisSessionRepositoryand its operations.- Parameters:
template-GemfireOperationsobject used to interact with the Apache Geode or Pivotal GemFire cacheRegionstoring and managingSessionstate; must not be null.- Throws:
IllegalArgumentException- ifGemfireOperationsis null.- See Also:
-
GemfireOperationsresolveSessionsRegion(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 configuredApplicationEventPublisherused to publishSessioneventscorresponding to Apache Geode/Pivotal GemFire cache events.- Specified by:
setApplicationEventPublisherin interfaceorg.springframework.context.ApplicationEventPublisherAware- Parameters:
applicationEventPublisher-ApplicationEventPublisherused to publishSession-based events; must not be null.- Throws:
IllegalArgumentException- ifApplicationEventPublisheris null.- See Also:
-
ApplicationEventPublisher
-
getApplicationEventPublisher
@NonNull protected org.springframework.context.ApplicationEventPublisher getApplicationEventPublisher()Returns a reference to the configuredApplicationEventPublisherused to publishSessioneventscorresponding to Apache Geode/Pivotal GemFire cache events.- Returns:
- the configured
ApplicationEventPublisherused to publishSessionevents. - See Also:
-
ApplicationEventPublisher
-
setIsDirtyPredicate
Configures theIsDirtyPredicatestrategy interface used to determine whether the users' application domain objects are dirty or not.- Parameters:
dirtyPredicate-IsDirtyPredicatestrategy interface implementation used to determine whether the users' application domain objects are dirty or not.- See Also:
-
getIsDirtyPredicate
Returns the configuredIsDirtyPredicatestrategy interface implementation used to determine whether the users' application domain objects are dirty or not. Defaults toGemFireHttpSessionConfiguration.DEFAULT_IS_DIRTY_PREDICATE.- Returns:
- the configured
IsDirtyPredicatestrategy 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 theLoggerused to log messages.- Returns:
- a reference to the
Loggerused to log messages. - See Also:
-
Log
-
setMaxInactiveInterval
Sets themaximum intervalin which aSessioncan remain inactive before theSessionis considered expired. -
getMaxInactiveInterval
Returns themaximum intervalin which aSessioncan remain inactive before theSessionis considered expired. -
setMaxInactiveIntervalInSeconds
public void setMaxInactiveIntervalInSeconds(int maxInactiveIntervalInSeconds) Sets the maximum interval in seconds in which aSessioncan remain inactive before theSessionis considered expired.- Parameters:
maxInactiveIntervalInSeconds- an integer value specifying the maximum interval in seconds that aSessioncan remain inactive before theSessionis considered expired.- See Also:
-
getMaxInactiveIntervalInSeconds
public int getMaxInactiveIntervalInSeconds()Returns the maximum interval in seconds in which aSessioncan remain inactive before theSessionis considered expired.- Returns:
- an integer value specifying the maximum interval in seconds that a
Sessioncan remain inactive before theSessionis considered expired. - See Also:
-
isRegisterInterestEnabled
protected boolean isRegisterInterestEnabled()Determines whetherRegionregister 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 cacheRegionused to store and manage (HTTP)Sessiondata.- Returns:
- a reference to the configured
SessionsRegion. - See Also:
-
SessionRegion
-
getSessionsRegionName
- Returns:
- a
Stringcontaining the fully qualified name of the cacheRegionused to store and manageSessiondata. - See Also:
-
getSessionsTemplate
@NonNull public org.springframework.data.gemfire.GemfireOperations getSessionsTemplate()Returns a reference to thetemplateused to perform data access operations and other interactions on the cacheRegionstoring and managingSessionstate and backing thisSessionRepository.- Returns:
- a reference to the
templateused to interact theRegionstoring and managingSessionstate. - 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-Sessionto commit, iff theSessionis 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 givenSessionfrom Apache Geode / Pivotal GemFire.- Parameters:
session-Sessionto delete.- Returns:
- null.
- See Also:
-
Session.getId()SessionSessionRepository.deleteById(String)
-
handleDeleted
Handles the deletion of the givenSession.- Parameters:
sessionId-Stringcontaining theSession.getId()of the givenSession.session- deletedSession.- See Also:
-
publishEvent
protected void publishEvent(org.springframework.context.ApplicationEvent event) Publishes the specifiedApplicationEventto the Spring container thereby notifying other (potentially) interested application components/beans.- Parameters:
event-ApplicationEventto publish.- See Also:
-
ApplicationEventPublisher.publishEvent(ApplicationEvent)ApplicationEvent
-
registerInterest
protected org.springframework.session.Session registerInterest(@Nullable org.springframework.session.Session session) Registers interest in the givenSessionin order to receive notifications and updates.- Parameters:
session-Sessionof interest to this application that will be registered.- Returns:
- the given
Session. - See Also:
-
Session.getId()SessionregisterInterest(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-IDof theSessionof 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-Sessionto touch.- Returns:
- the
Session. - See Also:
-
Session.setLastAccessedTime(Instant)SessionInstant.now()
-
unregisterInterest
protected org.springframework.session.Session unregisterInterest(@Nullable org.springframework.session.Session session) Unregisters interest in the givenSessionin order to stop notifications and updates.- Parameters:
session-Sessionno longer of any interest to this application that will be unregistered.- Returns:
- the given
Session. - See Also:
-
Session.getId()SessionunregisterInterest(Object)
-
unregisterInterest
Unregisters interest on theSession.getId()ID} of aSession.- Parameters:
sessionId-IDof theSessionno longer of any interest to this application.- See Also:
-
Region.unregisterInterest(Object)isRegisterInterestEnabled()
-
getSessionsTemplate().