public class SessionManager
extends java.lang.Thread
Modifier and Type | Class and Description |
---|---|
static class |
SessionManager.SessionInfo
Stores information about the managed session
|
Constructor and Description |
---|
SessionManager(long sessionTimeout)
Initializes and starts the session manager
|
SessionManager(long sessionTimeout,
java.lang.String name)
Initializes and starts the session manager
|
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(java.lang.Object session)
Resets timeout information for the given session.
|
void |
addSession(java.lang.Object session,
SessionListener listener,
ClientAgentRemote agent)
Places a session into a map of sessions.
|
SessionManager.SessionInfo |
getSession(int clientId) |
java.util.Set |
getSessions()
Returns a set of all active sessions.
|
long |
getSessionTimeout()
Returns session timeout
|
void |
removeSession(java.lang.Object session)
Removes a given session from the managed list
|
void |
run()
Periodically iterate all sessions and expire those that timed out
|
void |
setSessionTimeout(long timeout)
Sets session timeout
|
void |
shutdown()
Stops background session tracking thread.
|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
public SessionManager(long sessionTimeout)
sessionTimeout
- timeout in secondspublic SessionManager(long sessionTimeout, java.lang.String name)
sessionTimeout
- timeout in secondsname
- application name used for loggingpublic void addSession(java.lang.Object session, SessionListener listener, ClientAgentRemote agent)
session
- sessionlistener
- will be called when this session has expiredpublic void removeSession(java.lang.Object session)
session
- Objectpublic void actionPerformed(java.lang.Object session)
session
- sessionpublic void shutdown()
public java.util.Set getSessions()
public long getSessionTimeout()
public void setSessionTimeout(long timeout)
timeout
- new timeoutpublic void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public SessionManager.SessionInfo getSession(int clientId)
Copyright © 2000-2012 CreamTec LLC. All Rights Reserved.