public abstract class AbstractGemFireOperationsSessionRepository
extends java.lang.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.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
Modifier | Constructor and Description |
---|---|
protected |
AbstractGemFireOperationsSessionRepository()
Protected, default constructor used by extensions of
AbstractGemFireOperationsSessionRepository
in order to affect and assess SessionRepository configuration and state. |
|
AbstractGemFireOperationsSessionRepository(org.springframework.data.gemfire.GemfireOperations template)
Constructs a new instance of
AbstractGemFireOperationsSessionRepository initialized with a required
GemfireOperations object, which is used to perform Apache Geode or Pivotal GemFire data access operations
on the cache Region storing and managing Session state to support this SessionRepository
and its operations. |
Modifier and Type | Method and Description |
---|---|
protected org.springframework.session.Session |
commit(org.springframework.session.Session session)
Commits the given
Session . |
protected org.springframework.session.Session |
configure(org.springframework.session.Session session) |
protected org.springframework.session.Session |
delete(org.springframework.session.Session session)
Deletes the given
Session from Apache Geode / Pivotal GemFire. |
protected org.springframework.context.ApplicationEventPublisher |
getApplicationEventPublisher()
Returns a reference to the configured
ApplicationEventPublisher used to publish Session
events corresponding to Apache Geode/Pivotal GemFire cache events. |
IsDirtyPredicate |
getIsDirtyPredicate()
Returns the configured
IsDirtyPredicate strategy interface implementation used to determine whether
the users' application domain objects are dirty or not. |
protected org.slf4j.Logger |
getLogger()
Return a reference to the
Logger 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. |
protected java.util.Optional<AbstractGemFireOperationsSessionRepository.SessionEventHandlerCacheListenerAdapter> |
getSessionEventHandler() |
protected org.apache.geode.cache.Region<java.lang.Object,org.springframework.session.Session> |
getSessionsRegion()
Returns a reference to the configured Apache Geode / Pivotal GemFire cache
Region used to
store and manage (HTTP) Session data. |
protected java.lang.String |
getSessionsRegionName()
Returns the
fully-qualified name of the cache Region used to store
and manage Session state. |
org.springframework.data.gemfire.GemfireOperations |
getSessionsTemplate()
Returns a reference to the
template used to perform data access operations
and other interactions on the cache Region storing and managing Session state
and backing this SessionRepository . |
org.springframework.data.gemfire.GemfireOperations |
getTemplate()
Deprecated.
|
protected void |
handleDeleted(java.lang.String sessionId,
org.springframework.session.Session session)
Handles the deletion of the given
Session . |
protected boolean |
isRegisterInterestEnabled()
Determines whether
Region register interest is enabled
in the current Apache Geode / Pivotal GemFire configuration. |
protected static boolean |
isUsingDataSerialization()
Determines whether the DataSerialization framework has been configured.
|
protected AbstractGemFireOperationsSessionRepository.SessionEventHandlerCacheListenerAdapter |
newSessionEventHandler()
Constructs a new instance of
AbstractGemFireOperationsSessionRepository.SessionEventHandlerCacheListenerAdapter . |
protected AbstractGemFireOperationsSessionRepository.SessionIdInterestRegisteringCacheListener |
newSessionIdInterestRegistrar()
Constructs a new instance of
AbstractGemFireOperationsSessionRepository.SessionIdInterestRegisteringCacheListener . |
protected void |
publishEvent(org.springframework.context.ApplicationEvent event)
Publishes the specified
ApplicationEvent to the Spring container thereby notifying other (potentially)
interested application components/beans. |
protected void |
registerInterest(java.lang.Object sessionId)
Registers interest on the
Session.getId() ID} of a Session . |
protected org.springframework.session.Session |
registerInterest(org.springframework.session.Session session)
Registers interest in the given
Session in order to receive notifications and updates. |
protected org.apache.geode.cache.client.Pool |
resolvePool(java.lang.String name)
Resolves the
Pool with the given name from the PoolManager . |
void |
setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher applicationEventPublisher)
Sets the configured
ApplicationEventPublisher used to publish Session
events corresponding to Apache Geode/Pivotal GemFire cache events. |
void |
setIsDirtyPredicate(IsDirtyPredicate dirtyPredicate)
Configures the
IsDirtyPredicate strategy interface used to determine whether the users' application
domain objects are dirty or not. |
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 org.springframework.session.Session |
touch(org.springframework.session.Session session)
Updates the
Session.setLastAccessedTime(Instant) property of the Session
to the current time . |
protected void |
unregisterInterest(java.lang.Object sessionId)
Unregisters interest on the
Session.getId() ID} of a Session . |
protected org.springframework.session.Session |
unregisterInterest(org.springframework.session.Session session)
Unregisters interest in the given
Session in order to stop notifications and updates. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
protected AbstractGemFireOperationsSessionRepository()
AbstractGemFireOperationsSessionRepository
in order to affect and assess SessionRepository
configuration and state.public AbstractGemFireOperationsSessionRepository(org.springframework.data.gemfire.GemfireOperations template)
AbstractGemFireOperationsSessionRepository
initialized with a required
GemfireOperations
object, which is used to perform Apache Geode or Pivotal GemFire data access operations
on the cache Region
storing and managing Session
state to support this SessionRepository
and its operations.template
- GemfireOperations
object used to interact with the Apache Geode or Pivotal GemFire
cache Region
storing and managing Session
state; must not be null.java.lang.IllegalArgumentException
- if GemfireOperations
is null.GemfireOperations
,
resolveSessionsRegion(GemfireOperations)
,
initializeSessionsRegion(Region)
,
newLogger()
@Nullable protected org.apache.geode.cache.client.Pool resolvePool(java.lang.String name)
Pool
with the given name
from the PoolManager
.name
- String
containing the name of the Pool
to resolve.Pool
for the given name
.PoolManager.find(String)
,
Pool
protected AbstractGemFireOperationsSessionRepository.SessionEventHandlerCacheListenerAdapter newSessionEventHandler()
AbstractGemFireOperationsSessionRepository.SessionEventHandlerCacheListenerAdapter
.protected AbstractGemFireOperationsSessionRepository.SessionIdInterestRegisteringCacheListener newSessionIdInterestRegistrar()
AbstractGemFireOperationsSessionRepository.SessionIdInterestRegisteringCacheListener
.public void setApplicationEventPublisher(@NonNull org.springframework.context.ApplicationEventPublisher applicationEventPublisher)
ApplicationEventPublisher
used to publish Session
events
corresponding to Apache Geode/Pivotal GemFire cache events.setApplicationEventPublisher
in interface org.springframework.context.ApplicationEventPublisherAware
applicationEventPublisher
- ApplicationEventPublisher
used to publish Session
-based events;
must not be null.java.lang.IllegalArgumentException
- if ApplicationEventPublisher
is null.ApplicationEventPublisher
@NonNull protected org.springframework.context.ApplicationEventPublisher getApplicationEventPublisher()
ApplicationEventPublisher
used to publish Session
events
corresponding to Apache Geode/Pivotal GemFire cache events.ApplicationEventPublisher
used to publish Session
events
.ApplicationEventPublisher
public void setIsDirtyPredicate(IsDirtyPredicate dirtyPredicate)
IsDirtyPredicate
strategy interface used to determine whether the users' application
domain objects are dirty or not.dirtyPredicate
- IsDirtyPredicate
strategy interface implementation used to determine whether
the users' application domain objects are dirty or not.IsDirtyPredicate
public IsDirtyPredicate getIsDirtyPredicate()
IsDirtyPredicate
strategy interface implementation used to determine whether
the users' application domain objects are dirty or not.
Defaults to GemFireHttpSessionConfiguration.DEFAULT_IS_DIRTY_PREDICATE
.IsDirtyPredicate
strategy interface used to determine whether
the users' application domain objects are dirty or not.IsDirtyPredicate
protected org.slf4j.Logger getLogger()
Logger
used to log messages.Logger
used to log messages.Log
public 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.Duration
public 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.Duration
public 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 Session
is 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()
protected boolean isRegisterInterestEnabled()
Region
register interest is enabled
in the current Apache Geode / Pivotal GemFire configuration.protected java.util.Optional<AbstractGemFireOperationsSessionRepository.SessionEventHandlerCacheListenerAdapter> getSessionEventHandler()
@NonNull protected org.apache.geode.cache.Region<java.lang.Object,org.springframework.session.Session> getSessionsRegion()
Region
used to
store and manage (HTTP) Session
data.Sessions
Region
.Session
,
Region
protected java.lang.String getSessionsRegionName()
fully-qualified name
of the cache 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.getSessionsRegion()
@NonNull public org.springframework.data.gemfire.GemfireOperations getSessionsTemplate()
template
used to perform data access operations
and other interactions on the cache Region
storing and managing Session
state
and backing this SessionRepository
.template
used to interact the Region
storing and managing Session
state.GemfireOperations
@Deprecated @NonNull public org.springframework.data.gemfire.GemfireOperations getTemplate()
getSessionsTemplate()
.public void setUseDataSerialization(boolean useDataSerialization)
useDataSerialization
- boolean indicating whether the DataSerialization framework has been configured.protected static boolean isUsingDataSerialization()
resolveSystemUsingDataSerialization()
@Nullable protected org.springframework.session.Session commit(@Nullable org.springframework.session.Session session)
Session
.session
- Session
to commit, iff the Session
is committable.Session
AbstractGemFireOperationsSessionRepository.GemFireSession.commit()
@Nullable protected org.springframework.session.Session configure(@Nullable org.springframework.session.Session session)
@Nullable protected org.springframework.session.Session delete(@NonNull org.springframework.session.Session session)
Session
from Apache Geode / Pivotal GemFire.session
- Session
to delete.Session.getId()
,
Session
,
SessionRepository.deleteById(String)
protected void handleDeleted(java.lang.String sessionId, org.springframework.session.Session session)
Session
.sessionId
- String
containing the Session.getId()
of the given Session
.session
- deleted Session
.AbstractGemFireOperationsSessionRepository.SessionEventHandlerCacheListenerAdapter.afterDelete(String, Session)
,
Session
,
unregisterInterest(Object)
protected void publishEvent(org.springframework.context.ApplicationEvent event)
ApplicationEvent
to the Spring container thereby notifying other (potentially)
interested application components/beans.event
- ApplicationEvent
to publish.ApplicationEventPublisher.publishEvent(ApplicationEvent)
,
ApplicationEvent
protected org.springframework.session.Session registerInterest(@Nullable org.springframework.session.Session session)
Session
in order to receive notifications and updates.session
- Session
of interest to this application that will be registered.Session
.Session.getId()
,
Session
,
registerInterest(Object)
protected void registerInterest(@Nullable java.lang.Object sessionId)
Session.getId()
ID} of a Session
.
And, only registers interest in the given Session ID iff we have not already registered interest
in this Session ID before.sessionId
- ID
of the Session
of interest to this application.Region.registerInterest(Object, InterestResultPolicy, boolean, boolean)
,
isRegisterInterestEnabled()
@NonNull protected org.springframework.session.Session touch(@NonNull org.springframework.session.Session session)
Session.setLastAccessedTime(Instant)
property of the Session
to the current time
.session
- Session
to touch.Session
.Session.setLastAccessedTime(Instant)
,
Session
,
Instant.now()
protected org.springframework.session.Session unregisterInterest(@Nullable org.springframework.session.Session session)
Session
in order to stop notifications and updates.session
- Session
no longer of any interest to this application that will be unregistered.Session
.Session.getId()
,
Session
,
unregisterInterest(Object)
protected void unregisterInterest(@Nullable java.lang.Object sessionId)
Session.getId()
ID} of a Session
.sessionId
- ID
of the Session
no longer of any interest
to this application.Region.unregisterInterest(Object)
,
isRegisterInterestEnabled()