zuston commented on code in PR #150:
URL: https://github.com/apache/incubator-uniffle/pull/150#discussion_r946804885
##########
common/src/main/java/org/apache/uniffle/common/rpc/GrpcServer.java:
##########
@@ -76,6 +81,41 @@ public GrpcServer(RssBaseConf conf, BindableService service,
GRPCMetrics grpcMet
}
}
+ public static class GrpcThreadPoolExecutor extends ThreadPoolExecutor {
+ private final GRPCMetrics grpcMetrics;
+ private final AtomicLong activeThreadSize = new AtomicLong(0L);
+
+ public GrpcThreadPoolExecutor(
+ int corePoolSize,
+ int maximumPoolSize,
+ long keepAliveTime,
+ TimeUnit unit,
+ BlockingQueue<Runnable> workQueue,
+ ThreadFactory threadFactory,
+ GRPCMetrics grpcMetrics) {
+ super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue,
threadFactory);
+ this.grpcMetrics = grpcMetrics;
+ }
+
+ @Override
+ protected void beforeExecute(Thread t, Runnable r) {
+ grpcMetrics.setGauge(GRPCMetrics.GRPC_SERVER_EXECUTOR_ACTIVE_THREADS_TAG,
+ activeThreadSize.incrementAndGet());
+
grpcMetrics.setGauge(GRPCMetrics.GRPC_SERVER_EXECUTOR_BLOCKING_QUEUE_SIZE_TAG,
+ getQueue().size());
+ super.beforeExecute(t, r);
+ }
+
+ @Override
+ protected void afterExecute(Runnable r, Throwable t) {
Review Comment:
Yes, it will. And the `Throwable t` will not null when exception is thrown
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]