2 Replies Latest reply on Jun 29, 2005 6:24 AM by Bela Ban

    Why not TreeCacheMBean::get(FQN) or TreeCacheMBean::get(Stri

    Mike Lenyon Newbie

      There's a TreeCache::get(FQN) and TreeCache::get(String), which I find useful and grew accustomed to in my first project that uses JBossCache. As I'm getting a little further into the project, I'm retooling it to use MBean. I was disappointed to find that there was no TreeCacheMBean::get(FQN) or TreeCacheMBean::get(String). Was that a mere oversight or by design?

      If it's by design, then any alternative "best practices" code that you can suggest would be appreciated.

      TIA,
      TTT

        • 1. Re: Why not TreeCacheMBean::get(FQN) or TreeCacheMBean::get(
          Mike Lenyon Newbie

          I still have the same question, but I've implemented an alternative approach that seems to work just fine:

          Set nodeKeySet = treeCache.get(fqn);
          MyObject myObject = null;
          
          if (nodeKeySet != null && nodeKeySet.size() > 0) {
           // I have my reasons for preferring a list to a Set
           List nodeKeyList = new ArrayList(nodeKeySet);
           String key = "";
          
           // Not precisely the termination condition...
           for (int i = 0; i < nodeKeyList.size(); i++) {
           key = (String)nodeKeyList.get(i);
           myObject = (MyObject)treeCache.get(fqn, key);
           ...
           }
           ...
          }
          


          Please let me know if others out there have similar logic or if I've done something totally bizarre or wrong.

          TIA,
          TTT

          • 2. Re: Why not TreeCacheMBean::get(FQN) or TreeCacheMBean::get(
            Bela Ban Master

            I have added those 2 methods. Note though that we may deprecate direct access to a Node in the future since you're bypassing the interceptors...
            Also, in 1.3, we will change TreeCache (the class) into Cache (the interface).