Multi-threaded servlet environment - Mailing list pgsql-jdbc

From David Wall
Subject Multi-threaded servlet environment
Date
Msg-id 002e01c3ce71$953e72f0$3201a8c0@rasta
Whole thread Raw
Responses Re: Multi-threaded servlet environment
Re: Multi-threaded servlet environment
List pgsql-jdbc
I recall reading that conformant servlets and such (EJBs?) do not create
their own threads, something about being a container issue.

Does anybody know the primary objection to launching threads that take on a
life of their own?  The container doesn't really need to manage it, per se.
I suppose a container can drop servlet objects from memory, but as that
wouldn't necessarily affect a daemon thread, it seems that doesn't harm
launching them at startup.

Does anybody know if most servlet containers today (Tomcat 4+, WebLogic,
WebSphere...) have a real problem with such new threads being created or
not?  What would be the risk in my using them?

For example, while I understand the need for a request to drive servlets,
even WEB-INF/web.xml allows me to configure servlets that are invoked when
the system is started, for example, and the need for background processing
tasks is quite common in even mildly sophisticated applications (like
threads that check for changed or new files locally or via URLs, or do
backups, or find old data that can be automatically deleted, or for sending
alerts to people after so much time has passed, unlocking a blocked activity
after so much time has passed, etc.).  It's quite easy to create new threads
that wake up periodically and perform a myriad of application chores that
are outside of the scope of an external event driving a transaction.

My application could be streamlined quite a bit if I could get rid of a
standalone Java application that does those server-based tasks on behalf of
the servlet application.

Thanks,
David


pgsql-jdbc by date:

Previous
From: Kris Jurka
Date:
Subject: Re: getBinaryStream/setBinaryStream 7.2<->7.4 Question
Next
From: "Keith Bottner"
Date:
Subject: previous throws