Hi all ,
Is a recursive method call allowed in an EJB (either 1.x or 2.0) given that the method is a remote method ?
Example :
EJB has a remote method called doMethod(int i).Does the EJB specs allows for the following ?:
public void doMethod(int i) {
if (i < 10) {
doMethod(i++);
}
}
I know that re-entrant beans are dangerous and not recommended, but would a simple recursive method call like above be categorized as re-entrant ?
Thanks.
Kean
-
Is recursive method call allowed in an EJB ? (2 messages)
- Posted by: Oon Kean Lin
- Posted on: December 19 2001 02:34 EST
Threaded Messages (2)
- Is recursive method call allowed in an EJB ? by Meeraj Kunnumpurath on December 19 2001 08:30 EST
- Is recursive method call allowed in an EJB ? by Gal Binyamini on December 20 2001 18:54 EST
-
Is recursive method call allowed in an EJB ?[ Go to top ]
- Posted by: Meeraj Kunnumpurath
- Posted on: December 19 2001 08:30 EST
- in response to Oon Kean Lin
It does. But you can't make reentrant calls without making the bean explicitly reentrant in the DD. -
Is recursive method call allowed in an EJB ?[ Go to top ]
- Posted by: Gal Binyamini
- Posted on: December 20 2001 18:54 EST
- in response to Oon Kean Lin
This call is not reentrant. This is reentrant:
public void doMethod(int i) {
MyInterface remoteThis = (MyInterface)ejbContext.getEJBObject();
remoteThis.doMethod(i-1);
}
Calls that do not go through the remote interface are not mediated by the container, and they are not re-entrancies. The spec is a little vague about this, but there is no way containers will not allow this, because many EJBs assume that's what the spec ment. Anyway, I think they won't :)
Gal