title: keeping alive multiple sessions in the same glassfish instance
body: <p>Right now we're developing a big application, where the modules are deployed as single <em>.EAR</em> files (each containing a <em>.WAR</em> and a <em>EJB .JAR</em>). </p>
  
  <p>We configure in GlassFish 3.1 the applications to have Single Sign On using JAAS. So we require to keep alive every web module session while the SSO session is alive. </p>
  
  <p>An example could be: Modules <code>A</code>, <code>B</code> and <code>C</code> are deployed with a 10-minute session. The user signs on using <code>A</code>, then can navigate to <code>B</code> and <code>C</code>, and spend (let's assume) 20 minutes on <code>C</code>.</p>
  
  <p>The idea is that while the user is only using <code>C</code>, we must keep alive his session (including managed beans) on <code>A</code> and <code>B</code>.</p>
  
  <p>What could help us to achieve this? an idea is to create a servlet on each module to touch the session (thus keeping it alive), and send asynchronous (one-way possibly?) requests to those servlets from the module the user is using, but it seems a little overkill to open HTTP connections (over TCP) each time the user do something. Maybe a polling could help here, but we would like to avoid this kind of communication.</p>
  
  <p>Another idea is using a shared memory cache, and a cache listener to touch the other sessions, doing a lookup with the session id; could this do the trick with better performance?</p>
  
  <p>We're open to any ideas... except using another application servers (we must use OpenSource GlassFish - no Coherence*Web).</p>
  
  <p>Thank you for your time.</p>