If you start your own threads, be sure to stop it when the webapp is reloaded without stopping resin.  Otherwise, you will have a thread leak.  Each thread has a reference to its classloader,
so all the classes loaded by that classloader will be be unloaded then the webapp is reloaded.
Eventually the permanent space of the JVM will run out.


On 10/30/06, Riccardo Cohen <[EMAIL PROTECTED] > wrote:
I prefer to use a separate thread launched by cron, out of resin.

I used to create a servlet that implements Runnable and that execute some tasks at
specified time, but as there is no need to receive http requests or answer anyway, why
bothering with the whole Resin mechanism ? A simple java class can do the work.

Of course you do not have the database bool or ejb manager, but is it absolutely necessary
for backoffice and transaction tasks ?

Pauly Shore wrote:
> I'm trying to work out a good clean way of creating a Timer thread inside a
> Resin 2.1.17 web container.
> Does anyone know a good way of implementing this?
> I have a requirement to perform some work-intensive background processing
> inside my web app, but it's too intensive to be done during a normal
> request/response cycle in my web application, so I'm looking for a way to
> 'spawn off' the processing - either into a Timer thread running in the
> background, or in a separate background thread that will not delay the
> response from the HTTP request coming in.
> I could just spawn off a thread inside my request handler, but I fear this
> is bad practice inside a web container, where the threads are managed by the
> container itself.
> Resin 3.0 has some lovely features like JCA and the Work Management API for
> managing long-working threads which would solve my problem but unfortunately
> I just can't upgrade at this point.
> Any help would be greatly appreciated. Thanks.
> Pauly
> PS. I'm using Resin 2.1.17 with Java 1.4.2_10 on Win XP (and also on Red Hat
> Linux).
> My web app is mostly Struts/JSP with Oracle JDBC Thin drivers.

Très cordialement,

Riccardo Cohen
ligne directe : 02-47-49-63-24
Moulin des Roches
37230 Fondettes - France
tel : 02-47-49-90-49
fax : 02-47-49-91-49

resin-interest mailing list

resin-interest mailing list

Reply via email to