Class CachedSessionManager<C>

Type Parameters:
C - the session context type
All Implemented Interfaces:
Manager<String>, ManagerConfiguration<String>, Service, SessionManager<C>

public class CachedSessionManager<C> extends DecoratedSessionManager<C>
A session manager decorator that shares session references across concurrent threads.
Author:
Paul Ferraro
  • Constructor Details

    • CachedSessionManager

      public CachedSessionManager(SessionManager<C> manager, CacheFactory cacheFactory)
      Creates a cached session manager decorator.
      Parameters:
      manager - a session manager
      cacheFactory - a cache factory
  • Method Details

    • createSessionAsync

      public CompletionStage<Session<C>> createSessionAsync(String id)
      Description copied from interface: SessionManager
      Creates a session using the specified identifier. Sessions returned by this method must be closed via Session.close(). This method is intended to be invoked within the context of a batch.
      Parameters:
      id - a session identifier
      Returns:
      a new web session, or null if a session with the specified identifier already exists.
    • createSessionAsync

      public CompletionStage<Session<C>> createSessionAsync(String id, Instant creationTime)
      Description copied from interface: SessionManager
      Creates a session using the specified identifier. Sessions returned by this method must be closed via Session.close(). This method is intended to be invoked within the context of a batch.
      Specified by:
      createSessionAsync in interface SessionManager<C>
      Overrides:
      createSessionAsync in class DecoratedSessionManager<C>
      Parameters:
      id - a session identifier
      creationTime - the time this session was created
      Returns:
      a new web session, or null if a session with the specified identifier already exists.
    • findSessionAsync

      public CompletionStage<Session<C>> findSessionAsync(String id)
      Description copied from interface: SessionManager
      Returns the session with the specified identifier, or null if none exists. Sessions returned by this method must be closed via Session.close(). This method is intended to be invoked within the context of a batch.
      Specified by:
      findSessionAsync in interface SessionManager<C>
      Overrides:
      findSessionAsync in class DecoratedSessionManager<C>
      Parameters:
      id - a session identifier
      Returns:
      an existing web session, or null if none exists