Hey Tobias,
> > See EJB 1.1 Spec 9.1.12
>
> ...
> "Second, since the container cannot, in general, tell a
> loopback from a
> concurrent call from a different client, the client programmer must be
> careful to avoif code that could lead to a concurrent call in the same
> transaction context."
>
> Does this mean if I am declaring a bean as re-entrant I not
> only have to
> deal with loopbacks (that's a thing I can take care of) but also loose
> the assertion, that there will be no concurrent calls from
> two different
> clients ?
Potentially, yes.
The goal of EJB is that you don't have to deal with complex stuff: write
your bean without worrying of multiple threads, transactions, pooling, etc,
because the container will take care of all this complexity for you.
Now if you want to make your bean reentrant, you are telling the container
"allow loopbacks"; but the container cannot distinguish between a loopback
and a concurrent call in the same tx context, they looks the same to the
container. So, by making a bean reentrant you allow also multiple threads to
enter the bean, and hence *you* have to deal with multiple thread problems
(synchronized methods and the likes). Notice however that must be concurrent
calls *from the same tx context*.
> How will jBoss handle both situations (if the code is fixed :-) ) ?
jBoss already handle both situations, taking care of multiple threads
entering an EJB, serializing them if necessary, making them wait for the
completion of one invocation if it's the case and allowing multiple threads
in (from the same tx context) if the bean is reentrant. What it does not do
yet is throwing a RemoteException in case of reentrancy not allowed, but as
you have experienced, it does not allow you to continue :)
However, think twice before using reentrant beans, most likely you can avoid
them and have a simpler design for your application.
Simon
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Problems?: [EMAIL PROTECTED]