5 Replies Latest reply on Aug 3, 2009 6:49 PM by vidyasagar eadara

    Determine the Fqn from an object

    Tony Thompson Newbie

      Is there a way that I can get the Fqn from an object that has been attached to the cache? I can keep track of the Fqn in the object myself but it seems like the cache should know that already so keeping a dupe doesn't make much sense.

      Thanks

        • 1. Re: Determine the Fqn from an object
          Jason Greene Master

          Are you looking for the internal fqn, or all referencing fqns?

          As an example:

          c.attach("/a", obj)
          c.attach("/b", obj)
          


          Would result in something like this:

          /a -> /internal/123
          /b -> /internal/123


          • 2. Re: Determine the Fqn from an object
            Tony Thompson Newbie

            Basically at some point in time I want to detach() the object from the cache but at that point I have a reference to the object itself not the Fqn. So, I need to be able to call detach() but I would prefer not keep track of the Fqn in the object itself (separation of concerns and all that). Even a detach( Object ) API would work for my situation (if you wanted to remove all references to the object). I suppose it might get tricky if that object is attached to more than one point in the cache.

            Not sure I answered your question directly but hopefully that helps clarify what I am trying to do.

            Thanks.

            • 3. Re: Determine the Fqn from an object
              Jason Greene Master

              Sorry for the delayed reply. I just got back from a stretch of travel, and this one fell through the cracks.

              The following is scheduled:
              http://jira.jboss.org/jira/browse/PCACHE-72

              The only problem with a super-detach method like you describe is when there is inter-object references. For example, if you have:

              foo.setBar(bar);
              cache.attach("/foo", foo);
              cache.attach("/bar", bar);
              cache.detach(bar);
              


              Then a successive foo.getBar() would return null. Is this the behavior you would want?

              • 4. Re: Determine the Fqn from an object
                Tony Thompson Newbie

                I personally don't currently have a use case where I would have two objects attached to the cache that also referred to each other. I was thinking more of the case where:

                cache.attach( "/foo1", foo );
                cache.attach( "/foo2", foo );
                cache.detach( foo );

                That would cause /foo1 and /foo2 references to go away. I wouldn't expect foo.getBar() to return null in your example. I would expect the "/bar" cache reference to go away but the object would still stay in the cache because it is referenced by another object that is still in the cache.

                • 5. Re: Determine the Fqn from an object
                  vidyasagar eadara Newbie

                  I have a ssimilar requirement as mentioned in the last post

                  cache.attache("/foo1", foo);
                  cache.attach("/foo2", foo);

                  Now I want to remove the object foo from the cache
                  for ex: cache.detach(foo);

                  By doing so , i want to remove the references /foo1 & /foo2 to go away. Is there any api alreaaddy existing for this?