You can extend ScheduledThreadPoolExecutor
class and use a different queue then the DelayedWorkQueue
that is bound to the current ScheduledThreadPoolExecutor
implementation. Note that DelayedWorkQueue
is only a BlockingQueue
implementation that is using a DelayQueue
behind the scene.
But if you only need to configure min, max, keepAlive or other parameters (don't need to change the DelayedWorkQueue
) you will only extend ThreadPoolExecutor
(similar to what ScheduledThreadPoolExecutor
is doing) and in your constructor you will do something similar to what is ScheduledThreadPoolExecutor
constructors is doing right now, delegate to the ThreadPoolExecutor
like:
super(min, max, keepAliveTime, TimeUnit.NANOSECONDS,
new CustomQueue(), threadFactory);