Alice Alice - 1 year ago 85
Java Question

In my scheduleAtFixedRate method, I put delay time to start run the method. But this delay time cannot work and run immediatly

Here my code,

static ScheduledExecutorService scheduler = null;
scheduler.scheduleAtFixedRate(new Testing(),60, 24*60*60,TimeUnit.SECONDS);

public static Runnable Testing()
{ System.out.println("Testing...");

I want to call Runnable() method after 60 seconds later, but it call this method immediatly when i run the code.
Is there any problem in my code.
I'm new for scheduleAtFixedRate method.
Thanks :)

Answer Source

Please try this

scheduler.scheduleAtFixedRate(new Runnable() {
  public void run() {
}, 60, 24*60*60,TimeUnit.SECONDS);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download