Results 1 to 5 of 5

Thread: Java Timer

  1. #1
    sasi25 is offline Member
    Join Date
    Dec 2009
    Posts
    4
    Rep Power
    0

    Default Java Timer

    Hi All,

    I just want to know when the below scheduled job will execute.

    schedule(new changeTimer(), 50000,3600*6* 1000);

    What am unstanding is its running for every 6 hrs with a delay of 50 sec.

    correct me if am wrong.

    At wat time it will start to execute?

    Thanks in advance.
    Last edited by sasi25; 12-09-2009 at 05:38 PM.

  2. #2
    FON
    FON is offline Senior Member
    Join Date
    Dec 2009
    Location
    Belgrade, Serbia
    Posts
    368
    Rep Power
    5

    Default

    Looks like you are correct.

    This should be your method of java.util.Timer:

    Java Code:
    public void schedule(TimerTask task,
                         long delay,
                         long period)
    Parameters:
    task - task to be scheduled.
    delay - delay in milliseconds before task is to be executed.
    period - time in milliseconds between successive task executions.

    Tip:
    When you work with time classes,
    play with system clock on your computer
    to see if you have scheduled it right :)

  3. #3
    sasi25 is offline Member
    Join Date
    Dec 2009
    Posts
    4
    Rep Power
    0

    Default

    Thanks for your reply.

  4. #4
    Demon is offline Member
    Join Date
    Jan 2010
    Posts
    1
    Rep Power
    0

    Exclamation A little help here!!!

    i have schedule five timertask on a timer to run after 10 seconds
    but it doesn't run in exact order
    first time 1 2 4 5 3
    second 2 5 4 3 1
    What's happened?

  5. #5
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,574
    Rep Power
    12

    Default

    What has that got to do with this thread?

    Perhaps it might be a good idea to start your own thread for your own question. Don't forget to actually say what you regard as the "exact order". Your code might be good, too, since if what you are seeing is not what you expect then that's because your code is not doing what you thought it would.

Similar Threads

  1. Timer in java
    By manhit45 in forum New To Java
    Replies: 4
    Last Post: 12-14-2009, 03:27 PM
  2. Replies: 0
    Last Post: 04-04-2008, 03:46 PM
  3. making a count down timer using java
    By saytri in forum New To Java
    Replies: 3
    Last Post: 12-29-2007, 10:49 PM
  4. Help with timer in java
    By barney in forum Advanced Java
    Replies: 1
    Last Post: 08-01-2007, 11:24 AM
  5. Problem with timer in java
    By paul in forum Advanced Java
    Replies: 3
    Last Post: 07-26-2007, 11:18 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •