Jboss 6 Cluster Singleton Clustered
Posted
by
DanC
on Stack Overflow
See other posts from Stack Overflow
or by DanC
Published on 2011-03-13T00:06:10Z
Indexed on
2011/03/13
0:10 UTC
Read the original article
Hit count: 276
I am trying to set up a Jboss 6 in a clustered environment, and use it to host clustered stateful singleton EJBs.
So far we succesfully installed a Singleton EJB within the cluster, where different entrypoints to our application (through a website deployed on each node) point to a single environment on which the EJB is hosted (thus mantaining the state of static variables). We achieved this using the following configuration:
Bean interface:
@Remote
public interface IUniverse {
...
}
Bean implementation:
@Clustered @Stateful
public class Universe implements IUniverse {
private static Vector<String> messages = new Vector<String>();
...
}
jboss-beans.xml configuration:
<deployment xmlns="urn:jboss:bean-deployer:2.0">
<!-- This bean is an example of a clustered singleton -->
<bean name="Universe" class="Universe">
</bean>
<bean name="UniverseController" class="org.jboss.ha.singleton.HASingletonController">
<property name="HAPartition"><inject bean="HAPartition"/></property>
<property name="target"><inject bean="Universe"/></property>
<property name="targetStartMethod">startSingleton</property>
<property name="targetStopMethod">stopSingleton</property>
</bean>
</deployment>
The main problem for this implementation is that, after the master node (the one that contains the state of the singleton EJB) shuts down gracefuly, the Singleton's state is lost and reset to default. Please note that everything was constructed following the JBoss 5 Clustering documents, as no JBoss 6 documents were found on this subject. Any information on how to solve this problem or where to find JBoss 6 documention on clustering is appreciated.
© Stack Overflow or respective owner