org.apache.myfaces.orchestra.conversation.servlet
Class ConversationManagerSessionListener

java.lang.Object
  extended by org.apache.myfaces.orchestra.conversation.servlet.ConversationManagerSessionListener

public class ConversationManagerSessionListener
extends java.lang.Object

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.


Constructor Summary
ConversationManagerSessionListener()
           
 
Method Summary
 void attributeAdded(HttpSessionBindingEvent event)
           
 void attributeRemoved(HttpSessionBindingEvent event)
           
 void attributeReplaced(HttpSessionBindingEvent event)
           
 void contextDestroyed(ServletContextEvent event)
           
 void contextInitialized(ServletContextEvent event)
           
 void sessionCreated(HttpSessionEvent event)
           
 void sessionDestroyed(HttpSessionEvent event)
           
 void sessionDidActivate(HttpSessionEvent se)
          Run by the servlet container after deserializing an HttpSession.
 void sessionWillPassivate(HttpSessionEvent se)
          Run by the servlet container before serializing an HttpSession.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConversationManagerSessionListener

public ConversationManagerSessionListener()
Method Detail

contextInitialized

public void contextInitialized(ServletContextEvent event)

contextDestroyed

public void contextDestroyed(ServletContextEvent event)

sessionCreated

public void sessionCreated(HttpSessionEvent event)

sessionDestroyed

public void sessionDestroyed(HttpSessionEvent event)

attributeAdded

public void attributeAdded(HttpSessionBindingEvent event)

attributeRemoved

public void attributeRemoved(HttpSessionBindingEvent event)

attributeReplaced

public void attributeReplaced(HttpSessionBindingEvent event)

sessionDidActivate

public void sessionDidActivate(HttpSessionEvent se)
Run by the servlet container after deserializing an HttpSession.

This method tells the current ConversationWiperThread instance to start monitoring all ConversationManager objects in the deserialized session.

Since:
1.1

sessionWillPassivate

public void sessionWillPassivate(HttpSessionEvent se)
Run by the servlet container before serializing an HttpSession.

This method tells the current ConversationWiperThread instance to stop monitoring all ConversationManager objects in the serialized session.

Since:
1.1


Copyright © 2009 The Apache Software Foundation. All Rights Reserved.