1 Reply Latest reply on Jun 27, 2012 2:58 PM by François Hertay

    What can be safely stored in a replicated session

    Giacomo Petronio Newbie

      Hi, I developed a simple web application using JSF 2 JSF 1, which will run in JBoss 4.2.3 and JBoss EAP 4.3 (cp07).

      My first question is:

      • is the ServletContext replicated too? I think the answer is no, but just to be sure I ask here too (I store some data in the ServletContext of a webApp which is then retrieved by another webApp...)

       

      My second and more important question is:

      • What can I safely store in the HttpSession? Other then primitive types, I think that also every Serializable class instance can be safely store in the session too. But I have a doubt that follows.

       

      In my application (which is a simple WAR), I have a certain number of JSF managed beans.

      I implemented a simple sort of "Observer Pattern" using a Class (MyMessageManager) stored in the HttpSession.

      This class has references to the actual instances of some JSF managed beans.

      Some application events will trigger the MyMessageManager which in turn will notify all the involved managed beans calling a notification method.

       

      Will all this work in a failover cluster with session replication?

      Will it be sufficient to make every managed bean and the MyMessageManager Serializable?

        • 1. Re: What can be safely stored in a replicated session
          François Hertay Newbie

          I don't know about JSF managed beans (you will have issue if they are serialize separately you will end up with 2 different object once unserialized) but yes every thing that you put in the session should be serializable to be able to transfer them over the wire.

           

          As with every serialized object you need some management logic to prevent the same logical object to be present several time.  If you have 2 different serialization management logic you will probably have issue by mixing them.