[jboss-user] [Clustering] - Re: FirstAvailable LBP is sticky when not serialized

fuzzy333 do-not-reply at jboss.com
Tue Dec 8 11:23:19 EST 2009


The test bean I'm using to setup this scenario is an EJB3 bean. Here it is for reference:

package com.foo.session;
  | 
  | import javax.ejb.Remote;
  | import javax.ejb.Stateful;
  | 
  | import org.apache.log4j.Logger;
  | import org.jboss.annotation.ejb.Clustered;
  | import org.jboss.ha.framework.interfaces.FirstAvailable;
  | 
  | @Stateful
  | @Clustered(loadBalancePolicy=FirstAvailable.class)
  | @Remote( value= Test2.class )
  | public class Test2Bean implements Test2 {
  | 	
  | 	private final static Logger log = Logger.getLogger( Test2Bean.class );
  | 	
  | 	private int count;
  | 	
  | 	public void setCount( int count ) {
  | 		log.info( "setCount( " + count + " )" );
  | 		this.count = count;
  | 	}
  | 	
  | 	public void printCount() {
  | 		log.info( "count=" + count );
  | 	}
  | }

The load balance policy is only ever instantiated once. I copied the code from the FirstAvailable LBP to add some traces a few days ago to get a better idea of what's going on, and the constructor only ever got called once, during the app's initialization.

11:17:58,312 INFO  [JmxKernelAbstraction] installing MBean: jboss.j2ee:ear=testEAR.ear,jar=testEJB.jar,name=Test2Bean,service=EJB3 with dependencies:
  | 11:17:58,375 INFO  [EJBContainer] STARTED EJB: com.foo.session.Test2Bean ejbName: Test2Bean
  | 11:17:58,406 INFO  [MyLBPolicy] LOAD BALANCE POLICY CONSTRUCTOR CALLED

I had already removed the IsLocal interceptor after having pulled most of my hair out ;) Thanks for mentioning it though.

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4269620#4269620

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4269620



More information about the jboss-user mailing list