One of the biggest issues of creating objects using home interface is performance. Below are the steps which follow when you call the EJB object:-
- JAVA client calls the local stub.
- Stub marshal the values in to some other form which the network understands and sends it to the skeleton.
- Skeleton then de-marshals it back to a form which is suitable for JAVA.
- Skeleton then calls the EJB object and methods.
- EJB object then does object creation, connection pooling, transaction etc.
- Once EJB object calls the bean and the bean completes its functionalities. All the above steps must again be repeated to reach back to the JAVA client.
So you can easily guess from the above step that its lot of work. But this has been improved in EJB 2.0 using Local objects. Local objects implement local interface rather than using remote interface. Just to have a comparison below are the steps how the local object works.
- JAVA client calls the local object.
- Local object does connection pooling, transactions and security.
- It then passes calls the bean and when bean completes its work it returns the data to the Local object who then passes the same to the end client.
See the following video on Introduction to EJB in Java: -
Click to get Java Training
Regards,
Get more Java Training from author’s blog