Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Servlet Interest »

Re: Thread Question

Zerbe John W

2004-05-18

Replies:

With the introduction of EJB 2.0 Message Driven Beans, you no longer need to start and manage your own threads to do asynchronous processing.

While the answer to the original question is "yes", the recommendation is no. By creating your own threads, you're making the container's job more difficult, especially if you are using container managed resources from those threads.

Example: You create a security context for your thread in order to use a java Connector, or to call an ejb.
If that is not a "container managed" thread, the container may not know how to clean up those resources when either they "time out", or the thread ends.

If you have the option to use MDBs, you can configure the number of container managed threads available to the JMS listener to invoke MDB instances. The transaction management, security, and threading are now the container's responsibility.


-----Original Message-----
From: A mailing list for discussion about Sun Microsystem's Java Servlet
API Technology. [mailto:SERVLET-INTEREST@(protected)
Stølsvik
Sent: Tuesday, May 18, 2004 10:25 AM
To: SERVLET-INTEREST@(protected)
Subject: Re: Thread Question


On Tue, 18 May 2004, Zerbe John W wrote:

| Why do you think you need to start threads in a J2EE application?

This is "-SERVLET- interest".. So I presume he's talking about servlets.
Yes, he is.

The answer to the original question is most probably "yes".

Endre

|
| -----Original Message-----
| From: A mailing list for discussion about Sun Microsystem's Java Servlet
| API Technology. [mailto:SERVLET-INTEREST@(protected)
| Karthikeyan
| Sent: Tuesday, May 18, 2004 4:46 AM
| To: SERVLET-INTEREST@(protected)
| Subject: Thread Question
|
|
| Hi all,
|
|  I want to create 10 threads for an Object. If it exceed 10 threads
| then I want to create new instance of that Object.
|
|  Is it possible in servlet.
|
|  Have a great day.
|
| Karthikeyan B
|

___________________________________________________________________________
To unsubscribe, send email to listserv@(protected)
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

The information contained in this e-mail may be confidential and is intended solely for the use of the named addressee.
Access, copying or re-use of the e-mail or any information contained therein by any other person is not authorized.
If you are not the intended recipient please notify us immediately by returning the e-mail to the originator.(A)

___________________________________________________________________________
To unsubscribe, send email to listserv@(protected)
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
©2008 junlu.com - Jax Systems, LLC, U.S.A.