org.apache.myfaces.orchestra.conversation.servlet
Class ConversationManagerSessionListener
java.lang.Object
org.apache.myfaces.orchestra.conversation.servlet.ConversationManagerSessionListener
- All Implemented Interfaces:
- java.util.EventListener, javax.servlet.http.HttpSessionAttributeListener, javax.servlet.http.HttpSessionListener, javax.servlet.ServletContextListener
public class ConversationManagerSessionListener
- extends java.lang.Object
- implements javax.servlet.http.HttpSessionAttributeListener, javax.servlet.ServletContextListener, javax.servlet.http.HttpSessionListener
An http session listener which periodically scans every http session for
conversations and conversation contexts that have exceeded their timeout.
If a web application wants to configure a conversation timeout that is
shorter than the http session timeout, then this class must be specified
as a listener in the web.xml file.
A conversation timeout is useful because the session timeout is refreshed
every time a request is made. If a user starts a conversation that uses
lots of memory, then abandons it and starts working elsewhere in the same
webapp then the session will continue to live, and therefore so will that
old "unused" conversation. Specifying a conversation timeout allows the
memory for that conversation to be reclaimed in this situation.
This listener starts a single background thread that periodically wakes
up and scans all http sessions to find ConversationContext objects, and
checks their timeout together with the timeout for all Conversations in
that context. If a conversation or context timeout has expired then it
is removed.
This code is probably not safe for use with distributed sessions, ie
a "clustered" web application setup.
See ConversationWiperThread
for more details.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ConversationManagerSessionListener
public ConversationManagerSessionListener()
contextInitialized
public void contextInitialized(javax.servlet.ServletContextEvent event)
- Specified by:
contextInitialized
in interface javax.servlet.ServletContextListener
contextDestroyed
public void contextDestroyed(javax.servlet.ServletContextEvent event)
- Specified by:
contextDestroyed
in interface javax.servlet.ServletContextListener
attributeAdded
public void attributeAdded(javax.servlet.http.HttpSessionBindingEvent event)
- Specified by:
attributeAdded
in interface javax.servlet.http.HttpSessionAttributeListener
attributeRemoved
public void attributeRemoved(javax.servlet.http.HttpSessionBindingEvent event)
- Specified by:
attributeRemoved
in interface javax.servlet.http.HttpSessionAttributeListener
attributeReplaced
public void attributeReplaced(javax.servlet.http.HttpSessionBindingEvent event)
- Specified by:
attributeReplaced
in interface javax.servlet.http.HttpSessionAttributeListener
sessionCreated
public void sessionCreated(javax.servlet.http.HttpSessionEvent event)
- Specified by:
sessionCreated
in interface javax.servlet.http.HttpSessionListener
sessionDestroyed
public void sessionDestroyed(javax.servlet.http.HttpSessionEvent event)
- Specified by:
sessionDestroyed
in interface javax.servlet.http.HttpSessionListener
Copyright 2007 The Apache Software Foundation. All Rights Reserved.