EJ,
You can create an initialization servlet that get's loaded at startup of your
webapp. This servlet could create a thread that does what Andre suggests below. Use
the web.xml to configure any parameters you need to pass to this servlet and to ensure
it's loaded first. Then just define an init method for that servlet that creates and
executes your thread. You can use the servlet's destroy method to shut down your
thread.
Jamey
-----Original Message-----
From: Andre D Bonner [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 01, 2003 2:55 PM
To: Tomcat Users List
Subject: Re: Running a class on startup - java newbie....
>What I'd like to do is
> have <something> running that sleeps for 5 minutes at a time and then checks
> to see if 24 hours have passed since the row was inserted (and if so, delete
> it). Is there a way to start up a class with my web app?
>
Looks like good old Thread based timer
It is a thread that sits and calls a method every 5 minutes?
while(true){
Thread.sleep(5 * 60 * 1000) // 5 minutes exactly
// lookup my jdbc Datasource
// do my jdbc checking?
// releaseConnection
// loop
}
--
Andre D Bonner
Sun Certified Programmer for the Java� 2 Platform 1.4
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]