li4wang commented on PR #2086:
URL: https://github.com/apache/zookeeper/pull/2086#issuecomment-1853158516
Instead of completely silently dropping the rejected tasks, we can also
create a `PrometheusRejectedExecutionHandler` that logs a WARN if the queue is
full to help tuning the queue size. This WARN is only logged once and the
condition check is very light weight, so the GC impact should be small.
```
private static class PrometheusRejectedExecutionHandler implements
RejectedExecutionHandler {
private static boolean maxQueueSizeExceeded = false;
@Override
public void rejectedExecution(final Runnable r, final
ThreadPoolExecutor e) {
if (!maxQueueSizeExceeded) {
maxQueueSizeExceeded = true;
LOG.warn("Prometheus metrics queue size exceeded the max");
}
}
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]