abhijeetk88 commented on code in PR #13944:
URL: https://github.com/apache/kafka/pull/13944#discussion_r1257256097


##########
core/src/main/java/kafka/log/remote/RemoteLogManager.java:
##########
@@ -951,6 +970,10 @@ public Thread newThread(Runnable r) {
             return threadPool;
         }
 
+        public Double getIdlePercent() {
+            return 1 - (double) scheduledThreadPool.getActiveCount() / 
(double) scheduledThreadPool.getCorePoolSize();

Review Comment:
   A ScheduledThreadPoolExecutor takes the `corePoolSize` in its constructor, 
and it creates a fixed-size pool using the corePoolSize.
   
https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ScheduledThreadPoolExecutor.html#ScheduledThreadPoolExecutor-int-
   
   > While this class inherits from 
[ThreadPoolExecutor](https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ThreadPoolExecutor.html),
 a few of the inherited tuning methods are not useful for it. In particular, 
because it acts as a fixed-sized pool using corePoolSize threads
   
   Since corePoolSize controls the pool size for a ScheduledThreadPoolExecutor, 
it seems better to use it here.



-- 
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: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to