There's more...

You can configure Executor to use any implementation of the BlockingQueue interface. One interesting implementation is DelayQueue. This class is used to store elements with delayed activation. It provides methods that only return active objects. You can use this class to implement your own version of the ScheduledThreadPoolExecutor class.

Get Java 9 Concurrency Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.