Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java Timer with Day light Savings

 
Radha Gopal
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I need to have timer that runs at 9 PM daily. I ahve used the Java timer scheduleAtFixedRate with a 24 hour delay between the runs.

But , when the day light savings occurs, it is going to run either an hour before or hour later. is there any means to make it run at the exact same time ?

Thanks
 
Paul Clapham
Sheriff
Posts: 21107
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The solution that comes to my mind is to have a task which runs every hour on the hour, and which works like "If the time is (close to) 9 PM then do (whatever it is)".
 
Radha Gopal
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Paul Clapham for your response ..
 
Mike Simmons
Ranch Hand
Posts: 3080
14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It may be worthwhile to use Quartz for this. Neither Timer nor ScheduledThreadPoolExecutor supports what you want directly. Either roll your own as Paul C advises, or use a third-party library like Quartz.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic