problem with java scheduleAtFixedRate

Discussion in 'Software' started by ashish_p84, Dec 10, 2008.

  1. ashish_p84

    ashish_p84

    Joined:
    Dec 10, 2008
    Messages:
    1
    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..
     
    ashish_p84, Dec 10, 2008
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Fernando Kohan

    JAVA VIRTUAL MUCHINE OR SUN JAVA

    Fernando Kohan, Nov 13, 2004, in forum: Firefox
    Replies:
    1
    Views:
    919
    Clark
    Nov 14, 2004
  2. dakine

    MS Java or Sun Java???

    dakine, Jul 20, 2004, in forum: Computer Support
    Replies:
    9
    Views:
    1,477
  3. emerald
    Replies:
    3
    Views:
    12,799
    The Modfather
    May 14, 2006
  4. chuck

    Firefox and Java - but no Java

    chuck, Mar 19, 2007, in forum: Firefox
    Replies:
    1
    Views:
    382
    Peter.Potamus.the.Purple.Hippo@gmail.com
    Mar 19, 2007
  5. -Dan-
    Replies:
    0
    Views:
    568
    -Dan-
    Aug 5, 2005
Loading...

Share This Page