1 Reply Latest reply on Feb 1, 2006 5:27 AM by manik

    Finding cache instances

    allesmallachen

      Hi,
      I have to implement a test application for the following scenario:

      1. We have several replicated JBoss Caches on different nodes
      2. An Eventpublisher saves events into the cache by (randomly) selecting one of the available Caches
      3. If one Cache Node fails, one of the other nodes should be used by the Eventpublisher instead
      4. There is no local Cache running on the node of the Eventpublisher

      My Question is now: How do I find a Cache when I don't have a local Cache that is in the same Cluster? Is there some kind of lookup mechansim for a "normal" Java program?

      I think this might work with Clusters deployed as MBeans in JBoss. I have found some sample code that does a lookup:
      try {
      MBeanServer server = MBeanServerLocator.locate();
      TreeCacheMBean remoteCache = (TreeCacheMBean) MBeanProxyExt
      .create(TreeCacheMBean.class,
      "jboss.cache:service=TreeCache", server);
      assertNotNull(remoteCache);
      } catch (MalformedObjectNameException e) {
      // exception handing
      }

      But I would prefer a solution withaout a JBoss Server on each Cache node.

      Chris