Class MutableUserSessions<K,D,S>

java.lang.Object
org.wildfly.clustering.session.cache.user.MutableUserSessions<K,D,S>
Type Parameters:
K - the cache key
D - the deployment type
S - the session type
All Implemented Interfaces:
AutoCloseable, UserSessions<D,S>

public class MutableUserSessions<K,D,S> extends Object implements UserSessions<D,S>
A mutable user sessions implementation.
  • Constructor Details

    • MutableUserSessions

      public MutableUserSessions(K key, Map<D,S> sessions, CacheEntryMutatorFactory<K,Map<D,S>> mutatorFactory)
      Creates a mutable user sessions.
      Parameters:
      key - the cache key
      sessions - a map of session identifiers per deployment
      mutatorFactory - a cache entry mutator factory
  • Method Details

    • getDeployments

      public Set<D> getDeployments()
      Description copied from interface: UserSessions
      Returns the set of deployments for which the associated user is authenticated.
      Specified by:
      getDeployments in interface UserSessions<K,D>
      Returns:
      a set of deployment identifiers.
    • getSession

      public S getSession(D deployment)
      Description copied from interface: UserSessions
      Returns the corresponding session identifier for the specified deployment.
      Specified by:
      getSession in interface UserSessions<K,D>
      Parameters:
      deployment - a deployment identifier
      Returns:
      the session identifier of the user for the specified deployment, or null, if no session exists for the associated user.
    • removeSession

      public S removeSession(D deployment)
      Description copied from interface: UserSessions
      Removes the specified deployment from the set of deployments for which the associated user is authenticated.
      Specified by:
      removeSession in interface UserSessions<K,D>
      Parameters:
      deployment - a deployment identifier
      Returns:
      the session identifier of the user for the specified deployment, or null, if no session exists for the associated user.
    • addSession

      public boolean addSession(D deployment, S session)
      Description copied from interface: UserSessions
      Adds the specified deployment and session identifiers to the set of deployments for which the associated user is authenticated.
      Specified by:
      addSession in interface UserSessions<K,D>
      Parameters:
      deployment - a deployment identifier
      session - a session identifier
      Returns:
      true, if the session was added, false it already exists
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface UserSessions<K,D>