6 Replies Latest reply on May 2, 2002 11:20 AM by camtabor

    Round Robin From MBean

    camtabor

      Hello,
      I'm hoping someone can explain why this happens and ideally supply a workaround/fix.

      Here is the setup, 2 instances of jboss-3.0.0 with a Clustered Stateless Session Bean.

      When I access the bean from a JVM that is separate from both jboss instances, round robin works great. However when I access the bean with the same code from an MBean (inside the jboss instance) I only get the stateless bean from that JVM.

      I suspect that this behavior isn't a bug and that HAJNDI is realizing that I'm in the same JVM so do not return a remote session, but that is exactly what I need it to do so I can do some parallel processing on many nodes of the cluster.

      If anyone knows just why this happens and can make a suggestion, I'd be grateful.

      Thanks in advance, Cameron

        • 1. Re: Round Robin From MBean
          camtabor

          Upon further reading, it looks like this is exactly how HA-JNDI is supposed to behave, maybe I can get around this by implementing my own load balance policy, I'm going to give that a go.

          • 2. 3712399
            camtabor

            Hmm, It appears that from within the same JVM that the LoadBalancePolicy is completely ignored, I can understand this from inside another bean, but should this always be the case? It would be nice to be able to control with the load balance policy whether the lookup uses the HA-JNDI policy or just always tries to find it locally.

            I tried setting the Initial Context in my MBean like so:

            props.put("java.naming.provider.url","localhost:1100");
            props.put"java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
            props.put("java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfaces");
            InitialContext ic = new InitialContext(props);

            In hopes that the "localhost:1100" would force the HA-JNDI stub to be returned. Does anyone have any suggestions on this?

            Thanks, Cameron

            • 3. Re: Round Robin From MBean
              slaboure

              Hello Camtabor,

              The reason it behaves this way is that the HA-JNDI is for nothing in this. In fact, the it is the *invoker* that will see that the target is available locally and optimize the call directly. This is by design.

              Maybe, the easiest thing to do for you would be to start another JBoss instance, remove almost *all* services from it and only keep you MBeans inside. As calls won't be able to be co-located, the load-balancing policy will work perfectly.

              Cheers,



              Sacha

              • 4. Re: Round Robin From MBean
                camtabor

                That's what I'll probably do, thanks.

                • 5. Re: Round Robin From MBean
                  camtabor

                  I tried to call it from an "external" mbean in another JVM and I get an error saying that the ejb is not bound. However, when I run it from a standalone client, it works perfectly.

                  I set up the jboss instance with the mbean to be part of the cluster so (hopefully) it would realize that the bean was not available locally and do the lookup on the cluster, but it never does. It appears to not even try to look it up on the cluster.

                  I set up the second instance with the bare minumum and set the HA-JNDI port to 1111. Any help would be appreciated.

                  • 6. Re: Round Robin From MBean
                    camtabor

                    Hmm,
                    It works now. I must have had something set up wrong. Good enough for me, thanks for the suggestion.