3 Replies Latest reply on Mar 17, 2006 8:36 AM by Manik Surtani

    Hierarchical cache not working when using Jboss service?

    Nimrod Rivier Newbie

      I tried to configure a hierarchical cache, composed of a first-level memory-only cache, and a second-level file-only cache. It seems not to work when I the caches are jboss services, but works when I use plain classes. Please help.

      Details:

      The caches are created as follows:

      TreeCacheMBean sCacheSecondLevel = (TreeCacheMBean)MBeanProxyExt.create(TreeCacheMBean.class, serviceName1, server);
      TreeCacheMBean sCacheFirstLevel = (TreeCacheMBean)MBeanProxyExt.create(TreeCacheMBean.class, serviceName2, server);

      LocalDelegatingCacheLoader sCacheLoader = new LocalDelegatingCacheLoader(sCacheSecondLevel.getInstance());
      sCacheFirstLevel.setCacheLoader(sCacheLoader);
      sCacheFirstLevel.setCacheLoader(sCacheLoader);

      I then insert elements into sCacheFirstLevel, and it seems they are not delegated into sCacheSecondLevel .
      I even tried to issue stopService() and startService() before the creating the LocalDelegatingCacheLoader , but it did not change anything.

      When I use the following code to create the caches, everything seems to work fine:

      sCacheSecondLevel = new TreeCache();
      sCacheSecondLevel.setCacheLoaderClass"org.jboss.cache.loader.FileCacheLoader");
      Properties filecacheLoaderProperties = new Properties();
      filecacheLoaderProperties.put("location","c:\\temp\\cache\\requests");
      sCacheSecondLevel.setCacheLoaderConfig(filecacheLoaderProperties);


      sCacheFirstLevel = new TreeCache();

      CacheLoader cacheLoader = new LocalDelegatingCacheLoader (sCacheSecondLevel);
      sCacheFirstLevel.setCacheLoader(cacheLoader);

      /* Configure the caches (removed) */


      sCacheSecondLevel.createService();
      sCacheSecondLevel.startService();
      sCacheFirstLevel.createService();
      sCacheFirstLevel.startService();