aspose file tools
The moose likes Threads and Synchronization and the fly likes monthly  thread  Scheduling Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Reply Bookmark "monthly  thread  Scheduling" Watch "monthly  thread  Scheduling" New topic
Author

monthly thread Scheduling

aman hindustani
Ranch Hand

Joined: Jun 15, 2006
Posts: 53
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

Joined: Jan 29, 2003
Posts: 8791
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?


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
 
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: monthly thread Scheduling
 
Similar Threads
recurrence booking system
Best Solution for Presenting Data
Date Format
If one has to develop a servlet/jsp appln. from scratch... :-)
Please help me format my date for Oracle/SQL