## org.eclipse.jetty.server.session
Class AbstractSessionIdManager

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

All Implemented Interfaces:
  SessionIdManager, LifeCycle

Direct Known Subclasses:
  HashSessionIdManager, JDBCSessionIdManager

    public abstract class AbstractSessionIdManager

extends AbstractLifeCycle
implements SessionIdManager

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
`protected java.util.Random` `_random`
`protected boolean` `_weakRandom`
`protected java.lang.String` `_workerName`

Fields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
`_listeners, FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPING`

Constructor Summary
`AbstractSessionIdManager()`
`AbstractSessionIdManager(java.util.Random random)`

Method Summary
`protected void` `doStart()`
`protected void` `doStop()`
`java.util.Random` `getRandom()`
`java.lang.String` `getWorkerName()` Get the workname.
`void` `initRandom()` Set up a random number generator for the sessionids.
`java.lang.String` `newSessionId(HttpServletRequest request, long created)` Create a new session id if necessary.
`void` `setRandom(java.util.Random random)`
`void` `setWorkerName(java.lang.String workerName)` Set the workname.

Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
`addLifeCycleListener, 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.server.SessionIdManager
`addSession, getClusterId, getNodeId, idInUse, invalidateAll, removeSession`

Methods inherited from interface org.eclipse.jetty.util.component.LifeCycle
`addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop`

Field Detail

### _random

    protected java.util.Random _random

### _weakRandom

    protected boolean _weakRandom

### _workerName

    protected java.lang.String _workerName

Constructor Detail

### AbstractSessionIdManager

    public AbstractSessionIdManager()

### AbstractSessionIdManager

    public AbstractSessionIdManager(java.util.Random random)

Method Detail

### getWorkerName

    public java.lang.String getWorkerName()

  Get the workname. If set, the workername is dot appended to the session ID and can be used to assist session affinity in a load balancer.

  Specified by:
    `getWorkerName` in interface `SessionIdManager`
  Returns:
    String or null

### setWorkerName

    public void setWorkerName(java.lang.String workerName)

  Set the workname. If set, the workername is dot appended to the session ID and can be used to assist session affinity in a load balancer.

  Parameters:
    `workerName` -

### getRandom

    public java.util.Random getRandom()

### setRandom

    public void setRandom(java.util.Random random)

### newSessionId

    public java.lang.String newSessionId(HttpServletRequest request,
                                         long created)

  Create a new session id if necessary.

  Specified by:
    `newSessionId` in interface `SessionIdManager`
  Returns:
    the new session id
  See Also:
    `SessionIdManager.newSessionId(javax.servlet.http.HttpServletRequest, long)`

### doStart

    protected void doStart()
                    throws java.lang.Exception

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

### doStop

    protected void doStop()
                   throws java.lang.Exception

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

### initRandom

    public void initRandom()

  Set up a random number generator for the sessionids. By preference, use a SecureRandom but allow to be injected.

Copyright © 1995-2010 Mort Bay Consulting. All Rights Reserved.