problem with java scheduleAtFixedRate

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..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,222
Members
46,809
Latest member
moe77

Latest Threads

Top