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

    JBossCache over a JGroups Multiplexer Channel

    Arun Newbie

      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.


        • 1. Re: JBossCache over a JGroups Multiplexer Channel
          Bela Ban Master

          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);
          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);
          log.debug("ClusterPartition initialized");

          • 2. Re: JBossCache over a JGroups Multiplexer Channel
            Arun Newbie

            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 ...


            • 3. Re: JBossCache over a JGroups Multiplexer Channel
              Brian Stansberry Master

              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
                Arun Newbie

                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
                  Arun Newbie

                  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.