5 Replies Latest reply on Nov 14, 2006 2:37 PM by u_arun

    JBossCache over a JGroups Multiplexer Channel

    u_arun

      Hi there,

      How do I create a JBossCache instance on top of a JGroups Multiplexer Channel ? I need to create multiple JBossCache instances on a single JGroups channel (Infact I need to eventually create 2 JBossCache instances and a MessageDispatcher on top of single JGroups channel). I tried to pass a previously created multiplexer channel to the JBossCache constructor, but with no luck.

      Any pointers to examples / forum threads on this topic would be appreciated.

      BTW, I am trying to use JGroups 2.4 with JBossCache 1.4.0 SP1.

      Thanks,
      Arun

        • 1. Re: JBossCache over a JGroups Multiplexer Channel
          belaban

          Look at chapter 6.3 of the JGroups manual at http://www.jgroups.org/javagroupsnew/docs/manual/html/user-advanced.html#d0e2318.
          You'll need to create 2 MuxChannels, 1 per service that wants to share the channel. Also, there are unit tests in the JGroups src distro that show you how to use the Multiplexer, or take a look at ChannelMultiplexer.java for a demo.
          You could also look into the JBoss source code (JBoss 5, CVS head): ClusterPartition.java:
          protected void createService()
          throws Exception
          {
          log.debug("Creating Multiplexer Channel for partition " + getPartitionName() +
          " using stack " + getMultiplexerStack());
          channel = (JChannel) getMultiplexer().createMultiplexerChannel(getMultiplexerStack(), getPartitionName());

          if(use_debugger && debugger == null)
          {
          debugger=new Debugger(channel);
          debugger.start();
          }
          channel.setOpt(Channel.AUTO_RECONNECT, new Boolean(true));
          channel.setOpt(Channel.AUTO_GETSTATE, new Boolean(true));

          log.debug("Creating HAPartition");
          partition = createPartition();

          // JBAS-2769 Init partition in create
          log.debug("Initializing ClusterPartition: " + partition);
          partition.init();
          log.debug("ClusterPartition initialized");
          }

          • 2. Re: JBossCache over a JGroups Multiplexer Channel
            u_arun

            Thanks for the quick reply Bela.

            I think do understand the way the MuxChannels work. My problem was more specific to using MuxChannels with TreeCache. After further investigation, it turns out that in the following code:

            TreeCache cache = new TreeCache(muxChannel);
            PropertyConfigurator config = new PropertyConfigurator();
            config.configure(cache, CACHE_CONFIG);

            The PropertyConfigurator seems to be culprit. Somehow when I use the PropertyConfigurator my cache doesn't seem to start. If I get rid of the PropertyConfigurator, everything seems to work fine.

            Am I missing something obvious here ...

            Thanks,
            Arun

            • 3. Re: JBossCache over a JGroups Multiplexer Channel
              brian.stansberry

              Missing something, but not something obvious :(.

              Multiplexer integration is not supported in 1.4.0.SP1. The configuration attributes were added, but the ability to access the multiplexer was not enabled (for reasons due to release timing.)

              Multiplexer integration is enabled in the just released 1.4.1.Beta1.

              • 4. Re: JBossCache over a JGroups Multiplexer Channel
                u_arun

                It's not so much the PropertyConfigurator, it was happening whenever I enable REPLICATION on the Cache. I had to setInactiveOnStartUp(true) for my cache(s) to startup. Now I am running into issues where its not actually replicating :(

                I'll give 1.4.1.Beta1 a try and post my observations here ... Thanks Brian

                • 5. Re: JBossCache over a JGroups Multiplexer Channel
                  u_arun

                  Brian I copied the configureForMux() method from the MultiplexerTestHelper class and modified it a little so that I can use it in my standalone app (w/o JMX and stuff). It works as expected now.

                  Brian and Bela thanks for all your help.