Search This Blog

Monday, November 19, 2018

ScheduledExecutorService in Java

ScheduledExecutorService is an ExecutorService that can schedule commands to run after a given delay, or to execute periodically.

The schedule methods create tasks with various delays and return a task object that can be used to cancel or check execution. The scheduleAtFixedRate and scheduleWithFixedDelay methods create and execute tasks that run periodically until cancelled.