[ https://issues.apache.org/jira/browse/ZOOKEEPER-4952?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Li Wang updated ZOOKEEPER-4952: ------------------------------- Affects Version/s: 3.9.3 3.9.2 3.8.4 3.9.1 3.8.3 3.8.2 3.9.0 3.8.0 > Reduce the GC overhead of Prometheus reject exception handling > -------------------------------------------------------------- > > Key: ZOOKEEPER-4952 > URL: https://issues.apache.org/jira/browse/ZOOKEEPER-4952 > Project: ZooKeeper > Issue Type: Improvement > Components: metric system > Affects Versions: 3.8.0, 3.9.0, 3.8.2, 3.8.3, 3.9.1, 3.8.4, 3.9.2, 3.9.3 > Reporter: Li Wang > Priority: Critical > > The default RejectedExecutionHandler using by ThreadPoolExecutor is > AbortPolicy. It has lots of GC overhead as it performs toString() on both > Runnable object and exception object. > This is to reduce the GC overhead by implementing a > PrometheusRejectExceptionHandler to override the rejectedExecution() API. > {code:java} > public static class AbortPolicy implements RejectedExecutionHandler { > /** > * Creates an {@code AbortPolicy}. > */ > public AbortPolicy() { } > /** > * Always throws RejectedExecutionException. > * > * @param r the runnable task requested to be executed > * @param e the executor attempting to execute this task > * @throws RejectedExecutionException always > */ > public void rejectedExecution(Runnable r, ThreadPoolExecutor e) { > throw new RejectedExecutionException("Task " + r.toString() + > " rejected from " + > e.toString()); > } > } > {code} -- This message was sent by Atlassian Jira (v8.20.10#820010)