How do I schedule a task to run once?
While the java.util.Timer used to be a good way to schedule future tasks, it is now preferable1 to instead use the classes in the java.util.concurrent package. There is a ScheduledExecutorService that is designed specifically to run a command after a delay (or to execute them periodically, but that’s not relevant to this question). It has … Read more