public abstract class AbstractGemFireOperationsSessionRepository
extends org.apache.geode.cache.util.CacheListenerAdapter<java.lang.Object,org.springframework.session.Session>
implements org.springframework.context.ApplicationEventPublisherAware, org.springframework.session.FindByIndexNameSessionRepository<org.springframework.session.Session>, org.springframework.beans.factory.InitializingBean
AbstractGemFireOperationsSessionRepository is an abstract base class encapsulating functionality
common to all implementations that support SessionRepository operations backed by Apache Geode.DataSerializable,
DataSerializer,
Delta,
Instantiator,
Region,
CacheListenerAdapter,
InitializingBean,
ApplicationEventPublisher,
ApplicationEventPublisherAware,
GemfireOperations,
Expression,
FindByIndexNameSessionRepository,
Session,
SessionRepository,
GemFireHttpSessionConfiguration,
EnableGemFireHttpSession| Modifier and Type | Class and Description |
|---|---|
static class |
AbstractGemFireOperationsSessionRepository.DeltaCapableGemFireSession |
static class |
AbstractGemFireOperationsSessionRepository.DeltaCapableGemFireSessionAttributes |
static class |
AbstractGemFireOperationsSessionRepository.GemFireSession<T extends AbstractGemFireOperationsSessionRepository.GemFireSessionAttributes>
AbstractGemFireOperationsSessionRepository.GemFireSession is a Abstract Data Type (ADT) for a Spring Session that stores and manages
Session state in Apache Geode or Pivotal GemFire. |
static class |
AbstractGemFireOperationsSessionRepository.GemFireSessionAttributes
The GemFireSessionAttributes class is a container for Session attributes implementing
both the
DataSerializable and Delta GemFire interfaces for efficient
storage and distribution (replication) in GemFire. |
| Constructor and Description |
|---|
AbstractGemFireOperationsSessionRepository(org.springframework.data.gemfire.GemfireOperations template)
Constructs an instance of
AbstractGemFireOperationsSessionRepository
with a required GemfireOperations instance used to perform GemFire data access operations
and interactions supporting the SessionRepository operations. |
| Modifier and Type | Method and Description |
|---|---|
void |
afterCreate(org.apache.geode.cache.EntryEvent<java.lang.Object,org.springframework.session.Session> event)
Callback method triggered when an entry is created in the GemFire cache
Region. |
void |
afterDestroy(org.apache.geode.cache.EntryEvent<java.lang.Object,org.springframework.session.Session> event)
Callback method triggered when an entry is destroyed in the GemFire cache
Region. |
void |
afterInvalidate(org.apache.geode.cache.EntryEvent<java.lang.Object,org.springframework.session.Session> event)
Callback method triggered when an entry is invalidated in the GemFire cache
Region. |
void |
afterPropertiesSet()
Callback method during Spring bean initialization that will capture the fully-qualified name
of the cache
Region used to manage Session state and register this SessionRepository
as a GemFire/Geode CacheListener. |
protected org.springframework.session.Session |
delete(org.springframework.session.Session session)
Deletes the given
Session from GemFire. |
protected org.springframework.context.ApplicationEventPublisher |
getApplicationEventPublisher()
Returns a reference to the
ApplicationEventPublisher used to publish Session events
corresponding to GemFire/Geode cache events. |
protected java.lang.String |
getFullyQualifiedRegionName()
Returns the fully-qualified name of the cache
Region used to store and manage Session state. |
protected org.apache.commons.logging.Log |
getLogger()
Return a reference to the
Log used to log messages. |
java.time.Duration |
getMaxInactiveInterval()
Returns the
maximum interval in which a Session can remain inactive
before the Session is considered expired. |
int |
getMaxInactiveIntervalInSeconds()
Returns the maximum interval in seconds in which a
Session can remain inactive
before the Session is considered expired. |
org.springframework.data.gemfire.GemfireOperations |
getTemplate()
Gets a reference to the
template used to perform data access operations
and other interactions on the cache Region backing this SessionRepository. |
protected void |
handleCreated(java.lang.String sessionId,
org.springframework.session.Session session)
Causes Session created events to be published to the Spring application context.
|
protected void |
handleDeleted(java.lang.String sessionId,
org.springframework.session.Session session)
Causes Session deleted events to be published to the Spring application context.
|
protected void |
handleDestroyed(java.lang.String sessionId,
org.springframework.session.Session session)
Causes Session destroyed events to be published to the Spring application context.
|
protected void |
handleExpired(java.lang.String sessionId,
org.springframework.session.Session session)
Causes Session expired events to be published to the Spring application context.
|
protected static boolean |
isUsingDataSerialization()
Determines whether the DataSerialization framework has been configured.
|
protected void |
publishEvent(org.springframework.context.ApplicationEvent event)
Publishes the specified ApplicationEvent to the Spring application context.
|
void |
setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher applicationEventPublisher)
Sets the ApplicationEventPublisher used to publish Session events corresponding to
GemFire cache events.
|
void |
setMaxInactiveInterval(java.time.Duration maxInactiveInterval)
Sets the
maximum interval in which a Session can remain inactive
before the Session is considered expired. |
void |
setMaxInactiveIntervalInSeconds(int maxInactiveIntervalInSeconds)
Sets the maximum interval in seconds in which a
Session can remain inactive
before the Session is considered expired. |
void |
setUseDataSerialization(boolean useDataSerialization)
Sets a condition indicating whether the DataSerialization framework has been configured.
|
protected <T extends org.springframework.session.Session> |
touch(T session)
Updates the
Session.setLastAccessedTime(Instant) property of the Session. |
afterRegionClear, afterRegionCreate, afterRegionDestroy, afterRegionInvalidate, afterRegionLive, afterUpdate, closeclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitfindByIndexNameAndIndexValuepublic AbstractGemFireOperationsSessionRepository(org.springframework.data.gemfire.GemfireOperations template)
AbstractGemFireOperationsSessionRepository
with a required GemfireOperations instance used to perform GemFire data access operations
and interactions supporting the SessionRepository operations.template - GemfireOperations instance used to interact with GemFire; must not be null.java.lang.IllegalArgumentException - if GemfireOperations is null.GemfireOperationspublic void setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher applicationEventPublisher)
setApplicationEventPublisher in interface org.springframework.context.ApplicationEventPublisherAwareapplicationEventPublisher - the Spring ApplicationEventPublisher used to
publish Session-based events; must not be null.java.lang.IllegalArgumentException - if ApplicationEventPublisher is null.ApplicationEventPublisherprotected org.springframework.context.ApplicationEventPublisher getApplicationEventPublisher()
ApplicationEventPublisher used to publish Session events
corresponding to GemFire/Geode cache events.ApplicationEventPublisher used to publish Session events.ApplicationEventPublisherprotected java.lang.String getFullyQualifiedRegionName()
Region used to store and manage Session state.String containing the fully qualified name of the cache Region
used to store and manage Session data.protected org.apache.commons.logging.Log getLogger()
Log used to log messages.Log used to log messages.Logpublic void setMaxInactiveInterval(java.time.Duration maxInactiveInterval)
maximum interval in which a Session can remain inactive
before the Session is considered expired.maxInactiveInterval - Duration specifying the maximum interval that a Session
can remain inactive before the Session is considered expired.Durationpublic java.time.Duration getMaxInactiveInterval()
maximum interval in which a Session can remain inactive
before the Session is considered expired.Duration specifying the maximum interval that a Session can remain inactive
before the Session is considered expired.Durationpublic void setMaxInactiveIntervalInSeconds(int maxInactiveIntervalInSeconds)
Session can remain inactive
before the Session is considered expired.maxInactiveIntervalInSeconds - an integer value specifying the maximum interval in seconds
that a Session can remain inactive before the Sessionis considered expired.setMaxInactiveInterval(Duration)public int getMaxInactiveIntervalInSeconds()
Session can remain inactive
before the Session is considered expired.Session can remain inactive
before the Session is considered expired.getMaxInactiveInterval()public void setUseDataSerialization(boolean useDataSerialization)
useDataSerialization - boolean indicating whether the DataSerialization framework has been configured.protected static boolean isUsingDataSerialization()
public org.springframework.data.gemfire.GemfireOperations getTemplate()
template used to perform data access operations
and other interactions on the cache Region backing this SessionRepository.template used to interact with GemFire/Geode.GemfireOperationspublic void afterPropertiesSet()
throws java.lang.Exception
Region used to manage Session state and register this SessionRepository
as a GemFire/Geode CacheListener.
Additionally, this method registers GemFire/Geode Instantiators
for the AbstractGemFireOperationsSessionRepository.GemFireSession and AbstractGemFireOperationsSessionRepository.GemFireSessionAttributes types to optimize GemFire/Geode's
instantiation logic on deserialization using the data serialization framework when accessing the stored
Session state.afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanjava.lang.Exception - if an error occurs during the initialization process.public void afterCreate(org.apache.geode.cache.EntryEvent<java.lang.Object,org.springframework.session.Session> event)
Region.afterCreate in interface org.apache.geode.cache.CacheListener<java.lang.Object,org.springframework.session.Session>afterCreate in class org.apache.geode.cache.util.CacheListenerAdapter<java.lang.Object,org.springframework.session.Session>event - EntryEvent containing the details of the cache Region operation.EntryEvent,
handleCreated(String, Session)public void afterDestroy(org.apache.geode.cache.EntryEvent<java.lang.Object,org.springframework.session.Session> event)
Region.afterDestroy in interface org.apache.geode.cache.CacheListener<java.lang.Object,org.springframework.session.Session>afterDestroy in class org.apache.geode.cache.util.CacheListenerAdapter<java.lang.Object,org.springframework.session.Session>event - an EntryEvent containing the details of the cache operation.EntryEvent,
handleDestroyed(String, Session)public void afterInvalidate(org.apache.geode.cache.EntryEvent<java.lang.Object,org.springframework.session.Session> event)
Region.afterInvalidate in interface org.apache.geode.cache.CacheListener<java.lang.Object,org.springframework.session.Session>afterInvalidate in class org.apache.geode.cache.util.CacheListenerAdapter<java.lang.Object,org.springframework.session.Session>event - an EntryEvent containing the details of the cache operation.EntryEvent,
handleExpired(String, Session)protected org.springframework.session.Session delete(org.springframework.session.Session session)
Session from GemFire.session - Session to delete.Session.getId(),
SessionRepository.deleteById(String)protected void handleCreated(java.lang.String sessionId,
org.springframework.session.Session session)
sessionId - a String indicating the ID of the Session.session - a reference to the Session triggering the event.SessionCreatedEvent,
Session,
newSessionCreatedEvent(Session, String),
publishEvent(ApplicationEvent)protected void handleDeleted(java.lang.String sessionId,
org.springframework.session.Session session)
sessionId - a String indicating the ID of the Session.session - a reference to the Session triggering the event.SessionDeletedEvent,
Session,
newSessionDeletedEvent(Session, String),
publishEvent(ApplicationEvent),
forget(Object)protected void handleDestroyed(java.lang.String sessionId,
org.springframework.session.Session session)
sessionId - a String indicating the ID of the Session.session - a reference to the Session triggering the event.SessionDestroyedEvent,
Session,
newSessionDestroyedEvent(Session, String),
publishEvent(ApplicationEvent),
forget(Object)protected void handleExpired(java.lang.String sessionId,
org.springframework.session.Session session)
sessionId - a String indicating the ID of the Session.session - a reference to the Session triggering the event.SessionExpiredEvent,
Session,
newSessionExpiredEvent(Session, String),
publishEvent(ApplicationEvent),
forget(Object)protected void publishEvent(org.springframework.context.ApplicationEvent event)
event - the ApplicationEvent to publish.ApplicationEventPublisher.publishEvent(ApplicationEvent),
ApplicationEventprotected <T extends org.springframework.session.Session> T touch(T session)
Session.setLastAccessedTime(Instant) property of the Session.T - Class sub-type of the Session.session - Session to touch.Session.Session.setLastAccessedTime(Instant)