public void schedule(TimerTask task, Duration delay) {
        timer.schedule(new TimerTaskWrapper(task), delay.toMillis());
    }
Schedules the specified task for execution after the specified delay.

@param task  task to be scheduled.
@param delay delay before task is to be executed.
@throws IllegalArgumentException if {@code delay} is negative, or
        {@code delay + System.currentTimeMillis()} is negative.
@throws IllegalStateException if task was already scheduled or
        cancelled, or timer was cancelled.
xmppserver/src/main/java/org/jivesoftware/util/TaskEngine.java