Yeah, but the more and more I ask the more I hear that generating threads is
a no-no.

But that's exactly what I was thinking.  I want the class to launch when
this particular webapp is started and die when the webapp (or tomcat) is
shut down.  And it should run every five minutes or so.

I have the functionality of the thread, sleep, loop, jdbc work all hammered
out in a java application, the question is how do I get this to launch
during the startup of my webapp.

What I meant earlier about the methodology is if it would be better to use
some sort of listener (grey area to me) to await access to a resource and
then run versus creating a separate thread.

Thanks for the ideas guys, keep 'em commin'!!!

-----Original Message-----
From: Andre D Bonner [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 01, 2003 5: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]

Reply via email to