|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
jrunx.kernel.ServiceAdapter
|
+--jrunx.kernel.ServicePartition
|
+--jrunx.kernel.ConfigurableServicePartition
|
+--jrun.servlet.session.SessionService
The JRun session service.
| Field Summary | |
static java.lang.String |
FILE_PERSISTENCE
|
protected java.util.Hashtable |
holders
|
static java.lang.String |
JDBC_PERSISTENCE
|
static java.lang.String |
JSESSIONID
|
protected LRUTable |
lruTable
|
protected Metrics |
metrics
|
protected int |
metricsSessionIMIndex
|
protected int |
metricsSessionIndex
|
static java.lang.String |
SESSION_COUNT
The metrics key for the number of sessions |
static java.lang.String |
SESSION_IM_COUNT
The metrics key for the number of sessions in memory |
static java.lang.String |
SESSION_PERSIST_LIST_ID
|
protected SessionIdGenerator |
sessionIdGenerator
|
protected java.lang.String |
sessionPathMatch
|
protected WebApplication |
webapp
|
protected java.lang.String |
webappContext
|
| Fields inherited from class jrunx.kernel.ServicePartition |
sortedServices |
| Fields inherited from class jrunx.kernel.ServiceAdapter |
DEFAULT_DEACTIVATED, DEFAULT_DOMAIN, DOMAIN_NAME_SEPARATOR, DOMAIN_NAME_SUFFIX, domainName, jndiBindable, LOGGER_CACHE_TIME, SCHEDULER_SERVICE, SECURITY_MANAGER, server, status, TRANSACTION_MANAGER |
| Fields inherited from interface jrunx.kernel.Service |
INITIALIZED, STARTED, STARTING, STOPPED, STOPPING, UNINITIALIZED |
| Constructor Summary | |
SessionService()
|
|
| Method Summary | |
void |
addSession(JRunSession session)
|
protected void |
clearSessionMetrics()
|
javax.servlet.http.HttpSession |
createSession(java.lang.String id)
Create and register a new session |
void |
destroy()
Every service is eventually destroyed. |
java.lang.String |
encodeURL(java.lang.String url,
java.lang.String id)
|
javax.servlet.http.HttpSession |
findSession(java.lang.String sessionId)
Returns the Session bound to the specified session id, or null if the specified session id does not refer to a valid Session. |
void |
fireSessionCreatedEvent(javax.servlet.http.HttpSession session)
Fire a sessionCreated event to all of the HttpSessionListener instances |
void |
fireSessionDestroyedEvent(javax.servlet.http.HttpSession session)
Fire a sessionDestroyed event to all of the HttpSessionListener instances |
javax.servlet.http.Cookie |
getCookie(java.lang.String id)
Return a cookie for tracking this session id |
boolean |
getCookieActive()
Determines whether user sessions should be tracked using cookies. |
java.lang.String |
getCookieSessionID(javax.servlet.http.HttpServletRequest request)
Attempt to get the session ID from a cookie |
int |
getMaxInactiveInterval()
Gets the default time, in seconds, between client requests before the servlet container will invalidate a session. |
java.util.ArrayList |
getSessions()
|
Session |
getSessionService()
Returns a direct reference to the session service |
java.lang.String |
getUrlSessionID(javax.servlet.http.HttpServletRequest request)
Attempt to get the session ID from the URL |
WebApplication |
getWebApplication()
Returns the owning WebApplication |
void |
invalidateSession(java.lang.String id)
Invalidates the given session ID |
boolean |
isReplicationServicePresent()
Determine if a replication service is present. |
protected void |
notifyDidActivate(javax.servlet.http.HttpSession session)
Notify any HttpSessionActivationListener objects bound to the given session that they did activate |
protected void |
notifyWillPassivate(javax.servlet.http.HttpSession session)
Notify any HttpSessionActivationListener objects bound to the given session that they are about to be passivated |
protected void |
remove(java.lang.String id)
Remove the given id from session storage |
protected void |
remove(java.lang.String id,
boolean quiet)
Remove the given id from session storage |
void |
replicate(javax.servlet.http.HttpSession session)
If possible, replicates the session to all replication buddies. |
protected JRunSession |
restoreSession(java.lang.String id)
|
void |
restoreSessionState()
Attempt to restore the session state from an external source. |
JRunSession |
retrieve(SessionHolder h)
Retrieve a session from persistent storage |
protected JRunSession |
retrieve(SessionHolder h,
java.lang.String id)
Retrieve the session from storage |
protected JRunSession |
retrieve(SessionHolder h,
java.lang.String id,
boolean quiet)
Retrieve the session from storage |
void |
run()
Called by the Scheduler to process session swapping |
void |
saveSessionState()
Save the current session state externally |
void |
scheduleRunnable(java.lang.Runnable runnable,
long msFromNow)
Schedule a runnable to execute using the standard SchedulerService |
void |
setClassLoader(java.lang.ClassLoader loader)
Tells the session persistence mechanism that a new classloader is being used |
void |
setMaxInactiveInterval(int seconds)
Sets the default time, in seconds, between client requests before the servlet container will invalidate a session. |
void |
setMostRecentlyUsed(int id)
Marks the given session ID as most recently used |
void |
start()
Every service other than mere data collections should start |
void |
stop()
Every service other than mere data collections should stop |
protected boolean |
store(SessionHolder holder,
boolean keep)
Stores the session with the storage provider |
protected boolean |
store(java.lang.String id,
java.lang.Object obj,
boolean keep)
|
protected void |
unbindAll()
Unbind all session objects |
protected void |
unbindAndRemove()
|
void |
unscheduleRunnable(java.lang.Runnable runnable)
Unschedule a runnable to execute using the standard SchedulerService |
void |
updateInMemoryCount(int n)
Updates the in memory count metric |
| Methods inherited from class jrunx.kernel.ConfigurableServicePartition |
destroyServices, init, initServices, loadAndInit, loadChildren, setChildElements, startServices, stopServices |
| Methods inherited from class jrunx.kernel.ServicePartition |
addService, addService, getServices, invokeChain, iterator, removeService, removeService |
| Methods inherited from interface jrunx.kernel.ConfigurableServicePartitionMBean |
setChildElements |
| Methods inherited from interface jrunx.kernel.ServicePartitionMBean |
addService, addService, iterator, removeService, removeService |
| Methods inherited from interface jrunx.kernel.ServiceMBean |
bind, getBindToJNDI, getDeactivated, getDomainName, getJRunService, getLogger, getName, getParentService, getServerName, requestServer, setBindToJNDI, setDeactivated, setDomainName, setName, setParentService, unbind |
| Methods inherited from interface jrunx.kernel.Service |
getStatus, init, updateStatus |
| Field Detail |
public static final java.lang.String SESSION_COUNT
public static final java.lang.String SESSION_IM_COUNT
public static final java.lang.String JSESSIONID
protected WebApplication webapp
protected java.lang.String webappContext
protected SessionIdGenerator sessionIdGenerator
protected Metrics metrics
protected int metricsSessionIndex
protected int metricsSessionIMIndex
protected java.util.Hashtable holders
protected LRUTable lruTable
protected java.lang.String sessionPathMatch
public static final java.lang.String SESSION_PERSIST_LIST_ID
public static final java.lang.String FILE_PERSISTENCE
public static final java.lang.String JDBC_PERSISTENCE
| Constructor Detail |
public SessionService()
| Method Detail |
public void start()
throws java.lang.Exception
ServiceAdapterstart in interface Servicestart in class ConfigurableServicePartitionpublic void run()
run in interface java.lang.Runnable
public void destroy()
throws java.lang.Exception
ServiceAdapterdestroy in interface Servicedestroy in class ConfigurableServicePartitionprotected void unbindAll()
public void setClassLoader(java.lang.ClassLoader loader)
SessionsetClassLoader in interface Sessionpublic void saveSessionState()
public java.util.ArrayList getSessions()
getSessions in interface Session
protected boolean store(SessionHolder holder,
boolean keep)
public boolean isReplicationServicePresent()
SessionisReplicationServicePresent in interface Sessionjrun.servlet.session.Sessionpublic void replicate(javax.servlet.http.HttpSession session)
replicate in interface Session
protected boolean store(java.lang.String id,
java.lang.Object obj,
boolean keep)
protected void notifyWillPassivate(javax.servlet.http.HttpSession session)
protected void notifyDidActivate(javax.servlet.http.HttpSession session)
protected void clearSessionMetrics()
public void restoreSessionState()
public void stop()
throws java.lang.Exception
ServiceAdapterstop in interface Servicestop in class ConfigurableServicePartitionprotected void unbindAndRemove()
public void scheduleRunnable(java.lang.Runnable runnable,
long msFromNow)
SessionscheduleRunnable in interface SessionscheduleRunnable in class ServiceAdapterjrun.servlet.session.Sessionrunnable - The runnablemsFromNow - The number of ms from now to run, or 0 for immediatepublic void unscheduleRunnable(java.lang.Runnable runnable)
SessionunscheduleRunnable in interface SessionunscheduleRunnable in class ServiceAdapterjrun.servlet.session.Sessionrunnable - The runnablepublic void invalidateSession(java.lang.String id)
SessioninvalidateSession in interface Sessionjrun.servlet.session.SessionsessionID - The session IDpublic void updateInMemoryCount(int n)
SessionupdateInMemoryCount in interface Sessionjrun.servlet.session.Sessionn - The number to increment/decrementpublic void setMostRecentlyUsed(int id)
SessionsetMostRecentlyUsed in interface Sessionjrun.servlet.session.Sessionid - The session IDpublic Session getSessionService()
SessionServiceMBeangetSessionService in interface SessionServiceMBeanjrun.servlet.session.SessionServiceMBeanpublic int getMaxInactiveInterval()
SessionServiceMBeangetMaxInactiveInterval in interface SessionServiceMBeanjrun.servlet.session.SessionServiceMBeanpublic void setMaxInactiveInterval(int seconds)
SessionServiceMBeansetMaxInactiveInterval in interface SessionServiceMBeanjrun.servlet.session.SessionServiceMBeanseconds - The timeout in secondspublic boolean getCookieActive()
SessionServiceMBeangetCookieActive in interface SessionServiceMBeanjrun.servlet.session.SessionServiceMBeanpublic java.lang.String getUrlSessionID(javax.servlet.http.HttpServletRequest request)
SessiongetUrlSessionID in interface Sessionpublic java.lang.String getCookieSessionID(javax.servlet.http.HttpServletRequest request)
SessiongetCookieSessionID in interface Sessionpublic javax.servlet.http.HttpSession findSession(java.lang.String sessionId)
SessionfindSession in interface Sessionpublic javax.servlet.http.HttpSession createSession(java.lang.String id)
SessioncreateSession in interface Sessionprotected JRunSession restoreSession(java.lang.String id)
public void addSession(JRunSession session)
addSession in interface Sessionprotected void remove(java.lang.String id)
protected void remove(java.lang.String id,
boolean quiet)
public JRunSession retrieve(SessionHolder h)
Sessionretrieve in interface Sessionjrun.servlet.session.Sessionholder - The SessionHolder
protected JRunSession retrieve(SessionHolder h,
java.lang.String id)
protected JRunSession retrieve(SessionHolder h,
java.lang.String id,
boolean quiet)
public javax.servlet.http.Cookie getCookie(java.lang.String id)
SessiongetCookie in interface Sessionpublic WebApplication getWebApplication()
SessiongetWebApplication in interface Sessionpublic void fireSessionCreatedEvent(javax.servlet.http.HttpSession session)
fireSessionCreatedEvent in interface Sessionpublic void fireSessionDestroyedEvent(javax.servlet.http.HttpSession session)
fireSessionDestroyedEvent in interface Session
public java.lang.String encodeURL(java.lang.String url,
java.lang.String id)
encodeURL in interface Session
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||