JBoss.org Community Documentation
Clustering stateless session beans is most probably the easiest case: as no state is involved,
calls can be load-balanced on any participating node (i.e. any node that has this specific bean
deployed) of the cluster. To make a bean clustered, you need to modify its
jboss.xml
descriptor to contain a <clustered>
tag.
<jboss> <enterprise-beans> <session> <ejb-name>nextgen.StatelessSession</ejb-name> <jndi-name>nextgen.StatelessSession</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>
The <clustered>True</clustered>
element is really just an
alias for the <configuration-name>Clustered Stateless
SessionBean</configuration-name>
element in the conf/standard-jboss.xml file.
In the bean configuration, only the <clustered> element is mandatory. It indicates that the bean needs to support clustering features. The <cluster-config> element is optional and the default values of its attributes are indicated in the sample configuration above. Below is a description of the attributes in the <cluster-config> element..
partition-name
specifies the name of the cluster the bean
participates in. The default value is DefaultPartition
. The default
partition name can also be set system-wide using the jboss.partition.name
system property.
home-load-balance-policy
indicates the class to be used
by the home stub to balance calls made on the nodes of the cluster. By default, the proxy
will load-balance calls in a RoundRobin
fashion. You can also implement
your own load-balance policy class or use the class FirstAvailable
that
persists to use the first node available that it meets until it fails.
bean-load-balance-policy
Indicates the class to be used
by the bean stub to balance calls made on the nodes of the cluster. Comments made for the
home-load-balance-policy
attribute also apply.