Class AbstractGemFireOperationsSessionRepository.SessionEventHandlerCacheListenerAdapter
java.lang.Object
org.apache.geode.cache.util.CacheListenerAdapter<Object,org.springframework.session.Session>
org.springframework.session.data.gemfire.AbstractGemFireOperationsSessionRepository.SessionEventHandlerCacheListenerAdapter
- All Implemented Interfaces:
org.apache.geode.cache.CacheCallback
,org.apache.geode.cache.CacheListener<Object,
,org.springframework.session.Session> org.apache.geode.cache.Declarable
- Enclosing class:
- AbstractGemFireOperationsSessionRepository
protected static class AbstractGemFireOperationsSessionRepository.SessionEventHandlerCacheListenerAdapter
extends org.apache.geode.cache.util.CacheListenerAdapter<Object,org.springframework.session.Session>
-
Constructor Summary
ModifierConstructorDescriptionprotected
SessionEventHandlerCacheListenerAdapter
(AbstractGemFireOperationsSessionRepository sessionRepository) Constructs a new instance of theAbstractGemFireOperationsSessionRepository.SessionEventHandlerCacheListenerAdapter
initialized with the givenAbstractGemFireOperationsSessionRepository
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
afterCreate
(org.apache.geode.cache.EntryEvent<Object, org.springframework.session.Session> event) Callback method triggered when an entry is created (put) in theSession
cacheRegion
.protected void
afterDelete
(String sessionId, org.springframework.session.Session session) Causes Session deleted events to be published to the Spring application context.void
afterDestroy
(org.apache.geode.cache.EntryEvent<Object, org.springframework.session.Session> event) Callback method triggered when an entry is destroyed (removed) in theSession
cacheRegion
.void
afterInvalidate
(org.apache.geode.cache.EntryEvent<Object, org.springframework.session.Session> event) Callback method triggered when an entry is invalidated (expired) in theSession
cacheRegion
.void
afterUpdate
(org.apache.geode.cache.EntryEvent<Object, org.springframework.session.Session> event) Callback method triggered when an entry is updated in theSession
cacheRegion
.protected boolean
Forgets the givenSession ID
.protected boolean
Forgets theKey
contained in the givenEntryEvent
as aSession ID
.Returns a reference to the configuredSessionRepository
.protected boolean
isLocalLoadEvent
(org.apache.geode.cache.EntryEvent<?, ?> event) Null-safe operation to determine whether theRegion
EntryEvent
is aOperation.LOCAL_LOAD_CREATE
or aOperation.LOCAL_LOAD_UPDATE
.protected boolean
isNotLocalLoadEvent
(org.apache.geode.cache.EntryEvent<?, ?> event) Null-safe operation to determine whether theRegion
EntryEvent
is aOperation.LOCAL_LOAD_CREATE
or aOperation.LOCAL_LOAD_UPDATE
.protected boolean
isRemembered
(Object sessionId) Determines whether the givenSession ID
has been remembered.protected boolean
Determines whether the givenObject
is aSession
.protected boolean
isSession
(org.apache.geode.cache.EntryEvent<?, ?> entryEvent) Determines whether thenew value
contained in theEntryEvent
is aSession
.protected SessionChangedEvent
newSessionChangedEvent
(org.springframework.session.Session session) Constructs a newSessionChangedEvent
initialized with the givenSession
, using theSessionRepository
as the event source.protected org.springframework.session.events.SessionCreatedEvent
newSessionCreatedEvent
(org.springframework.session.Session session) Constructs a newSessionCreatedEvent
initialized with the givenSession
, using theSessionRepository
as the event source.protected org.springframework.session.events.SessionDeletedEvent
newSessionDeletedEvent
(org.springframework.session.Session session) Constructs a newSessionDeletedEvent
initialized with the givenSession
, using theSessionRepository
as the event source.protected org.springframework.session.events.SessionDestroyedEvent
newSessionDestroyedEvent
(org.springframework.session.Session session) Constructs a newSessionDestroyedEvent
initialized with the givenSession
, using theSessionRepository
as the event source.protected org.springframework.session.events.SessionExpiredEvent
newSessionExpiredEvent
(org.springframework.session.Session session) Constructs a newSessionExpiredEvent
initialized with the givenSession
, using theSessionRepository
as the event source.protected boolean
Remembers the givenSession ID
.protected boolean
Remembers theKey
contained by the givenEntryEvent
iff theKey
is a validSession ID
and thenew value
is aSession
.protected org.springframework.session.Session
Methods inherited from class org.apache.geode.cache.util.CacheListenerAdapter
afterRegionClear, afterRegionCreate, afterRegionDestroy, afterRegionInvalidate, afterRegionLive, close
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.geode.cache.Declarable
init, initialize
-
Constructor Details
-
SessionEventHandlerCacheListenerAdapter
protected SessionEventHandlerCacheListenerAdapter(AbstractGemFireOperationsSessionRepository sessionRepository) Constructs a new instance of theAbstractGemFireOperationsSessionRepository.SessionEventHandlerCacheListenerAdapter
initialized with the givenAbstractGemFireOperationsSessionRepository
.- Parameters:
sessionRepository
-AbstractGemFireOperationsSessionRepository
used by this event handler to manageSession Events
.- Throws:
IllegalArgumentException
- ifAbstractGemFireOperationsSessionRepository
is null.- See Also:
-
-
Method Details
-
getSessionRepository
Returns a reference to the configuredSessionRepository
.- Returns:
- a reference to the configured
SessionRepository
. - See Also:
-
afterCreate
public void afterCreate(org.apache.geode.cache.EntryEvent<Object, org.springframework.session.Session> event) Callback method triggered when an entry is created (put) in theSession
cacheRegion
.- Specified by:
afterCreate
in interfaceorg.apache.geode.cache.CacheListener<Object,
org.springframework.session.Session> - Overrides:
afterCreate
in classorg.apache.geode.cache.util.CacheListenerAdapter<Object,
org.springframework.session.Session> - Parameters:
event
-EntryEvent
containing the details of the cache operation.- See Also:
-
SessionCreatedEvent
Session
EntryEvent
newSessionCreatedEvent(Session)
AbstractGemFireOperationsSessionRepository.publishEvent(ApplicationEvent)
toSession(Object, Object)
forget(Object)
-
afterDelete
Causes Session deleted events to be published to the Spring application context.- Parameters:
sessionId
- a String indicating the ID of the Session.session
- a reference to the Session triggering the event.- See Also:
-
afterDestroy
public void afterDestroy(org.apache.geode.cache.EntryEvent<Object, org.springframework.session.Session> event) Callback method triggered when an entry is destroyed (removed) in theSession
cacheRegion
.- Specified by:
afterDestroy
in interfaceorg.apache.geode.cache.CacheListener<Object,
org.springframework.session.Session> - Overrides:
afterDestroy
in classorg.apache.geode.cache.util.CacheListenerAdapter<Object,
org.springframework.session.Session> - Parameters:
event
-EntryEvent
containing the details of the cache operation.- See Also:
-
SessionDestroyedEvent
Session
EntryEvent
newSessionDestroyedEvent(Session)
AbstractGemFireOperationsSessionRepository.publishEvent(ApplicationEvent)
toSession(Object, Object)
forget(Object)
-
afterInvalidate
public void afterInvalidate(org.apache.geode.cache.EntryEvent<Object, org.springframework.session.Session> event) Callback method triggered when an entry is invalidated (expired) in theSession
cacheRegion
.- Specified by:
afterInvalidate
in interfaceorg.apache.geode.cache.CacheListener<Object,
org.springframework.session.Session> - Overrides:
afterInvalidate
in classorg.apache.geode.cache.util.CacheListenerAdapter<Object,
org.springframework.session.Session> - Parameters:
event
-EntryEvent
containing the details of the cache operation.- See Also:
-
SessionExpiredEvent
Session
EntryEvent
newSessionExpiredEvent(Session)
AbstractGemFireOperationsSessionRepository.publishEvent(ApplicationEvent)
toSession(Object, Object)
forget(Object)
-
afterUpdate
public void afterUpdate(org.apache.geode.cache.EntryEvent<Object, org.springframework.session.Session> event) Callback method triggered when an entry is updated in theSession
cacheRegion
.- Specified by:
afterUpdate
in interfaceorg.apache.geode.cache.CacheListener<Object,
org.springframework.session.Session> - Overrides:
afterUpdate
in classorg.apache.geode.cache.util.CacheListenerAdapter<Object,
org.springframework.session.Session> - Parameters:
event
-EntryEvent
containing the details of the cache operation.- See Also:
-
newSessionCreatedEvent
protected org.springframework.session.events.SessionCreatedEvent newSessionCreatedEvent(org.springframework.session.Session session) Constructs a newSessionCreatedEvent
initialized with the givenSession
, using theSessionRepository
as the event source.- Parameters:
session
-Session
that is the subject of theevent
.- Returns:
- a new
SessionCreatedEvent
. - See Also:
-
SessionCreatedEvent
Session
getSessionRepository()
-
newSessionChangedEvent
Constructs a newSessionChangedEvent
initialized with the givenSession
, using theSessionRepository
as the event source.- Parameters:
session
-Session
that is the subject of thechange event
.- Returns:
- a new
SessionChangedEvent
. - See Also:
-
newSessionDeletedEvent
protected org.springframework.session.events.SessionDeletedEvent newSessionDeletedEvent(org.springframework.session.Session session) Constructs a newSessionDeletedEvent
initialized with the givenSession
, using theSessionRepository
as the event source.- Parameters:
session
-Session
that is the subject of theevent
.- Returns:
- a new
SessionDeletedEvent
. - See Also:
-
SessionDeletedEvent
Session
getSessionRepository()
-
newSessionDestroyedEvent
protected org.springframework.session.events.SessionDestroyedEvent newSessionDestroyedEvent(org.springframework.session.Session session) Constructs a newSessionDestroyedEvent
initialized with the givenSession
, using theSessionRepository
as the event source.- Parameters:
session
-Session
that is the subject of theevent
.- Returns:
- a new
SessionDestroyedEvent
. - See Also:
-
SessionDestroyedEvent
Session
getSessionRepository()
-
newSessionExpiredEvent
protected org.springframework.session.events.SessionExpiredEvent newSessionExpiredEvent(org.springframework.session.Session session) Constructs a newSessionExpiredEvent
initialized with the givenSession
, using theSessionRepository
as the event source.- Parameters:
session
-Session
that is the subject of theevent
.- Returns:
- a new
SessionExpiredEvent
. - See Also:
-
SessionExpiredEvent
Session
getSessionRepository()
-
isLocalLoadEvent
protected boolean isLocalLoadEvent(@Nullable org.apache.geode.cache.EntryEvent<?, ?> event) Null-safe operation to determine whether theRegion
EntryEvent
is aOperation.LOCAL_LOAD_CREATE
or aOperation.LOCAL_LOAD_UPDATE
.- Parameters:
event
-Region
EntryEvent
to evaluate.- Returns:
- a boolean value indicating whether the
Region
EntryEvent
is a local load based event. - See Also:
-
EntryEvent
isNotLocalLoadEvent(EntryEvent)
-
isNotLocalLoadEvent
protected boolean isNotLocalLoadEvent(@Nullable org.apache.geode.cache.EntryEvent<?, ?> event) Null-safe operation to determine whether theRegion
EntryEvent
is aOperation.LOCAL_LOAD_CREATE
or aOperation.LOCAL_LOAD_UPDATE
.- Parameters:
event
-Region
EntryEvent
to evaluate.- Returns:
- a boolean value indicating whether the
Region
EntryEvent
is a local load based event. - See Also:
-
EntryEvent
isLocalLoadEvent(EntryEvent)
-
isRemembered
Determines whether the givenSession ID
has been remembered.- Parameters:
sessionId
-Session ID
to evaluate.- Returns:
- return a boolean value determining whether the given
Session ID
has been remembered. - See Also:
-
getCachedSessionIds()
-
forget
protected boolean forget(org.apache.geode.cache.EntryEvent<Object, org.springframework.session.Session> entryEvent) Forgets theKey
contained in the givenEntryEvent
as aSession ID
.- Parameters:
entryEvent
-EntryEvent
to evaluate.- Returns:
- true if the
Key
contained in the givenEntryEvent
was forgotten as aSession ID
. - See Also:
-
Session
EntryEvent
forget(Object)
-
forget
Forgets the givenSession ID
.- Parameters:
sessionId
-Object
containing theSession ID
to forget.- Returns:
- a boolean value indicating whether the given
Session ID
was forgotten. - See Also:
-
getCachedSessionIds()
remember(Object)
-
remember
protected boolean remember(org.apache.geode.cache.EntryEvent<Object, org.springframework.session.Session> entryEvent) Remembers theKey
contained by the givenEntryEvent
iff theKey
is a validSession ID
and thenew value
is aSession
.- Parameters:
entryEvent
-EntryEvent
to evaluate.- Returns:
- true if the
Key
of the givenEntryEvent
is a validSession ID
. - See Also:
-
SessionUtils.isValidSessionId(Object)
isSession(EntryEvent)
remember(Object)
Session
EntryEvent
-
remember
Remembers the givenSession ID
.- Parameters:
sessionId
-Object
containing theSession ID
to remember.- Returns:
- a boolean value indicating whether Spring Session is interested in and will remember
the given
Session ID
. - See Also:
-
getCachedSessionIds()
forget(Object)
-
isSession
protected boolean isSession(org.apache.geode.cache.EntryEvent<?, ?> entryEvent) Determines whether thenew value
contained in theEntryEvent
is aSession
.- Parameters:
entryEvent
-EntryEvent
to evaluate.- Returns:
- a boolean value indicating whether the
new value
contained in theEntryEvent
is aSession
. - See Also:
-
Session
EntryEvent
-
isSession
Determines whether the givenObject
is aSession
. -
toSession
Casts the givenObject
into aSession
iff theObject
is aSession
. Otherwise, this method attempts to use the suppliedSession ID
to create aSession
representation containing only the ID.- Parameters:
target
-Object
to evaluate as aSession
.sessionId
-String
containing theSession ID
.- Returns:
- a
Session
from the givenObject
or aSession
representation containing only the suppliedSession ID
. - Throws:
IllegalStateException
- if the givenObject
is not aSession
and aSession ID
was not supplied.- See Also:
-