Alice Alice - 7 months ago 36
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 :)


Please try this

scheduler.scheduleAtFixedRate(new Runnable() {
  public void run() {
}, 60, 24*60*60,TimeUnit.SECONDS);