aspose file tools
The moose likes Tomcat and the fly likes Periodically calling a servlet.. Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Reply 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: 2896
    
    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: 8259

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.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
Ulf Dittmer
Marshal

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


Android appsImageJ pluginsJava web charts
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Periodically calling a servlet..
 
Similar Threads
Cache Problem
servlet 404 error
Executing my first servlet program
Access xml from servlet
Error: Namespace not supported by SAXParser