3 Replies Latest reply on Feb 10, 2006 4:56 AM by tremalnaik

    Session replication does not copy session attributes

    tremalnaik

      Hi,
      I'm running a clustered Jboss server (4.0.2). I use session replication to provide a fail-safe environment to the users.

      My configuration follows (tc5-cluster-service.xml), I report only those attribute I have changed from default:

      <attribute name="CacheMode">REPL_ASYNC</attribute>
      <attribute name="ClusterName">BITAStar_Web</attribute>


      here follows my jboss-web.xml replication-config:

      <replication-config>
       <replication-trigger>SET_AND_NON_PRIMITIVE_GET</replication-trigger>
       <replication-granularity>attribute</replication-granularity>
       </replication-config>


      Here follows the excerpt from the code where I try to access the sessions in the cache:

      // get all sessions active for this manager
      Session[] managedSessions = request.getContext().getManager().findSessions();


      but while the sessions defined in the local server (the one from which the code above is invoked) have the attributes Hastable populated, the ones which are replicated have all hashtable attributes set to null.

      Can you help me?



        • 1. Re: Session replication does not copy session attributes
          brian.stansberry

          This is a bug.

          As a workaround (haven't tried this but should work):

          Manager manager = request.getContext().getManager();
          Session[] sessions = manager.findSessions();
          for (int j =0; j < sessions.length; j++)
          {
           sessions[j] = manager.findSession(sessions[j].getId());
          }
          


          The findSession(String) call causes the local session object to be updated from the cache. This step is skipped in findSessions(), which is the bug.

          • 2. Re: Session replication does not copy session attributes

            While this is a bug that we need to fix. I am not sure if you to obtain a session list is a good idea though since this is Tomcat specific.

            -Ben

            • 3. Re: Session replication does not copy session attributes
              tremalnaik

              Thanks to bstansberry, his tip worked nicely.

              To ben.wang: I'm using the code above into a Tomcat Valve, so this solution doesn't add more specificity to my application. I'm managing to keep all Jboss/Tomcat specific code into a well defined package. Using interfaces and patterns should give me the flessibility to deal with a different deployment environment. I have some clients who don't like Open Source solutions like Jboss, so they may ask for a Web Sphere version of my application, but even IBM now is using Tomcat as web tier of his AS. So...

              Thanks to everybody