aspose file tools*
The moose likes Tomcat and the fly likes Periodically calling a servlet.. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Periodically calling a servlet.." Watch "Periodically calling a servlet.." New topic
Author

Periodically calling a servlet..

Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

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,


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8968
    
    9

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.


[How To Ask Questions On JavaRanch]
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42608
    
  65
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.


Ping & DNS - my free Android networking tools app
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Periodically calling a servlet..