• Post Reply Bookmark Topic Watch Topic
  • New Topic

monthly thread Scheduling

 
aman hindustani
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello to all.

i need to generate monthly report ..

every first day of the month ..the report has to be generated..taking a records from the date base ...(by taking from and to date)

can anyone help me ....how to Schedule..for a .. month...

Thanks to all...
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Assuming you have a JVM that will be up all the time, say an app server that never restarts: compute the next time the report should run, compute the milliseconds between then and now, make a Java Timer that will wait that long and then execute and compute a new next time.

Because JVMs don't stay up forever, you probably need to persist the "next scheduled run" in a file or database or whatever. At JVM startup, read the stored time and set up the Timer.

Or invest a little time in learning Quartz which does all this and more.

Any of that seem to work for your problem?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!