User: starksm Date: 01/07/14 14:27:36 Modified: src/main/org/jboss/test/perf/ejb Tag: Branch_2_4 SessionBean.java Added: src/main/org/jboss/test/perf/ejb Tag: Branch_2_4 ClientSessionBean.java Entity2Bean.java TxSessionBean.java Log: Merge changes from main Revision Changes Path No revision No revision 1.1.2.1 +122 -104 jbosstest/src/main/org/jboss/test/perf/ejb/SessionBean.java Index: SessionBean.java =================================================================== RCS file: /cvsroot/jboss/jbosstest/src/main/org/jboss/test/perf/ejb/SessionBean.java,v retrieving revision 1.1 retrieving revision 1.1.2.1 diff -u -r1.1 -r1.1.2.1 --- SessionBean.java 2000/08/25 13:43:43 1.1 +++ SessionBean.java 2001/07/14 21:27:36 1.1.2.1 @@ -1,121 +1,139 @@ package org.jboss.test.perf.ejb; // SessionBean.java +import java.rmi.RemoteException; +import java.rmi.ServerException; +import javax.ejb.CreateException; +import javax.ejb.RemoveException; +import javax.ejb.SessionContext; +import javax.naming.Context; +import javax.naming.InitialContext; +import javax.naming.NamingException; +import javax.rmi.PortableRemoteObject; + import org.jboss.test.perf.interfaces.EntityHome; import org.jboss.test.perf.interfaces.Entity; import org.jboss.test.perf.interfaces.EntityPK; -public class SessionBean implements javax.ejb.SessionBean { +public class SessionBean implements javax.ejb.SessionBean +{ + private EntityHome entityHome; + + public void setSessionContext(SessionContext context) + { + } + + public void ejbCreate(String entityName) throws CreateException + { + try + { + Context context = new InitialContext(); + Object ref = context.lookup(entityName); + entityHome = (EntityHome) PortableRemoteObject.narrow(ref, EntityHome.class); + } + catch(NamingException e) + { + throw new CreateException("Cound not resolve name: " + e); + } + } - private EntityHome _entityHome; + private Entity findByPrimaryKey(int key) throws java.rmi.RemoteException + { + try + { + EntityPK primaryKey = new EntityPK(key); + return entityHome.findByPrimaryKey(primaryKey); + } + catch(javax.ejb.FinderException e) + { + throw new ServerException("Cound not find Entity: " + key, e); + } + } - public void setSessionContext(javax.ejb.SessionContext context) { - } + private java.util.Enumeration findInRange(int min, int max) throws java.rmi.RemoteException + { + try + { + return entityHome.findInRange(min, max); + } + catch(javax.ejb.FinderException e) + { + throw new ServerException("Cound not findInRange(" + min + ", " + max + "): ", e); + } + } - public void ejbCreate(String entityName) throws javax.ejb.CreateException { - try { - javax.naming.Context context = new javax.naming.InitialContext(); - Object ref = context.lookup(entityName); - - _entityHome = (EntityHome) ref; - /** CHANGES: Note that WebLogic does not support the EJB Spec - ** compliant way of casting, this code is commented out - ** and a Java cast is used to enable code compilation - _entityHome = (EntityHome) javax.rmi.PortableRemoteObject.narrow(ref, EntityHome.class); - **/ - } - catch(javax.naming.NamingException e) { - throw new javax.ejb.CreateException("Cound not resolve name: " + e); - } - } - - private Entity findByPrimaryKey(int key) throws java.rmi.RemoteException { - try { - EntityPK primaryKey = new EntityPK(key); - return _entityHome.findByPrimaryKey(primaryKey); - } - catch(javax.ejb.FinderException e) { - throw new java.rmi.ServerException("Cound not find Entity: " + key, e); - } - } - - private java.util.Enumeration findInRange(int min, int max) throws java.rmi.RemoteException { - try { - return _entityHome.findInRange(min, max); - } - catch(javax.ejb.FinderException e) { - throw new java.rmi.ServerException - ("Cound not findInRange(" + min + ", " + max + "): ", e); - } - } - - public void create(int low, int high) - throws java.rmi.RemoteException, javax.ejb.CreateException { - for(int i = low; i < high; i++) { - _entityHome.create(i, 0); - } - } - - public void remove(int low, int high) - throws java.rmi.RemoteException, javax.ejb.RemoveException { - if(low + 1 == high) { - Entity entity = findByPrimaryKey(low); - entity.remove(); - } - else { - java.util.Enumeration elements = findInRange(low, high); - while(elements.hasMoreElements()) { - Entity entity = (Entity) elements.nextElement(); - entity.remove(); - } - } - } - - public void read(int id) throws java.rmi.RemoteException { - Entity entity = findByPrimaryKey(id); - entity.read(); - } - - public void read(int low, int high) throws java.rmi.RemoteException { - java.util.Enumeration elements = findInRange(low, high); - while(elements.hasMoreElements()) { - Entity entity = (Entity) elements.nextElement(); - /** CHANGES: Note that WebLogic does not support the EJB Spec - ** compliant way of casting, this code is commented out - ** and a Java cast is used to enable code compilation - Entity entity = (Entity) javax.rmi.PortableRemoteObject.narrow(elements.nextElement(), Entity.class); - **/ + public void create(int low, int high) + throws CreateException, RemoteException + { + for(int i = low; i < high; i++) + { + entityHome.create(i, 0); + } + } + + public void remove(int low, int high) + throws RemoveException, RemoteException + { + if(low + 1 == high) + { + Entity entity = findByPrimaryKey(low); + entity.remove(); + } + else + { + java.util.Enumeration elements = findInRange(low, high); + while(elements.hasMoreElements()) + { + Entity entity = (Entity) elements.nextElement(); + entity.remove(); + } + } + } + + public void read(int id) throws RemoteException + { + Entity entity = findByPrimaryKey(id); entity.read(); - } - } + } + + public void read(int low, int high) throws RemoteException + { + java.util.Enumeration elements = findInRange(low, high); + while(elements.hasMoreElements()) + { + Entity entity = (Entity) elements.nextElement(); + entity.read(); + } + } - public void write(int id) throws java.rmi.RemoteException { - Entity entity = findByPrimaryKey(id); - int value = entity.read(); - entity.write(value + 1); - } - - public void write(int low, int high) throws java.rmi.RemoteException { - java.util.Enumeration elements = findInRange(low, high); - while(elements.hasMoreElements()) { - Entity entity = (Entity) elements.nextElement(); - /** CHANGES: Note that WebLogic does not support the EJB Spec - ** compliant way of casting, this code is commented out - ** and a Java cast is used to enable code compilation - Entity entity = (Entity) javax.rmi.PortableRemoteObject.narrow(elements.nextElement(), Entity.class); - **/ + public void write(int id) throws RemoteException + { + Entity entity = findByPrimaryKey(id); int value = entity.read(); entity.write(value + 1); - } - } + } - public void ejbRemove() { - } - - public void ejbActivate() { - } - - public void ejbPassivate() { - } + public void write(int low, int high) throws RemoteException + { + java.util.Enumeration elements = findInRange(low, high); + while(elements.hasMoreElements()) + { + Entity entity = (Entity) elements.nextElement(); + int value = entity.read(); + entity.write(value + 1); + } + } + public void ejbRemove() + { + } + + public void ejbActivate() + { + } + + public void ejbPassivate() + { + } + } No revision No revision 1.2.2.1 +0 -0 jbosstest/src/main/org/jboss/test/perf/ejb/ClientSessionBean.java Index: ClientSessionBean.java =================================================================== RCS file: /cvsroot/jboss/jbosstest/src/main/org/jboss/test/perf/ejb/ClientSessionBean.java,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 1.1.2.1 +0 -0 jbosstest/src/main/org/jboss/test/perf/ejb/Entity2Bean.java Index: Entity2Bean.java =================================================================== RCS file: /cvsroot/jboss/jbosstest/src/main/org/jboss/test/perf/ejb/Entity2Bean.java,v retrieving revision 1.1 retrieving revision 1.1.2.1 diff -u -r1.1 -r1.1.2.1 1.2.2.1 +0 -0 jbosstest/src/main/org/jboss/test/perf/ejb/TxSessionBean.java Index: TxSessionBean.java =================================================================== RCS file: /cvsroot/jboss/jbosstest/src/main/org/jboss/test/perf/ejb/TxSessionBean.java,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 _______________________________________________ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development