After a little testing
public static boolean isRunning(ScheduledFuture future) {
return future.getDelay(TimeUnit.MILLISECONDS) <= 0;
}
works like a charm. It seems that the task is reconfigured only after completion, so it getDelay()returns a negative value.
source
share