You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "joerghoh (via GitHub)" <gi...@apache.org> on 2024/09/21 19:26:35 UTC

Re: [PR] Add processor based calculation for the eventing threadpool [sling-org-apache-sling-event]

joerghoh commented on code in PR #38:
URL: https://github.com/apache/sling-org-apache-sling-event/pull/38#discussion_r1769640388


##########
src/main/java/org/apache/sling/event/impl/EventingThreadPool.java:
##########
@@ -53,11 +55,19 @@ public class EventingThreadPool implements ThreadPool {
     public @interface Config {
 
         @AttributeDefinition(name = "Pool Size",
-              description="The size of the thread pool. This pool is used to execute jobs and therefore "
-                        + "limits the maximum number of jobs executed in parallel.")
-        int minPoolSize() default 35;
+                description = "The size of the thread pool. This pool is used to execute jobs and therefore "
+                        + "limits the maximum number of jobs executed in parallel. "
+                        + "A value of -1 is substituted with the number of available processors. "
+                        + "A decimal number between 0.0 and 1.0 is treated as a fraction of available processors. "
+                        + "For example 0.5 means half of the available processors. ")
+        double minPoolSize() default 35;

Review Comment:
   I think that this has the chance to break a system where this value is defined as int. Have you checked how a running works if you provide an int? Is it automatically converted to a double?



##########
src/main/java/org/apache/sling/event/impl/EventingThreadPool.java:
##########
@@ -53,11 +55,19 @@ public class EventingThreadPool implements ThreadPool {
     public @interface Config {
 
         @AttributeDefinition(name = "Pool Size",
-              description="The size of the thread pool. This pool is used to execute jobs and therefore "
-                        + "limits the maximum number of jobs executed in parallel.")
-        int minPoolSize() default 35;
+                description = "The size of the thread pool. This pool is used to execute jobs and therefore "
+                        + "limits the maximum number of jobs executed in parallel. "
+                        + "A value of -1 is substituted with the number of available processors. "
+                        + "A decimal number between 0.0 and 1.0 is treated as a fraction of available processors. "
+                        + "For example 0.5 means half of the available processors. ")
+        double minPoolSize() default 35;
     }
 
+    /**
+     * Logger.
+     */
+    private final Logger logger = LoggerFactory.getLogger(this.getClass());

Review Comment:
   I think that in most Sling classes we use a static Logger:
   
   ```suggestion
       private static final Logger LOGGER = LoggerFactory.getLogger(EventingThreadPool.class);
   ```



-- 
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: dev-unsubscribe@sling.apache.org

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