File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Schedule a Timer for (starting Date, No of times, no of days) problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Schedule a Timer for (starting Date, No of times, no of days) problem" Watch "Schedule a Timer for (starting Date, No of times, no of days) problem" New topic
Author

Schedule a Timer for (starting Date, No of times, no of days) problem

Mahendran Aiyappan
Ranch Hand

Joined: Sep 05, 2005
Posts: 102
Hi guys,

I have a TimerTask which need to be scheduled for conditions such as

1) Start Date and Time

2) Frequency (no of times it needs to be run)

3) Day/Month/Year

No 3 is actually a combo box in the UI.

If Day is selected then and Frequency is 5 means - Start from the Starting date and run for the next 5 days.

Similarly if Month is selected - Start from the Starting date and run for the next Five months.

Similarly for the year.

Now how can I specify in schedule() method of the Timer object so that it can accomplish the above objective.

Please help me out from this problem.

Thanks for your comments.
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Have you worked out a schedule() call that sets up the first time and how often to run? That looks pretty straightforward if you're accustomed to dealing in times as milliseconds.

I think to make it run a certain number of times and stop you'll have to make the task keep count and cancel itself.


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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Schedule a Timer for (starting Date, No of times, no of days) problem