org.mortbay.terracotta.servlet
Class TerracottaSessionIdManager

java.lang.Object
  extended by org.mortbay.component.AbstractLifeCycle
      extended by org.mortbay.terracotta.servlet.TerracottaSessionIdManager
All Implemented Interfaces:
LifeCycle, SessionIdManager

public class TerracottaSessionIdManager
extends AbstractLifeCycle
implements SessionIdManager

A specialized SessionIdManager to be used with Terracotta. See the TerracottaSessionManager javadocs for implementation notes.

See Also:
TerracottaSessionManager

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.mortbay.component.LifeCycle
LifeCycle.Listener
 
Field Summary
 
Fields inherited from class org.mortbay.component.AbstractLifeCycle
_listeners
 
Constructor Summary
TerracottaSessionIdManager(Server server)
           
 
Method Summary
 void addSession(HttpSession session)
          Add a session to the list of known sessions for a given ID.
 void doStart()
           
 void doStop()
           
 String getClusterId(String nodeId)
          Get a cluster ID from a node ID.
 String getNodeId(String clusterId, HttpServletRequest request)
          Get a node ID from a cluster ID and a request
 String getWorkerName()
           
 boolean idInUse(String clusterId)
           
 void invalidateAll(String clusterId)
          When told to invalidate all session instances that share the same id, we must tell all contexts on the server for which it is defined to delete any session object they might have matching the id.
 String newSessionId(HttpServletRequest request, long created)
           
 void removeSession(HttpSession session)
          Remove session from the list of known sessions for a given ID.
 void setWorkerName(String workerName)
           
 
Methods inherited from class org.mortbay.component.AbstractLifeCycle
addLifeCycleListener, 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.mortbay.component.LifeCycle
addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
 

Constructor Detail

TerracottaSessionIdManager

public TerracottaSessionIdManager(Server server)
Method Detail

doStart

public void doStart()
Overrides:
doStart in class AbstractLifeCycle

doStop

public void doStop()
Overrides:
doStop in class AbstractLifeCycle

addSession

public void addSession(HttpSession session)
Description copied from interface: SessionIdManager
Add a session to the list of known sessions for a given ID.

Specified by:
addSession in interface SessionIdManager
Parameters:
session - The session

getWorkerName

public String getWorkerName()
Specified by:
getWorkerName in interface SessionIdManager

setWorkerName

public void setWorkerName(String workerName)

idInUse

public boolean idInUse(String clusterId)
Specified by:
idInUse in interface SessionIdManager
Parameters:
clusterId - The session ID without any cluster node extension
Returns:
True if the session ID is in use by at least one context.

invalidateAll

public void invalidateAll(String clusterId)
When told to invalidate all session instances that share the same id, we must tell all contexts on the server for which it is defined to delete any session object they might have matching the id.

Specified by:
invalidateAll in interface SessionIdManager
Parameters:
clusterId - The session ID without any cluster node extension

newSessionId

public String newSessionId(HttpServletRequest request,
                           long created)
Specified by:
newSessionId in interface SessionIdManager
Returns:

removeSession

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

Specified by:
removeSession in interface SessionIdManager

getClusterId

public String getClusterId(String nodeId)
Description copied from interface: SessionIdManager
Get a cluster ID from a node ID. Strip node identifier from a located session ID.

Specified by:
getClusterId in interface SessionIdManager
Returns:

getNodeId

public String getNodeId(String clusterId,
                        HttpServletRequest request)
Description copied from interface: SessionIdManager
Get a node ID from a cluster ID and a request

Specified by:
getNodeId in interface SessionIdManager
Parameters:
clusterId - The ID of the session
request - The request that for the session (or null)
Returns:
The session ID qualified with the node ID.


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