• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

monthly thread Scheduling

 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
reply
    Bookmark Topic Watch Topic
  • New Topic