3 Replies Latest reply on Dec 7, 2012 1:03 PM by pferraro

    getting the session from the cluster as7.1.1

    crazycradd

      I have setup a cluster of 2 nodes using standalone-ha-full.xml.

       

      If I use a browser to connect to node 1 I'm asked to login. If I use the same browser to log into node 2 I get the same page as in node 1. This shows me the session has been replicated to the second node and that faileover would work.

       

      My application manages a cache of an object that is added to the session and I have this working in the cluster also, the problem is that this object normaly hold a pointer to the session so that I can force users off the system. What I want to do is get the session from the cluster so I can tie these objects back together so this functionality can continue when in cluster mode.

       

      I guess the web cachecontainer can be used to get this but the repl, sso and dist chache entries appear to be empty.

       

      Can I get the session from the cache ?

        • 1. Re: getting the session from the cluster as7.1.1
          vblagojevic

          So what you are trying to do is once you session fails over to another node you want to get a notification so that you can rehook your object to that session?

          • 2. Re: getting the session from the cluster as7.1.1
            crazycradd

            Yes I need to do that and if Im an administrator I need to invalidate a users session that may be on another node

            • 3. Re: getting the session from the cluster as7.1.1
              pferraro

              I don't think this is going to work as you've implemented it.  Even in the non-clustered case, what do you do if the session passivates?  The reference to the session held by the object in the cache is no longer valid.

              When web session clustering is enabled, we don't actually store the web session itself in a cache, but rather the information needed to recreate the session (i.e. session attributes and session meta-data). In fact, the contents of the web cache-container won't even be readable by your application, as they refer to classes not exposed to your application.  To properly restore references to sessions, you'll need to register a HttpSessionActivationListener that reassociates the object with the session once the session is activated.

              Does that answer your question?