tjwatson commented on code in PR #419:
URL: https://github.com/apache/felix-dev/pull/419#discussion_r2086852931


##########
scr/src/main/java/org/apache/felix/scr/impl/ComponentRegistry.java:
##########
@@ -138,6 +142,17 @@ public ComponentRegistry( final ScrConfiguration 
scrConfiguration, final ScrLogg
         m_componentHoldersByPid = new HashMap<>();
         m_componentsById = new HashMap<>();
 
+        ScheduledThreadPoolExecutor threadPoolExecutor = new 
ScheduledThreadPoolExecutor(1, new ThreadFactory()
+        {
+            @Override
+            public Thread newThread(Runnable r)
+            {
+                return new Thread(r, "SCR Component Registry");
+            }
+        });
+        threadPoolExecutor.setKeepAliveTime(10, TimeUnit.SECONDS);

Review Comment:
   If we really want to stop creating new threads I suggest we could combine 
this scheduled executor with the `ComponentActorThread` into a single executor. 
 I'm not sure why we have our own implementation of what looks like a simple 
executor with `ComponentActorThread`.  But this thread lives for the life of 
the active SCR bundle.  We could just make this a single scheduled executor 
that we post work to for both the component actor thread and for scheduling 
this change count service property update.  Then we don't have to worry about 
managing any keep alive or otherwise since this thread is always there.
   
   Although we could also let this single thread terminate in the pool of one 
also.



-- 
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-unsubscr...@felix.apache.org

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

Reply via email to