Hi!

Ingo Schuster wrote:
> What happens to a running thread in the EJB container when the client that
> initiated the call gets terminated?

It keeps running. This is a virtue of the EJB specification being on the
RMI interface, if memory serves me right.

> I tried it using Visual Age/J 3.0. The Client calls the EJB which in turn
> starts an eternal loop. Even though I terminate the client process, the EJB
> keeps running.
> I wonder if this behaivior is just vendor-specific or ensured by the spec?
> If I had a thread waiting like this for some event, this could possibly consume
> quite a lot of time. Is there a good way to slow the thread down, like sleep
> for several milliseconds or change the priority?
>
> The reason for my questions: The EJB container doesn't allow you to create new
> threads. However, in some cases it is desirable to have a second thread - for
> example to implement callbacks or to have a background thread observing data
> and notifing a client about changes. If it was possible to create some sort of
> thread-pool in the EJB container they could wait there until a client needs to
> use them.
>
> Any ideas?

Well, you're using the wrong tool to your solution. EJB is about
synchronous components. If you want asynchronous behaviour you should
use JMS. JMS will solve this problem quite elegantly (see
java.sun.com/products/jms).

/Rickard

--
Rickard �berg

@home: +46 13 177937
Email: [EMAIL PROTECTED]
http://www.dreambean.com
Question reality

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to