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

    Constructors
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    afterCreate(org.apache.geode.cache.EntryEvent<Object,org.springframework.session.Session> event)
    Callback method triggered when an entry is created (put) in the Session cache Region.
    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 the Session cache Region.
    void
    afterInvalidate(org.apache.geode.cache.EntryEvent<Object,org.springframework.session.Session> event)
    Callback method triggered when an entry is invalidated (expired) in the Session cache Region.
    void
    afterUpdate(org.apache.geode.cache.EntryEvent<Object,org.springframework.session.Session> event)
    Callback method triggered when an entry is updated in the Session cache Region.
    protected boolean
    forget(Object sessionId)
    Forgets the given Session ID.
    protected boolean
    forget(org.apache.geode.cache.EntryEvent<Object,org.springframework.session.Session> entryEvent)
    Forgets the Key contained in the given EntryEvent as a Session ID.
    Returns a reference to the configured SessionRepository.
    protected boolean
    isLocalLoadEvent(org.apache.geode.cache.EntryEvent<?,?> event)
    Null-safe operation to determine whether the Region EntryEvent is a Operation.LOCAL_LOAD_CREATE or a Operation.LOCAL_LOAD_UPDATE.
    protected boolean
    isNotLocalLoadEvent(org.apache.geode.cache.EntryEvent<?,?> event)
    Null-safe operation to determine whether the Region EntryEvent is a Operation.LOCAL_LOAD_CREATE or a Operation.LOCAL_LOAD_UPDATE.
    protected boolean
    isRemembered(Object sessionId)
    Determines whether the given Session ID has been remembered.
    protected boolean
    isSession(Object target)
    Determines whether the given Object is a Session.
    protected boolean
    isSession(org.apache.geode.cache.EntryEvent<?,?> entryEvent)
    Determines whether the new value contained in the EntryEvent is a Session.
    newSessionChangedEvent(org.springframework.session.Session session)
    Constructs a new SessionChangedEvent initialized with the given Session, using the SessionRepository as the event source.
    protected org.springframework.session.events.SessionCreatedEvent
    newSessionCreatedEvent(org.springframework.session.Session session)
    Constructs a new SessionCreatedEvent initialized with the given Session, using the SessionRepository as the event source.
    protected org.springframework.session.events.SessionDeletedEvent
    newSessionDeletedEvent(org.springframework.session.Session session)
    Constructs a new SessionDeletedEvent initialized with the given Session, using the SessionRepository as the event source.
    protected org.springframework.session.events.SessionDestroyedEvent
    newSessionDestroyedEvent(org.springframework.session.Session session)
    Constructs a new SessionDestroyedEvent initialized with the given Session, using the SessionRepository as the event source.
    protected org.springframework.session.events.SessionExpiredEvent
    newSessionExpiredEvent(org.springframework.session.Session session)
    Constructs a new SessionExpiredEvent initialized with the given Session, using the SessionRepository as the event source.
    protected boolean
    remember(Object sessionId)
    Remembers the given Session ID.
    protected boolean
    remember(org.apache.geode.cache.EntryEvent<Object,org.springframework.session.Session> entryEvent)
    Remembers the Key contained by the given EntryEvent iff the Key is a valid Session ID and the new value is a Session.
    protected org.springframework.session.Session
    toSession(Object target, Object sessionId)
    Casts the given Object into a Session iff the Object is a 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

  • Method Details

    • getSessionRepository

      @NonNull protected AbstractGemFireOperationsSessionRepository getSessionRepository()
      Returns a reference to the configured SessionRepository.
      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 the Session cache Region.
      Specified by:
      afterCreate in interface org.apache.geode.cache.CacheListener<Object,org.springframework.session.Session>
      Overrides:
      afterCreate in class org.apache.geode.cache.util.CacheListenerAdapter<Object,org.springframework.session.Session>
      Parameters:
      event - EntryEvent containing the details of the cache operation.
      See Also:
    • afterDelete

      protected void afterDelete(String sessionId, org.springframework.session.Session session)
      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 the Session cache Region.
      Specified by:
      afterDestroy in interface org.apache.geode.cache.CacheListener<Object,org.springframework.session.Session>
      Overrides:
      afterDestroy in class org.apache.geode.cache.util.CacheListenerAdapter<Object,org.springframework.session.Session>
      Parameters:
      event - EntryEvent containing the details of the cache operation.
      See Also:
    • 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 the Session cache Region.
      Specified by:
      afterInvalidate in interface org.apache.geode.cache.CacheListener<Object,org.springframework.session.Session>
      Overrides:
      afterInvalidate in class org.apache.geode.cache.util.CacheListenerAdapter<Object,org.springframework.session.Session>
      Parameters:
      event - EntryEvent containing the details of the cache operation.
      See Also:
    • afterUpdate

      public void afterUpdate(org.apache.geode.cache.EntryEvent<Object,org.springframework.session.Session> event)
      Callback method triggered when an entry is updated in the Session cache Region.
      Specified by:
      afterUpdate in interface org.apache.geode.cache.CacheListener<Object,org.springframework.session.Session>
      Overrides:
      afterUpdate in class org.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 new SessionCreatedEvent initialized with the given Session, using the SessionRepository as the event source.
      Parameters:
      session - Session that is the subject of the event.
      Returns:
      a new SessionCreatedEvent.
      See Also:
    • newSessionChangedEvent

      protected SessionChangedEvent newSessionChangedEvent(org.springframework.session.Session session)
      Constructs a new SessionChangedEvent initialized with the given Session, using the SessionRepository as the event source.
      Parameters:
      session - Session that is the subject of the change event.
      Returns:
      a new SessionChangedEvent.
      See Also:
    • newSessionDeletedEvent

      protected org.springframework.session.events.SessionDeletedEvent newSessionDeletedEvent(org.springframework.session.Session session)
      Constructs a new SessionDeletedEvent initialized with the given Session, using the SessionRepository as the event source.
      Parameters:
      session - Session that is the subject of the event.
      Returns:
      a new SessionDeletedEvent.
      See Also:
    • newSessionDestroyedEvent

      protected org.springframework.session.events.SessionDestroyedEvent newSessionDestroyedEvent(org.springframework.session.Session session)
      Constructs a new SessionDestroyedEvent initialized with the given Session, using the SessionRepository as the event source.
      Parameters:
      session - Session that is the subject of the event.
      Returns:
      a new SessionDestroyedEvent.
      See Also:
    • newSessionExpiredEvent

      protected org.springframework.session.events.SessionExpiredEvent newSessionExpiredEvent(org.springframework.session.Session session)
      Constructs a new SessionExpiredEvent initialized with the given Session, using the SessionRepository as the event source.
      Parameters:
      session - Session that is the subject of the event.
      Returns:
      a new SessionExpiredEvent.
      See Also:
    • isLocalLoadEvent

      protected boolean isLocalLoadEvent(@Nullable org.apache.geode.cache.EntryEvent<?,?> event)
      Null-safe operation to determine whether the Region EntryEvent is a Operation.LOCAL_LOAD_CREATE or a Operation.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:
    • isNotLocalLoadEvent

      protected boolean isNotLocalLoadEvent(@Nullable org.apache.geode.cache.EntryEvent<?,?> event)
      Null-safe operation to determine whether the Region EntryEvent is a Operation.LOCAL_LOAD_CREATE or a Operation.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:
    • isRemembered

      protected boolean isRemembered(Object sessionId)
      Determines whether the given Session 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 the Key contained in the given EntryEvent as a Session ID.
      Parameters:
      entryEvent - EntryEvent to evaluate.
      Returns:
      true if the Key contained in the given EntryEvent was forgotten as a Session ID.
      See Also:
    • forget

      protected boolean forget(Object sessionId)
      Forgets the given Session ID.
      Parameters:
      sessionId - Object containing the Session ID to forget.
      Returns:
      a boolean value indicating whether the given Session ID was forgotten.
      See Also:
    • remember

      protected boolean remember(org.apache.geode.cache.EntryEvent<Object,org.springframework.session.Session> entryEvent)
      Remembers the Key contained by the given EntryEvent iff the Key is a valid Session ID and the new value is a Session.
      Parameters:
      entryEvent - EntryEvent to evaluate.
      Returns:
      true if the Key of the given EntryEvent is a valid Session ID.
      See Also:
    • remember

      protected boolean remember(Object sessionId)
      Remembers the given Session ID.
      Parameters:
      sessionId - Object containing the Session ID to remember.
      Returns:
      a boolean value indicating whether Spring Session is interested in and will remember the given Session ID.
      See Also:
    • isSession

      protected boolean isSession(org.apache.geode.cache.EntryEvent<?,?> entryEvent)
      Determines whether the new value contained in the EntryEvent is a Session.
      Parameters:
      entryEvent - EntryEvent to evaluate.
      Returns:
      a boolean value indicating whether the new value contained in the EntryEvent is a Session.
      See Also:
      • Session
      • EntryEvent
    • isSession

      protected boolean isSession(Object target)
      Determines whether the given Object is a Session.
      Parameters:
      target - Object to evaluate.
      Returns:
      a boolean value determining whether the given Object is a Session.
      See Also:
      • Session
    • toSession

      protected org.springframework.session.Session toSession(@Nullable Object target, Object sessionId)
      Casts the given Object into a Session iff the Object is a Session. Otherwise, this method attempts to use the supplied Session ID to create a Session representation containing only the ID.
      Parameters:
      target - Object to evaluate as a Session.
      sessionId - String containing the Session ID.
      Returns:
      a Session from the given Object or a Session representation containing only the supplied Session ID.
      Throws:
      IllegalStateException - if the given Object is not a Session and a Session ID was not supplied.
      See Also: