fixed a bug in PrioritizedThreadPoolExecutor:
now execute(Runnable) verifies the command is added as PrioritizedRunnable
This commit is contained in:
parent
6d9048f8cc
commit
678a8664f6
|
@ -47,6 +47,14 @@ public class PrioritizedEsThreadPoolExecutor extends EsThreadPoolExecutor {
|
|||
super(corePoolSize, maximumPoolSize, keepAliveTime, unit, new PriorityBlockingQueue<Runnable>(initialWorkQueuSize), threadFactory, handler);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(Runnable command) {
|
||||
if (!(command instanceof PrioritizedRunnable)) {
|
||||
command = PrioritizedRunnable.wrap(command, Priority.NORMAL);
|
||||
}
|
||||
super.execute(command);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected <T> RunnableFuture<T> newTaskFor(Runnable runnable, T value) {
|
||||
if (!(runnable instanceof PrioritizedRunnable)) {
|
||||
|
|
Loading…
Reference in New Issue