public synchronized void schedule(Task task, double seconds) { if (task.isKilled()) { return; } if (seconds < 0.0) { throw new IllegalArgumentException("cannot schedule a Task in the past"); } int ticks = 1 + (int) (seconds * 10.0 + 0.5); if (isActive(task)) { linkOut(task); } task.slot((ticks + currSlot) & MASK); task.iter(currIter + ((ticks + currSlot) >> SHIFT)); linkIn(task); }
public synchronized void scheduleNow(Task task) { if (task.isKilled()) { return; } if (isActive(task)) { linkOut(task); } task.slot(SLOTS); task.iter(0); linkIn(task); }