Eddie wrote:
> 
> Hellu,
> 
> Please some help on the following transaction scenario ?:
> 
> I am receing some information through a HTTP post method. The servlet,
> running as part of a J2EE application, calls a EJB method A. The EJB method
> does some little processing. After this, it checks some conditions, and
> might do some more processing in an other EJB method B depending on the
> conditions (in the same method still). I want to call method B in a thread,
> such that the client, performing the HTTP request, isn't waiting too long.
> So I want to start method  B in a thread, such that the initial EJB method A
> returns. How does the transacion model looks like in this case and it is
> wise to do it like this ? (My transaction attribute is set to Required and I
> am using CMP).
> I mean, is EJB method B, that runs in the thread executed in a new
> transaction, as the initial EJB method A returns, or does it run in the same
> db transaction as method A ?
> 
> Eddie

Hi Eddie.

Launching threads in an EJB is against spec, as you may have noticed.

What you may want to consider is using JMS.  

You would want to set up the EJB as a MessageDrivenBean, and then
have the onMessage call method B.

My understanding is that you can preserve the transaction/across
through a message.


-Steve
-- 
Stephen Davidson
Java Consultant
Delphi Consultants, LLC
http://www.delphis.com
Phone: 214-696-6224 x208

Reply via email to