Cover by Javier Fernández González

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

O'Reilly logo

Customizing tasks running in a scheduled thread pool

The scheduled thread pool is an extension of the basic thread pool of the Executor framework that allows you to schedule the execution of tasks to be executed after a period of time. It's implemented by the ScheduledThreadPoolExecutor class and it permits the execution of the following two kinds of tasks:

  • Delayed tasks: These kinds of tasks are executed only once after a period of time
  • Periodic tasks: These kinds of tasks are executed after a delay and then periodically every so often

Delayed tasks can execute both, the Callable and Runnable objects, but the periodic tasks can only execute Runnable objects. All the tasks executed by a scheduled pool are an implementation of the RunnableScheduledFuture ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required