[OCP 17 book] | [OCP 11 book] | [OCA 8 book] [OCP 8 book] [Practice tests book] [Blog] [JavaRanch FAQ] [How To Ask Questions] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Originally posted by Jeanne Boyarsky:
I remember reading that you aren't supposed to explicitly use threads in a J2EE application.
The future is here. It's just not evenly distributed yet. - William Gibson
Sonny Gill LinkedIn
Tweets
When application has spun its own threads from an EJB, accessing a database is not supported (per the J2EE specification). If a Servlet is spinning its own threads and accessing a database, the J2EE specification is not clear on this, so WebSphere Application Server 5.0 will allow it at this time. IBM is working with Sun to clarify this in the specification, so eventually (i.e. J2EE 1.4) spun threads from a Servlet accessing a database outside of a transaction will not be supported either.
[OCP 17 book] | [OCP 11 book] | [OCA 8 book] [OCP 8 book] [Practice tests book] [Blog] [JavaRanch FAQ] [How To Ask Questions] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Originally posted by Sonny Gill:
That sounds like a real limitation at the first glance though. What if there is a reasonable need to create a thread, and you are not using an EJB environment?
Originally posted by adeel ansari:
it means if some other regular(plain) java class spins its own thread, then it would be Ok. isn't it Jeanne??
Originally posted by Jeanne Boyarsky:
Regardless of whether you use threads or MDBs, the last thing your request should do is write something to the HttpSession. (or you could use an in progress indicator that you remove when done - same id.) That way the polling servlet can check whether the request is finished.
JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
[OCP 17 book] | [OCP 11 book] | [OCA 8 book] [OCP 8 book] [Practice tests book] [Blog] [JavaRanch FAQ] [How To Ask Questions] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
[OCP 17 book] | [OCP 11 book] | [OCA 8 book] [OCP 8 book] [Practice tests book] [Blog] [JavaRanch FAQ] [How To Ask Questions] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
[OCP 17 book] | [OCP 11 book] | [OCA 8 book] [OCP 8 book] [Practice tests book] [Blog] [JavaRanch FAQ] [How To Ask Questions] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Originally posted by Jeanne Boyarsky:
Corey,
One more thing: I don't remember if you are using WSAD. But if so, I found this IBM article to be very useful.
Originally posted by Jeanne Boyarsky:
I agree with Sonny that it's not ok to circularly use threads. If a servlet calls a class which creates a thread, for all intents and purposes the servlet is creating a thread.
Originally posted by adeel ansari:
Hm, Ok. But i am a bit confused here. say if we want to do something after a certain period of time constantly, like a scheduled work. and we use Timer class in one of our POJO behind the servlet.
is it not right to do this?? because Timer class spins a thread.
[OCP 17 book] | [OCP 11 book] | [OCA 8 book] [OCP 8 book] [Practice tests book] [Blog] [JavaRanch FAQ] [How To Ask Questions] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
The future is here. It's just not evenly distributed yet. - William Gibson
Sonny Gill LinkedIn
Tweets
What do you have to say for yourself? Hmmm? Anything? And you call yourself a tiny ad.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
|