From 62eb57335da21c2c5f520f2d8c892852358fa5a1 Mon Sep 17 00:00:00 2001 From: Tim Jacomb Date: Fri, 25 Mar 2022 10:25:44 +0000 Subject: [PATCH] JENKINS-68116 Make event thread pool size customize-able --- src/main/java/jenkins/scm/api/SCMEvent.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/jenkins/scm/api/SCMEvent.java b/src/main/java/jenkins/scm/api/SCMEvent.java index c4a6a47e..7218bdd4 100644 --- a/src/main/java/jenkins/scm/api/SCMEvent.java +++ b/src/main/java/jenkins/scm/api/SCMEvent.java @@ -46,6 +46,7 @@ import java.util.concurrent.locks.ReentrantLock; import javax.servlet.http.HttpServletRequest; import jenkins.security.ImpersonatingScheduledExecutorService; +import jenkins.util.SystemProperties; import org.acegisecurity.context.SecurityContext; import org.acegisecurity.context.SecurityContextHolder; import org.apache.commons.lang.StringUtils; @@ -107,6 +108,9 @@ public abstract class SCMEvent

{ * @since 2.0.3 */ public static final String ORIGIN_UNKNOWN = "?"; + + private static final int EVENT_THREAD_POOL_SIZE = SystemProperties + .getInteger(SCMEvent.class.getName() + ".EVENT_THREAD_POOL_SIZE", 10); /** * The event type. */ @@ -213,7 +217,7 @@ protected SCMEvent(SCMEvent

copy) { protected static synchronized ScheduledExecutorService executorService() { if (executorService == null) { threadPoolExecutor = new ScheduledThreadPoolExecutor( - 10, + EVENT_THREAD_POOL_SIZE, new NamingThreadFactory( new ClassLoaderSanityThreadFactory(new DaemonThreadFactory()), "SCMEvent") );