I am wondering then what this part of the EJB 2.0 spec means from 24.1.2
Programming restrictions:

"* The enterprise bean must not attempt to manage threads. The enterprise
bean must not attempt to start, stop, suspend, or resume a thread; or to
change a thread's priority or name. The enter-prise bean must not attempt to
manage thread groups.
These functions are reserved for the EJB Container. Allowing the enterprise
bean to manage threads would decrease the Container's ability to properly
manage the runtime environment."

I would think that this means that a bean shouldn't manage its own thread or
any other's.  The only place I have heard (and recently from a BEA speaker)
that you could "legally" create and/or manage threads, sockets, i/o, etc is
in a JCA connector.  I imagine the extreme of this would be if all active
beans were sleeping for long periods of time, I don't know how well a
container would handle this.  Or what would happen if it wanted to passivate
a sleeping bean.

As discussed for testing purposes it would probably be ok to sleep with the
appropriate InterruptedException catch, but with the knowledge that it may
or may not have some affect upon the container's thread management if any.

Chris Thompson
Bean-test Developer
http://www.empirix.com

-----Original Message-----
From: Cedric Beust [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 24, 2002 2:27 PM
Subject: Re: Thread.sleep()


> From: A mailing list for Enterprise JavaBeans development
> [mailto:[EMAIL PROTECTED]] On Behalf Of Dmitri Colebatch

> its not juse unwise, its against the spec.... but thats not
> what you're asking...

Aren't you reading the spec a little too litterally?  It's forbidden to
spawn threads, but it doesn't mean the whole Thread API is banned.
Thread.sleep() is very harmless, I can't really see why a container
would disallow it.

--
Cedric

===========================================================================
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