1 Reply Latest reply on Jul 5, 2004 2:54 AM by pang1010

    how can i implement roundrobin?

    pang1010 Newbie

      Well,my cluster hans two node.each node has deployed a "hello world" ejb.

      i write a client to test cluster.

      the main content of client like:

       Properties props =new Properties();
       props.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
       props.put(Context.URL_PKG_PREFIXES,"jboss.naming:org.jnp.interfaces");
       props.put(Context.PROVIDER_URL,"10.40.90.164:1100,10.40.59.8:1100");
      
       Context context = new InitialContext(props);
      
       Object ref = context.lookup("hello");
      
       helloHomeObject = (helloHome) PortableRemoteObject.narrow(ref, helloHome.class);
      
      


      while first i use

       int round = 10;
      
       hello hello=helloHomeObject.create();
       while(round > 0 ){
       hello.helloworld();
       round--;
       }
      
      

      but i only see server 10.40.59.8 print"hello world" ten times.

      the second i use

      
       int round = 10;
      
       while(round > 0 ){
       hello hello=helloHomeObject.create();
       hello.helloworld();
       round--;
       }
      


      also the same result.

      but if i shutdown the server10.40.59.8,server10.40.90.164 can finish the job.

      it seems like i only implement fail-over but not load-balance.


      i use jboss3.0.3,and did not modify any configure file of server.my ejb jboss.xml like this:

      <jboss>
       <enterprise-beans>
       <session>
       <ejb-name>hello</ejb-name>
       <jndi-name>hello</jndi-name>
       <local-jndi-name>helloLocal</local-jndi-name>
       <clustered>True</clustered>
       <cluster-config>
       <partition-name>DefaultPartition</partition-name>
       <home-load-balance-policy>
       org.jboss.ha.framework.interfaces.RoundRobin
       </home-load-balance-policy>
       <bean-load-balance-policy>
       org.jboss.ha.framework.interfaces.RoundRobin
       </bean-load-balance-policy>
       </cluster-config>
       </session>
       </enterprise-beans>
      </jboss>
      


      who can tell me where i am wrong? thanks a lot.


        • 1. Re: how can i implement roundrobin?
          pang1010 Newbie

          Sorry, i forgot to tell this.
          when i changed the order of server ,
          i.e.

          props.put(Context.PROVIDER_URL,"10.40.90.164:1100,10.40.59.8:1100");
          


          changed to

          props.put(Context.PROVIDER_URL,"10.40.59.8:1100,10.40.90.164:1100");
          


          i found the result of client invocation changed to:the server 10.40.90.164 print "hello world" ten times