public abstract class AbstractGemFireOperationsSessionRepository extends com.gemstone.gemfire.cache.util.CacheListenerAdapter<java.lang.Object,ExpiringSession> implements org.springframework.beans.factory.InitializingBean, FindByIndexNameSessionRepository<ExpiringSession>, org.springframework.context.ApplicationEventPublisherAware
SessionRepository
operations backed by GemFire.InitializingBean
,
ApplicationEventPublisherAware
,
ExpiringSession
,
FindByIndexNameSessionRepository
,
EnableGemFireHttpSession
,
CacheListenerAdapter
Modifier and Type | Class and Description |
---|---|
static class |
AbstractGemFireOperationsSessionRepository.GemFireSession
GemFireSession is a GemFire representation model of a Spring
ExpiringSession
that stores and manages Session state information in 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. |
static class |
AbstractGemFireOperationsSessionRepository.GemFireSessionAttributesInstantiator
GemFireSessionAttributesInstantiator is a GemFire
Instantiator use to instantiate instances
of the AbstractGemFireOperationsSessionRepository.GemFireSessionAttributes object used in GemFire's data serialization framework when
persisting Session attributes state in GemFire. |
static class |
AbstractGemFireOperationsSessionRepository.GemFireSessionInstantiator
GemFireSessionInstantiator is a GemFire
Instantiator use to instantiate instances
of the AbstractGemFireOperationsSessionRepository.GemFireSession object used in GemFire's data serialization framework when
persisting Session state in GemFire. |
Modifier and Type | Field and Description |
---|---|
protected Log |
logger |
PRINCIPAL_NAME_INDEX_NAME
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(com.gemstone.gemfire.cache.EntryEvent<java.lang.Object,ExpiringSession> event)
Callback method triggered when an entry is created in the GemFire cache
Region . |
void |
afterDestroy(com.gemstone.gemfire.cache.EntryEvent<java.lang.Object,ExpiringSession> event)
Callback method triggered when an entry is destroyed in the GemFire cache
Region . |
void |
afterInvalidate(com.gemstone.gemfire.cache.EntryEvent<java.lang.Object,ExpiringSession> 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 GemFire cache
Region used to manage Session state and register this SessionRepository
as a GemFire CacheListener . |
protected ExpiringSession |
delete(Session session)
Deletes the given
Session from GemFire. |
protected org.springframework.context.ApplicationEventPublisher |
getApplicationEventPublisher()
Gets the ApplicationEventPublisher used to publish Session events corresponding to
GemFire cache events.
|
protected java.lang.String |
getFullyQualifiedRegionName()
Gets the fully-qualified name of the GemFire cache
Region used to store and
manage Session data. |
int |
getMaxInactiveIntervalInSeconds()
Gets the maximum interval in seconds in which a Session can remain inactive before
it is considered expired.
|
org.springframework.data.gemfire.GemfireOperations |
getTemplate()
Gets a reference to the GemfireOperations (template) used to perform data access
operations and other interactions on the GemFire cache
Region backing this
SessionRepository. |
protected void |
handleCreated(java.lang.String sessionId,
ExpiringSession session)
Causes Session created events to be published to the Spring application context.
|
protected void |
handleDeleted(java.lang.String sessionId,
ExpiringSession session)
Causes Session deleted events to be published to the Spring application context.
|
protected void |
handleDestroyed(java.lang.String sessionId,
ExpiringSession session)
Causes Session destroyed events to be published to the Spring application context.
|
protected void |
handleExpired(java.lang.String sessionId,
ExpiringSession session)
Causes Session expired events to be published to the Spring application context.
|
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 |
setMaxInactiveIntervalInSeconds(int maxInactiveIntervalInSeconds)
Sets the maximum interval in seconds in which a Session can remain inactive before
it is considered expired.
|
protected <T extends ExpiringSession> |
touch(T expiringSession)
Updates the
ExpiringSession.setLastAccessedTime(long) property of the ExpiringSession . |
afterRegionClear, afterRegionCreate, afterRegionDestroy, afterRegionInvalidate, afterRegionLive, afterUpdate, close
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
findByIndexNameAndIndexValue
createSession, delete, getSession, save
protected final Log logger
public AbstractGemFireOperationsSessionRepository(org.springframework.data.gemfire.GemfireOperations template)
template
- the GemfireOperations instance used to interact with GemFire.GemfireOperations
public void setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher applicationEventPublisher)
setApplicationEventPublisher
in interface org.springframework.context.ApplicationEventPublisherAware
applicationEventPublisher
- the Spring ApplicationEventPublisher used to
publish Session-based events.ApplicationEventPublisher
protected org.springframework.context.ApplicationEventPublisher getApplicationEventPublisher()
ApplicationEventPublisher
protected java.lang.String getFullyQualifiedRegionName()
Region
used to store and
manage Session data.Region
used to store and manage Session data.public void setMaxInactiveIntervalInSeconds(int maxInactiveIntervalInSeconds)
maxInactiveIntervalInSeconds
- an integer value specifying the maximum
interval in seconds that a Session can remain inactive before it is considered
expired.public int getMaxInactiveIntervalInSeconds()
public org.springframework.data.gemfire.GemfireOperations getTemplate()
Region
backing this
SessionRepository.GemfireOperations
public void afterPropertiesSet() throws java.lang.Exception
Region
used to manage Session state and register this SessionRepository
as a GemFire CacheListener
.
Additionally, this method registers GemFire Instantiator
s for the AbstractGemFireOperationsSessionRepository.GemFireSession
and AbstractGemFireOperationsSessionRepository.GemFireSessionAttributes
types to optimize GemFire's instantiation logic on deserialization
using the data serialization framework when accessing the Session
's state stored in GemFire.afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
java.lang.Exception
- if an error occurs during the initialization process.public void afterCreate(com.gemstone.gemfire.cache.EntryEvent<java.lang.Object,ExpiringSession> event)
Region
.afterCreate
in interface com.gemstone.gemfire.cache.CacheListener<java.lang.Object,ExpiringSession>
afterCreate
in class com.gemstone.gemfire.cache.util.CacheListenerAdapter<java.lang.Object,ExpiringSession>
event
- EntryEvent
containing the details of the cache Region
operation.EntryEvent
,
handleCreated(String, ExpiringSession)
public void afterDestroy(com.gemstone.gemfire.cache.EntryEvent<java.lang.Object,ExpiringSession> event)
Region
.afterDestroy
in interface com.gemstone.gemfire.cache.CacheListener<java.lang.Object,ExpiringSession>
afterDestroy
in class com.gemstone.gemfire.cache.util.CacheListenerAdapter<java.lang.Object,ExpiringSession>
event
- an EntryEvent containing the details of the cache operation.EntryEvent
,
handleDestroyed(String, ExpiringSession)
public void afterInvalidate(com.gemstone.gemfire.cache.EntryEvent<java.lang.Object,ExpiringSession> event)
Region
.afterInvalidate
in interface com.gemstone.gemfire.cache.CacheListener<java.lang.Object,ExpiringSession>
afterInvalidate
in class com.gemstone.gemfire.cache.util.CacheListenerAdapter<java.lang.Object,ExpiringSession>
event
- an EntryEvent containing the details of the cache operation.EntryEvent
,
handleExpired(String, ExpiringSession)
protected ExpiringSession delete(Session session)
Session
from GemFire.session
- Session
to delete.Session
,
SessionRepository.delete(String)
protected void handleCreated(java.lang.String sessionId, ExpiringSession session)
sessionId
- a String indicating the ID of the Session.session
- a reference to the Session triggering the event.SessionCreatedEvent
,
ExpiringSession
,
publishEvent(ApplicationEvent)
protected void handleDeleted(java.lang.String sessionId, ExpiringSession session)
sessionId
- a String indicating the ID of the Session.session
- a reference to the Session triggering the event.SessionDeletedEvent
,
ExpiringSession
,
publishEvent(ApplicationEvent)
protected void handleDestroyed(java.lang.String sessionId, ExpiringSession session)
sessionId
- a String indicating the ID of the Session.session
- a reference to the Session triggering the event.SessionDestroyedEvent
,
ExpiringSession
,
publishEvent(ApplicationEvent)
protected void handleExpired(java.lang.String sessionId, ExpiringSession session)
sessionId
- a String indicating the ID of the Session.session
- a reference to the Session triggering the event.SessionExpiredEvent
,
ExpiringSession
,
publishEvent(ApplicationEvent)
protected void publishEvent(org.springframework.context.ApplicationEvent event)
event
- the ApplicationEvent to publish.ApplicationEventPublisher.publishEvent(ApplicationEvent)
,
ApplicationEvent
protected <T extends ExpiringSession> T touch(T expiringSession)
ExpiringSession.setLastAccessedTime(long)
property of the ExpiringSession
.T
- Class
sub-type of the ExpiringSession
.expiringSession
- ExpiringSession
to touch.ExpiringSession
.ExpiringSession.setLastAccessedTime(long)