Brice Ruth wrote:

I was under the impression that creating threads from within a web
application was a relatively big no-no ... I seem to remember reading in
my J2EE book it talking about their being an implicit contract between
the the application and the container that no add'l threads would be
created, so that the container can manage distributing the application, etc.

Correct. It's one of those things that you're not supposed to do, and there are certain contexts (such as within EJB methods) where it can lead to really bad outcomes. You also have to make REALLY sure that you NEVER use anything that's controlled by the servlet container in that thread: in other words, use pure DAOs and primitives to pass information into the subordinate thread, rather than passing around the PageContext or something). But it's not specifically outlawed by the specifications, and so it will actually function on every servlet container that I've run across up until now (though I've not worked with some of the fringe containers).


That's why I'm saying that doing it is probably a Bad Idea, but it's the fastest way to get the functionality that he wants. I'd recommend using JMS for this, becuase it's what it's designed for. But if he has non-JMS requirements (i.e. no J2EE application server, just a servlet container), then the thread-creation business should work.

Of course, as always, YMMV.

Kirk


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to