Creating HA Stateful Session Beans
Clustered Stateful Session Beans ( SFSB ) have built-in failover capabilities. This means
that the state of @Stateful EJBs is 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 invoca-
tions addressed to it. It is possible to disable this feature for specific beans using the
The following diagram depicts a typical exchange of information between the EJB client
application and the remote EJB component:
As you can see, after a successful lookup of an SFSB via Java Naming and Directory In-
terface ( JNDI ), a proxy is returned to the client for subsequent method invocations.
Since the EJB is clustered, it will return a session ID and along with it the affinity of that
session, that is, the name of the cluster to which the stateful bean belongs to on the server
side. This affinity will later help the EJB client to route the invocations on the proxy appro-
priately to a specific node in the cluster.
Search WWH ::