File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet Refreshing at Regular Intervals

 
vaitheeswaran subramanian
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a servlet that loads on start up. All it does is loads look up data and caches it. I want this servlet to reload at regular intervals (once in an hour) and refresh its cache. How do I do that?

Vaithee
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If your servlet is not responding to web request, it shouldn't be a servlet.
Use a ServletContextListener instead.
For making your object perform tasks at given intervals look at either java.util.Timer or, if you need more functionality look at the Quartz library.


Another approach is to go with a servlet, put the lookup code in doGet or doPost, and trigger it with a web request using wget and a cronjob. This keeps you from having to spawn your own threads in a web app.
 
ashok ganesan
Ranch Hand
Posts: 50
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[Removed Hi-Jack]
[ March 04, 2008: Message edited by: Ben Souther ]
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ashok,

Please enter your question in a new thread.
Adding to the bottom of someone else's is called hi-jacking and not a nice thing to do. It has a tendency to derail the conversation about the original poster's question.

-Ben
 
ashok ganesan
Ranch Hand
Posts: 50
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
oops sorry for the mistake
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic