1 22 package org.jboss.ejb3.test.stateful; 23 24 import java.rmi.RemoteException ; 25 import javax.ejb.EJBException ; 26 import javax.ejb.SessionSynchronization ; 27 import javax.ejb.Stateful ; 28 29 35 @Stateful 36 public class StatefulSyncBean implements SessionSynchronization , StatefulSyncLocal, java.io.Serializable 37 { 38 private String state; 39 private String rollbackState; 40 private boolean beforeCalled; 41 42 public boolean isBeforeCalled() 43 { 44 return beforeCalled; 45 } 46 47 public void setBeforeCalled(boolean beforeCalled) 48 { 49 this.beforeCalled = beforeCalled; 50 } 51 52 public String getState() 53 { 54 return state; 55 } 56 57 public void setState(String state) 58 { 59 this.state = state; 60 } 61 62 63 public void afterBegin() throws EJBException , RemoteException 64 { 65 rollbackState = state; 66 } 67 68 public void beforeCompletion() throws EJBException , RemoteException 69 { 70 beforeCalled = true; 71 } 72 73 public void afterCompletion(boolean committed) throws EJBException , RemoteException 74 { 75 if (!committed) state = rollbackState; 76 } 77 } 78 | Popular Tags |