long nextRunTime = 0;
TimedTask task;
while ((task = scheduledTasks.poll(60, java.util.concurrent.TimeUnit.SECONDS)) != null) {
if (!task.isDue(currentTimeMillis())) {
long wait = task.nextRuntime() - currentTimeMillis();
if (wait > 0) {
try {
Thread.sleep(wait);
}
catch (InterruptedException e) {