Book Image

EJB 3 Developer Guide

By : Michael Sikora
Book Image

EJB 3 Developer Guide

By: Michael Sikora

Overview of this book

Table of Contents (18 chapters)
EJB 3 Developer Guide
Credits
About the Author
About the Reviewers
Preface
Annotations and Their Corresponding Packages

Local Interfaces


Up to this point all our examples have used the session bean remote interface, as the clients have run in their own JVM outside the EJB container. Behind the scenes, a remote interface uses the RMI-IIOP protocol for network operations. This protocol stipulates that method arguments are passed by value and not by reference. Passing by value means that an object being passed from the client to the remote bean, or vice versa, is first serialized then passed over the network then deserialized. This all has an impact in terms of performance. Even if our client is a session bean invoking another in the same container there is a performance overhead if we use a remote interface because of the serialization and deserialization taking place. For this reason EJB technology provides a local interface option for session beans. Method arguments are passed by reference and not by value so improving performance.

To illustrate all this we shall create a stateless session bean which will...