Class CoherenceIndexedSessionRepository

  • All Implemented Interfaces:
    Aware, ApplicationEventPublisherAware, org.springframework.session.FindByIndexNameSessionRepository<com.oracle.coherence.spring.session.CoherenceSpringSession>, org.springframework.session.SessionRepository<com.oracle.coherence.spring.session.CoherenceSpringSession>

    public class CoherenceIndexedSessionRepository
    extends java.lang.Object
    implements org.springframework.session.FindByIndexNameSessionRepository<com.oracle.coherence.spring.session.CoherenceSpringSession>, ApplicationEventPublisherAware
    The CoherenceIndexedSessionRepository is a SessionRepository implementation that stores sessions in Coherence's distributed CacheMap.
    Since:
    3.0
    Author:
    Gunnar Hillert
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String DEFAULT_SESSION_MAP_NAME
      The default name of map used by Spring Session to store sessions.
      static java.lang.String PRINCIPAL_NAME_ATTRIBUTE
      The principal name custom attribute name.
      • Fields inherited from interface org.springframework.session.FindByIndexNameSessionRepository

        PRINCIPAL_NAME_INDEX_NAME
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void clearAllSessions()
      Clear all sessions.
      void close()  
      com.oracle.coherence.spring.session.CoherenceSpringSession createSession()  
      void deleteById​(java.lang.String id)  
      com.oracle.coherence.spring.session.CoherenceSpringSession findById​(java.lang.String id)  
      java.util.Map<java.lang.String,​com.oracle.coherence.spring.session.CoherenceSpringSession> findByIndexNameAndIndexValue​(java.lang.String indexName, java.lang.String indexValue)  
      org.springframework.session.FlushMode getFlushMode()  
      org.springframework.session.IndexResolver<org.springframework.session.Session> getIndexResolver()  
      org.springframework.session.SaveMode getSaveMode()  
      void init()  
      boolean isUseEntryProcessor()  
      void resetMaxInactiveIntervalForActiveSessions()
      Reset the max inactive interval for all active sessions.
      void save​(com.oracle.coherence.spring.session.CoherenceSpringSession session)  
      void setApplicationEventPublisher​(ApplicationEventPublisher applicationEventPublisher)
      Sets the ApplicationEventPublisher that is used to publish session events.
      void setDefaultMaxInactiveInterval​(java.time.Duration defaultMaxInactiveInterval)
      Set the maximum inactive interval between requests before newly created sessions will be invalidated.
      void setFlushMode​(org.springframework.session.FlushMode flushMode)
      Sets the FlushMode.
      void setIndexResolver​(org.springframework.session.IndexResolver<org.springframework.session.Session> indexResolver)
      Set the IndexResolver to use.
      void setSaveMode​(org.springframework.session.SaveMode saveMode)
      Set the save mode.
      void setSessionMapName​(java.lang.String sessionMapName)
      Set the name of map used to store sessions.
      void setUseEntryProcessor​(boolean useEntryProcessor)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface org.springframework.session.FindByIndexNameSessionRepository

        findByPrincipalName
    • Field Detail

      • DEFAULT_SESSION_MAP_NAME

        public static final java.lang.String DEFAULT_SESSION_MAP_NAME
        The default name of map used by Spring Session to store sessions.
        See Also:
        Constant Field Values
      • PRINCIPAL_NAME_ATTRIBUTE

        public static final java.lang.String PRINCIPAL_NAME_ATTRIBUTE
        The principal name custom attribute name.
        See Also:
        Constant Field Values
    • Constructor Detail

      • CoherenceIndexedSessionRepository

        public CoherenceIndexedSessionRepository​(com.tangosol.net.Session coherenceSession)
        Create a new CoherenceIndexedSessionRepository instance.
        Parameters:
        coherenceSession - the Coherence Session instance to use for managing sessions
    • Method Detail

      • setDefaultMaxInactiveInterval

        public void setDefaultMaxInactiveInterval​(java.time.Duration defaultMaxInactiveInterval)
        Set the maximum inactive interval between requests before newly created sessions will be invalidated. A value of 0 means that the session will never time out unless the cache is configured otherwise in the coherence-cache-config.xml. The default is 1800s (30 minutes).
        Parameters:
        defaultMaxInactiveInterval - the maximum inactive interval in seconds must not be negative or null
      • setIndexResolver

        public void setIndexResolver​(org.springframework.session.IndexResolver<org.springframework.session.Session> indexResolver)
        Set the IndexResolver to use.
        Parameters:
        indexResolver - the index resolver
      • setSessionMapName

        public void setSessionMapName​(java.lang.String sessionMapName)
        Set the name of map used to store sessions.
        Parameters:
        sessionMapName - the session map name
      • setFlushMode

        public void setFlushMode​(org.springframework.session.FlushMode flushMode)
        Sets the FlushMode. Defaults to FlushMode.ON_SAVE.
        Parameters:
        flushMode - must not be null
      • setSaveMode

        public void setSaveMode​(org.springframework.session.SaveMode saveMode)
        Set the save mode.
        Parameters:
        saveMode - must not be null
      • setUseEntryProcessor

        public void setUseEntryProcessor​(boolean useEntryProcessor)
      • isUseEntryProcessor

        public boolean isUseEntryProcessor()
      • createSession

        public com.oracle.coherence.spring.session.CoherenceSpringSession createSession()
        Specified by:
        createSession in interface org.springframework.session.SessionRepository<com.oracle.coherence.spring.session.CoherenceSpringSession>
      • save

        public void save​(com.oracle.coherence.spring.session.CoherenceSpringSession session)
        Specified by:
        save in interface org.springframework.session.SessionRepository<com.oracle.coherence.spring.session.CoherenceSpringSession>
      • findById

        public com.oracle.coherence.spring.session.CoherenceSpringSession findById​(java.lang.String id)
        Specified by:
        findById in interface org.springframework.session.SessionRepository<com.oracle.coherence.spring.session.CoherenceSpringSession>
      • deleteById

        public void deleteById​(java.lang.String id)
        Specified by:
        deleteById in interface org.springframework.session.SessionRepository<com.oracle.coherence.spring.session.CoherenceSpringSession>
      • findByIndexNameAndIndexValue

        public java.util.Map<java.lang.String,​com.oracle.coherence.spring.session.CoherenceSpringSession> findByIndexNameAndIndexValue​(java.lang.String indexName,
                                                                                                                                             java.lang.String indexValue)
        Specified by:
        findByIndexNameAndIndexValue in interface org.springframework.session.FindByIndexNameSessionRepository<com.oracle.coherence.spring.session.CoherenceSpringSession>
      • getFlushMode

        public org.springframework.session.FlushMode getFlushMode()
      • getSaveMode

        public org.springframework.session.SaveMode getSaveMode()
      • getIndexResolver

        public org.springframework.session.IndexResolver<org.springframework.session.Session> getIndexResolver()
      • clearAllSessions

        public void clearAllSessions()
        Clear all sessions.
      • resetMaxInactiveIntervalForActiveSessions

        public void resetMaxInactiveIntervalForActiveSessions()
        Reset the max inactive interval for all active sessions.