You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Arnoud Glimmerveen (Jira)" <ji...@apache.org> on 2025/05/10 14:23:00 UTC
[jira] [Created] (FELIX-6778) Reduce number of re-creation(s) of SCR Component Registry thread
Arnoud Glimmerveen created FELIX-6778:
-----------------------------------------
Summary: Reduce number of re-creation(s) of SCR Component Registry thread
Key: FELIX-6778
URL: https://issues.apache.org/jira/browse/FELIX-6778
Project: Felix
Issue Type: Improvement
Components: Declarative Services (SCR)
Reporter: Arnoud Glimmerveen
I noticed when assigning a low value to {{ds.service.changecount.timeout}} quite a lot of short-lived threads are created in quick succession during startup. I found that the current approach to cancelling a timer after successful update to the service.changecount property and the re-creating of the timer for a subsequent changecount update, especially during startup (when SCR is doing a lot of work) results in a quite lot of threads being created that are short-lived.
I propose another approach that limits the threads being created. By using a ScheduledThreadPoolExecutor, the changecount update can still scheduled with its timeout, but the executor would be able to reuse the thread for subsequent updates. Also this executor can be configured to have the thread(s) be terminated after a period of time that no tasks are scheduled on the executor, thereby ensuring that there is no thread occupying resource(s) when there are no updates to the changecount.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)