You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Luis Andrei Cobo <va...@megapathdsl.net> on 2000/08/19 04:54:52 UTC

API question: Class instantiation with Tomcat

Is it possible to tell a servlet to execute another class on the server to
run independantly from the servlet, for example:

jsp calls a servlet and passes in a request object.

the servlet processes the request, and returns information to the client,
but also initializes a class on the server to run outside of the client
server interaction, perhaps performing some routine database clean up or
something similar, which shouldnt interrupt the flow of the client-server
process.

How is this done?

Luis


Re: API question: Class instantiation with Tomcat

Posted by ALEXANDROS KOTSIRAS <AL...@prodigy.net>.
Yes this is possible,
Have a look at www.coolservlets.com , they havea utility package called
ServletMaintenance.
The idea is that you instantiate in the init() method of a servlet that
class which runs as a thread scheduled to perform
some task every x days/hours/minutes.
The  ServletMaintenance class gives you all the scheduling functionality ,
you only need to overide the method that will be executed and also specify
how often you want it to execute (days/hours/minutes).

Alex.

----- Original Message -----
From: Luis Andrei Cobo <va...@megapathdsl.net>
To: <to...@jakarta.apache.org>
Sent: Friday, August 18, 2000 10:54 PM
Subject: API question: Class instantiation with Tomcat


> Is it possible to tell a servlet to execute another class on the server to
> run independantly from the servlet, for example:
>
> jsp calls a servlet and passes in a request object.
>
> the servlet processes the request, and returns information to the client,
> but also initializes a class on the server to run outside of the client
> server interaction, perhaps performing some routine database clean up or
> something similar, which shouldnt interrupt the flow of the client-server
> process.
>
> How is this done?
>
> Luis
>