Unit-8 Left over Topics EJB Design Guidelines The following are very preliminary set of design guidelines for CORBA EJB programmers Remote Interface must follow the CORBA RMI/IDL subset: Programmers have a lot to gain from the merging of RMI with CORBA IDL and IIOP. The RMI-to-IDL CORBA mappings defines an RMI subset that allows CORBA clients written in non-java languages to invoke RMI services. Our EJB interface must adhere to this subset. Define a remote factory interface: The factory interface must follow the RMI/IDL subset rules. The signature of the create methods we define must match our bean’s ejbCreate methods. Don’t mess around with threads: The following care is to be taken in handling threads 1. We must not start new threads in our code. 2. Also don’t attempt to terminate the running threads. 3. Don’t use thread synchronization primitives or class variables. The idea is that OTMs(Object Transaction Monitor) will provide the multithreading and load-balancing, so we need not get in their way. Don’t issue commits or rollbacks: A transaction-enabled EJB that uses JDBC is not allowed to invoke commit or rollback methods. If our EJB is not transactionenabled, then its ok to issue commits or rollbacks. Give Containers a full ejb-jar packages: The more EJB-related information we give to a container, the better it can manage our beans. So make sure to provide a full ejb-jar that includes the following classes 1. 2. 3. 4. 5. 6. 7.
All the EJB bean implementation classes The EJB servant Tie class EJB factory EJB Finder The Deployment and security descriptors Any classes that the EJB depends on A manifest file that identifies the EJBs in the ejb-jar file.