Java Reference
In-Depth Information
@Stateful
@Clustered
public class StatefulHABean
{
public void doSomething()
{
// Do something
}
}
If you prefer to keep your code "neutral" from this point of view, you can use the
clustered element into the jboss-ejb3.xml file, as shown in the following code
snippet:
<jboss xmlns="http://www.jboss.com/xml/ns/
javaee"
xmlns:jee="http://java.sun.com/xml/ns/
javaee"
xmlns:c="urn:clustering:1.0">
<jee:assembly-descriptor>
<c:clustering>
<jee:ejb-name>StatefulHABean</jee:ejb-name>
<c:clustered>true</c:clustered>
</c:clustering>
</jee:assembly-descriptor>
</jboss>
Creating HA Stateful Session Beans
Clustered SFSB have built-in failover capabilities. This means that the state of the
@Stateful and @Clustered EJBs are replicated across the cluster nodes so that
if one of the nodes in the cluster goes down, some other node will be able to take
over the invocations.
Search WWH ::




Custom Search