tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dakota Jack <dakota.j...@gmail.com>
Subject Re: How to run servlet for every 30 minutes in Tomcat 4.1.30
Date Wed, 22 Dec 2004 08:07:00 GMT
Use java.util.Timer and java.util.TimerTask.  Create a Timer object. 
Timer timer = new Timer().  Then create a TimerTask object.  SomeTask
task = new SomeTasK().

private class SomeTask
      extends TimerTask {

    public void run() {
      // do stuff
      }
  }

Schedule the task:  timer.schedule(task, 10, 400).  Wallah!

I do this all the time.  You have to know what you are doing.  If you
do, then do it.  This is what the apps like Quartz do anyway.  This is
just lightweight.

Jack



-- 
"You can lead a horse to water but you cannot make it float on its back."

~Dakota Jack~

"You can't wake a person who is pretending to be asleep."

~Native Proverb~

"Each man is good in His sight. It is not necessary for eagles to be crows."

~Hunkesni (Sitting Bull), Hunkpapa Sioux~

-----------------------------------------------

"This message may contain confidential and/or privileged information.
If you are not the addressee or authorized to receive this for the
addressee, you must not use, copy, disclose, or take any action based
on this message or any information herein. If you have received this
message in error, please advise the sender immediately by reply e-mail
and delete this message. Thank you for your cooperation."

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message