Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How do I make a sevlet be called once a day?

 
Anthony Smith
Ranch Hand
Posts: 285
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a servlet in which I would like to be called once a day at a certain time? How do I accomplish that?
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13056
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is supposed to call it?
 
Anthony Smith
Ranch Hand
Posts: 285
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well I don't know. My last resort was to create a java program that wouls spawn a thread and sleep for 24 hours or something. Is it possible to do something that fires the servlet off on startup and then have it be called every 24 hours or whatever time. I know that i could arrange for a servlet to start on startup
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why do you want to use a servlet for that ?? The servlet can be used to start a timer bean e.g. (There is one provided by the J2SE spec if i remember correct) but not to be the timer itself.
 
Anthony Smith
Ranch Hand
Posts: 285
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want the sql to delete some records in my db each morning.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64629
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why not just write a little Java program to do it? A servlet doesn't make much sense for that.
bear
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic