4 Replies Latest reply on Nov 21, 2006 11:28 AM by brian.stansberry

    PojoCacheListener and FIELD based session repl

    brian.stansberry

      I don't think I can remove the code that registers the FieldBasedClusteredSession as an Observer on session attribute pojos. I think we were thinking I could use PojoCacheListener to get the needed events, but that won't work.

      Problem is the PojoCacheListener events don't give info about where the affected pojo is registered. Without that I have no way to tie the event back to the relevant session.

      Not giving storage information seems a weakness, IMHO. I realize the difficulty though, if the pojo is multiply attached or is a sub-pojo.

        • 1. Re: PojoCacheListener and FIELD based session repl

          Ic. Well, listening on as a POJO observer is ok except you need to declare the Obervable pattern in AOP. A little bit of PITA.

          How about in your PojoCacheListener impl, you store this kind of information? I.e., store the (session, pojo) pair so you know which session it is tied to. Just a thought.

          • 2. Re: PojoCacheListener and FIELD based session repl
            brian.stansberry

             

            "ben.wang@jboss.com" wrote:
            Ic. Well, listening on as a POJO observer is ok except you need to declare the Obervable pattern in AOP. A little bit of PITA.


            I thought PojoCache already required the pojo to implement Subject, and that the mixin was being added via your standard pojocache-aop.xml transformation? So, it's just a matter of the session registering as an Observer. That's a PITA, but its a PITA that's already implemented from 4.0.x, so no big deal.

            There's a couple failing unit tests related to this, so probably I missed something.


            How about in your PojoCacheListener impl, you store this kind of information? I.e., store the (session, pojo) pair so you know which session it is tied to. Just a thought.


            Ugh. Hopefully not needed.

            • 3. Re: PojoCacheListener and FIELD based session repl

               

              "bstansberry@jboss.com" wrote:
              I thought PojoCache already required the pojo to implement Subject, and that the mixin was being added via your standard pojocache-aop.xml transformation? So, it's just a matter of the session registering as an Observer. That's a PITA, but its a PITA that's already implemented from 4.0.x, so no big deal.


              OK, are you aware that PojoCache has its own class of Subject and Observer then (o.j.c.pojo.observable.*)? Make sure you subscribe to that instead. Reason is becuase I need to piggyback information such as field and pre and post events as well that are not present in the AOP package.

              • 4. Re: PojoCacheListener and FIELD based session repl
                brian.stansberry

                No, definitely wasn't aware of that! Thanks :)