improve thread pool rejection message
This commit is contained in:
parent
e53a26ff21
commit
373e64b3eb
|
@ -49,7 +49,16 @@ public class EsAbortPolicy implements XRejectedExecutionHandler {
|
|||
}
|
||||
}
|
||||
rejected.inc();
|
||||
throw new EsRejectedExecutionException("rejected execution of [" + r.getClass().getName() + "]");
|
||||
StringBuilder sb = new StringBuilder("rejected execution ");
|
||||
if (executor.isShutdown()) {
|
||||
sb.append("(shutting down) ");
|
||||
} else {
|
||||
if (executor.getQueue() instanceof SizeBlockingQueue) {
|
||||
sb.append("(queue capacity ").append(((SizeBlockingQueue) executor.getQueue()).capacity()).append(") ");
|
||||
}
|
||||
}
|
||||
sb.append("on ").append(r.toString());
|
||||
throw new EsRejectedExecutionException(sb.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -51,6 +51,10 @@ public class SizeBlockingQueue<E> extends AbstractQueue<E> implements BlockingQu
|
|||
return size.get();
|
||||
}
|
||||
|
||||
public int capacity() {
|
||||
return this.capacity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<E> iterator() {
|
||||
final Iterator<E> it = queue.iterator();
|
||||
|
|
Loading…
Reference in New Issue