15.3. The ‘this’ reference and loop-back calls

In object-oriented programming it is often necessary for an object to pass a reference to itself to another object. In ordinary programming for the Java platform, we could do this:

someObject.someMethod(this); 

The ‘this’ reference denotes the calling object, and is passed by reference, subject to the usual method call semantics.

An EJB can (cautiously) pass a reference to itself to another EJB, but it should not normally pass this. The usual reason for passing a self-reference is so that the target can call back on the caller. In the EJB Specification, this is called a loop-back call. Such a call won’t be possible in EJBs if we pass this: It is serializable and passed by value. The equivalent ...

Get Applied Enterprise JavaBeans™ Technology now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.