- Joined
- Dec 10, 2008
- Messages
- 1
- Reaction score
- 0
Hi..i am using java 1.5's concurrent package's scheduleAtfixedrate method as
final ScheduledExecutorService scheduler=Executors.newScheduledThreadPool(1);
scheduler.scheduleAtFixedRate(new Runnable(){public void run()
{
mainLoop();
}},0,FIVE_MIN,TimeUnit.MILLISECONDS);
where FIVE_MIN=5*60*1000
The prblem i am facing is that after certain time, the function gets scheduled 1 sec before 5 min. Like if first executed at 9:00:00, second execution occurs at 9:04:59 instead of 9:05:00. What can be the cause of this early scheduling..?
Any help is much appreciated..
final ScheduledExecutorService scheduler=Executors.newScheduledThreadPool(1);
scheduler.scheduleAtFixedRate(new Runnable(){public void run()
{
mainLoop();
}},0,FIVE_MIN,TimeUnit.MILLISECONDS);
where FIVE_MIN=5*60*1000
The prblem i am facing is that after certain time, the function gets scheduled 1 sec before 5 min. Like if first executed at 9:00:00, second execution occurs at 9:04:59 instead of 9:05:00. What can be the cause of this early scheduling..?
Any help is much appreciated..