• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Periodically calling a servlet..

 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi ranchers,,
i created a simple Servlet and ran it on Apache Tomcat. This servlet reads an xml file from host url and stores data into DB, now my question is I want this servlet shuld be run after each 24 hrs on daily . i.e Say every night at 12:00 am my servlet revokes and parse xml file routine.

So what should i do, ? Is there any facility in Tomcat server which invoke specific servlet after fixed time of interval ??

PL help ranchers.

Regards,
 
Joe Ess
Bartender
Pie
Posts: 9266
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Sagar Rohankar:
Is there any facility in Tomcat server which invoke specific servlet after fixed time of interval ??


No.
I use cron to run periodic tasks. Windows has similar functionality in at, schtasks or task scheduler.
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You shouldn't use a servlet if you are not using it for HTTP access. If you want to run code periodically in a servlet container, use a javax.servlet.ServletContextListener in conjunction with a java.util.Timer and a java.util.TimerTask.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic