> Dan,
>
> Some EJB servers attach various pieces of context information to threads they
> create (lets call them contained-managed threads). A user-managed thread will
> not have any of the required context information (not necessarily just
> transaction and security context), and thereby if the user-managed thread
> attempts to interact with the server/container (e.g. make an intercomponent
> call), it is possible that the server/container will crash, since it is
> perfectly valid for a server/container to ASSUME that any thread making an
> intercomponent call is a container-managed thread with the correct context.
>

But don't client make calls to EJB components?  What if the thread made calls to
other EJB's as a client?  Why would that interfere?  What if it didn't make
intercomponent calls then would it still be a problem?  Can you be even more specific
here and give a very concrete example?  Even some code would be nice.

>
> Since the spec specifically disallows EJB components from creating threads,
> some app. servers may be architected in such a way that thread creation is
> not permitted, or is restricted in some way.
>

This still doesn't answer the question as to why.

>
> So I see two possible general problem areas with EJBs that create threads:
>
> (1) The server/container doesn't implement support for threads at all, which is
>     legal although many would argue is not very nice.
>
> (2) The server/container allows EJBs to create threads, but places restrictions
>     on what can be done by user-managed threads.
>
> One way this could be addressed is by requiring the EJB server/container to
> provide a ThreadManager, e.g.
>
>   package javax.ejb;
>
>   interface EJBThread extends javax.ejb.EJBObject
>   {
>       void run();
>   };
>
>   interface ThreadManager
>   {
>       void start(EJBThread thread);
>   };
>
> The idea of the above is that instead of using "new Thread(...)" to create
> new threads, you would delegate to a ThreadManager object that is provided
> by the server/container (perhaps it could be looked up via JNDI). Then any
> EJB object that implements the EJBThread interface could be started running
> in a new container-managed thread.
> ________________________________________________________________________________
>
> Evan Ireland              Sybase EA Server Engineering       [EMAIL PROTECTED]
>                             Wellington - New Zealand              +64 4 934-5856

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