org.eclipse.jetty.server.session

## Class HashSessionIdManager

- java.lang.Object
- - org.eclipse.jetty.util.component.AbstractLifeCycle
  - - org.eclipse.jetty.server.session.AbstractSessionIdManager
    - - org.eclipse.jetty.server.session.HashSessionIdManager

- All Implemented Interfaces:
    SessionIdManager, LifeCycle

      public class HashSessionIdManager
      extends AbstractSessionIdManager

  HashSessionIdManager. An in-memory implementation of the session ID manager.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle

      `AbstractLifeCycle.AbstractLifeCycleListener`

    - ### Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle

      `LifeCycle.Listener`

  - ### Field Summary

    - ### Fields inherited from class org.eclipse.jetty.server.session.AbstractSessionIdManager

      `_random, _weakRandom, _workerName`

    - ### Fields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle

      `_listeners, FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPING`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `HashSessionIdManager()`
    `HashSessionIdManager(java.util.Random random)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addSession(javax.servlet.http.HttpSession session)` Add a session to the list of known sessions for a given ID.
    `protected void` | `doStart()`
    `protected void` | `doStop()`
    `java.lang.String` | `getClusterId(java.lang.String nodeId)` Get the session ID without any worker ID.
    `java.lang.String` | `getNodeId(java.lang.String clusterId, javax.servlet.http.HttpServletRequest request)` Get the session ID with any worker ID.
    `java.util.Collection<javax.servlet.http.HttpSession>` | `getSession(java.lang.String id)`
    `java.util.Collection<java.lang.String>` | `getSessions()`
    `boolean` | `idInUse(java.lang.String id)`
    `void` | `invalidateAll(java.lang.String id)` Call `HttpSession.invalidate()` on all known sessions for the given id.
    `void` | `removeSession(javax.servlet.http.HttpSession session)` Remove session from the list of known sessions for a given ID.

    - ### Methods inherited from class org.eclipse.jetty.server.session.AbstractSessionIdManager

      `getRandom, getWorkerName, initRandom, newSessionId, setRandom, setWorkerName`

    - ### Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle

      `addLifeCycleListener, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.eclipse.jetty.util.component.LifeCycle

      `addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop`

- - ### Constructor Detail

    - #### HashSessionIdManager

          public HashSessionIdManager()

    - #### HashSessionIdManager

          public HashSessionIdManager(java.util.Random random)

  - ### Method Detail

    - #### getSessions

          public java.util.Collection<java.lang.String> getSessions()

      Returns:
        Collection of String session IDs

    - #### getSession

          public java.util.Collection<javax.servlet.http.HttpSession> getSession(java.lang.String id)

      Returns:
        Collection of Sessions for the passed session ID

    - #### getNodeId

          public java.lang.String getNodeId(java.lang.String clusterId,
                                   javax.servlet.http.HttpServletRequest request)

      Get the session ID with any worker ID.
      Parameters:
        `clusterId` -
        `request` -
      Returns:
        sessionId plus any worker ID.

    - #### getClusterId

          public java.lang.String getClusterId(java.lang.String nodeId)

      Get the session ID without any worker ID.
      Parameters:
        `nodeId` - the node id
      Returns:
        sessionId without any worker ID.

    - #### doStart

          protected void doStart()
                          throws java.lang.Exception

      Overrides:
        `doStart` in class `AbstractSessionIdManager`
      Throws:
        `java.lang.Exception`

    - #### doStop

          protected void doStop()
                         throws java.lang.Exception

      Overrides:
        `doStop` in class `AbstractSessionIdManager`
      Throws:
        `java.lang.Exception`

    - #### idInUse

          public boolean idInUse(java.lang.String id)

      Parameters:
        `id` - The session ID without any cluster node extension
      Returns:
        True if the session ID is in use by at least one context.
      See Also:
        `SessionIdManager.idInUse(String)`

    - #### addSession

          public void addSession(javax.servlet.http.HttpSession session)

      Description copied from interface: `SessionIdManager`
      Add a session to the list of known sessions for a given ID.
      Parameters:
        `session` - The session
      See Also:
        `SessionIdManager.addSession(HttpSession)`

    - #### removeSession

          public void removeSession(javax.servlet.http.HttpSession session)

      Description copied from interface: `SessionIdManager`
      Remove session from the list of known sessions for a given ID.
      See Also:
        `SessionIdManager.removeSession(HttpSession)`

    - #### invalidateAll

          public void invalidateAll(java.lang.String id)

      Description copied from interface: `SessionIdManager`
      Call `HttpSession.invalidate()` on all known sessions for the given id.
      Parameters:
        `id` - The session ID without any cluster node extension
      See Also:
        `SessionIdManager.invalidateAll(String)`

Copyright © 2013 FuseSource, Corp.. All Rights Reserved.