5 Replies Latest reply on Nov 15, 2004 9:09 AM by Bela Ban

    Does node triggers coordinator methods?

    Tomasz Nazar Newbie


      I wonder whether when asking node (invoking 'getChildren()') for some objects, the method is realy executed on coordinator? I suppose it doesn't :(

      So what I try to achieve is to use my own persistence aspects - not CacheLoader.

      The scenario is: execute 'getChildren' on slave -> this triggers 'getChildren' on coordinator -> this triggers my lazy loading aspect -> returns some results on coordinator -> cache itself transfers data to slave nodes..

      Is this scenario possible with JBossCache?

      Thanks in advance, Tomasz Nazar

        • 1. 3847434
          Bela Ban Master

          Hello all,
          Sacha Labourey and I have written a companion workbook to O'Reilly's "EJB 3rd Edition" by Richard Monson-Haefel. It will be published sometime in October and we would really like some feedback! Please refrain from grammar and spelling mistakes, since our editor will handle these sort of things.

          I have created a Forum thread to discuss feedback on the workbook at:

          http://www.jboss.org/modules/bb/index.html?module=bb&op=viewtopic&t=forums/ download a 1st draft of the workbook and corresponding examples, please go to:


          To use the book it is highly recommended that you also have a copy of EJB 3rd edition since the Workbook follows closely with the chapters of EJB 3rd edition. It can be purchased at:


          Bill Burke

          • 2. Re: Does node triggers coordinator methods?
            Bela Ban Master

            I don't understand the question.

            If you want to write your own persistence layer for JBossCache, then I suggest to take a look at the new JBossCache 1.2 (due mid December) release, which includes some more aspects (a.k.a. Interceptors).
            You could write one which intercepts all methods with modifications and persists them to DB.


            • 3. Re: Does node triggers coordinator methods?
              Tomasz Nazar Newbie

              Yes, I want to write my own persistence layer, but let's say I want to do it with 1.1, because that's last stable version.

              Maybe I'll repeat problem in other words:

              1) I want to cache Root object which may have some children: accessed through 'getChildren()' method.

              2) I want to combine caching with lazy retrieving those data from database using already written persistence aspect

              3) I want only coordinator node to persist (retrieve, store) data.

              4) I do not want to load whole data from database as the application starts, but want to use lazy loading.

              Problems occurs when application has started - no data loaded - and the first node accessing data ('Root.getChildren()') is slave node. That's not the node with persistence aspect applied. This node sees 0 data, because it wasn't loaded by coordinator.

              In other case, when the coordinator node access data first, it is loaded into cache and distributed also to slave nodes. After that, slave nodes see data.

              There would be no problem at all, if execution of 'Root.getChildren()' would also trigger execution of the same method on coordinator. But this is as I think impossible. Looking for some way of workaround for it..

              Or more in generall: how to let the coordinator know that slave wants to retrieve some data from underlying database, not from cache itself?

              Hope it is enough.. hope for some tip


              • 4. Re: Does node triggers coordinator methods?
                Bela Ban Master

                I 'd write a CacheLoader. There is already an implementation of coordinator-only CacheLoader, SharedStoreCacheLoader (in org.jboss.cache.loader). Check it out,l maybe you could start of with this one, and make modifications


                • 5. Re: Does node triggers coordinator methods?
                  Tomasz Nazar Newbie

                  Ok. I got this SharedStoreCacheLoader, but I have little problems with using it. It has strange constructor, so it cannot be plugged directly by using XML conf file. Any help with this, please?

                  Next thing:
                  about shared cache loader.

                  Correct me if my assumptions are wrong:
                  -I want to have shared DB
                  -want to use lazy loading (my custom implementation) from DB
                  -so I start cache with several nodes
                  -aop tree is empty
                  -after that, the tree has one element, loaded with my custom: Map get(Fqn fqn) method
                  -I _thought_ from now on, in case every _other_ node wants "/customers/first" it will be given by cache
                  -but: from other nodes method: Map get(Fqn) is still executed. So, basically: there is no cache ? :/

                  Here is my configuration:
                  -FetchStateOnStartup: TRUE

                  -CacheLoader: MyCustomLoader
                  -CacheLoaderShared: TRUE
                  -CacheLoaderPreload: empty -because I want to lazy load all data
                  -CacheLoaderFetchTransientState: TRUE
                  -CacheLoaderFetchPersistenceState: FALSE

                  I think sth might be wrong with implementation of my CacheLoader. Because I think FileBased and Bdbje work correct.

                  Any comment?