2 Replies Latest reply on Feb 14, 2005 8:58 PM by Keyur Shah

    EJB 3.0 clustered SFSB: load balancing works, fail over does

    Keyur Shah Newbie

      Consider this simple example:

      public class SFSBClusterBean implements SFSBCluster, Serializable {
       transient String state = null;
       String dto = null;
       transient boolean modified = false;
       public String getState() {
       return state;
       public void updateState(String newState) {
       state = newState;
       modified = true;
       @PrePassivate public void passivate() {
       dto = state;
       state = null;
       modified = false;
       @PostActivate public void activate() {
       state = dto;
       dto = null;
       modified = false;
       public boolean isModified() {
       return modified;

      I have setup a cluster with 2 nodes... When I run multiple clients, it load balances well... However, when I shutdown one of the nodes, the clients accessing that node also die...

      I built a similar example in EJB 2.1 and it load balances as well as fails over correctly.

      One difference I noted was that while the EJB 2.1 bean's isModified() was called (and subsequently, ejbPassivate() if the bean was modified) after every client method call, the isModified() method is never called for EJB3 (and so by extension neither is the passivate() method called).

      A bug or am I doing something wrong?