8000 [JENKINS-36144] After careful analysis of some of the code paths, saf… · github-cloud/github-plugin@05b895f · GitHub
[go: up one dir, main page]

Skip to content

Commit 05b895f

Browse files
committed
[JENKINS-36144] After careful analysis of some of the code paths, safer not to borrow
- we will mirror the count though
1 parent 105ee8f commit 05b895f

File tree

1 file changed

+4
-18
lines changed

1 file changed

+4
-18
lines changed

src/main/java/com/cloudbees/jenkins/GitHubPushTrigger.java

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
import hudson.util.NamingThreadFactory;
1919
import hudson.util.SequentialExecutionQueue;
2020
import hudson.util.StreamTaskListener;
21-
import java.lang.reflect.Field;
22-
import java.util.concurrent.ExecutorService;
2321
import java.util.concurrent.Executors;
2422
import java.util.concurrent.ThreadFactory;
2523
import jenkins.model.Jenkins;
@@ -262,22 +260,10 @@ synchronized void checkThreadPoolSize() {
262260
if (scmTrigger != null) {
263261
int count = scmTrigger.getPollingThreadCount();
264262
if (maximumThreads != count) {
265-
maximumThreads = count;
266-
try {
267-
Field getQueue = SCMTrigger.DescriptorImpl.class.getDeclaredField("queue");
268-
getQueue.setAccessible(true);
269-
SequentialExecutionQueue q = (SequentialExecutionQueue) getQueue.get(scmTrigger);
270-
ExecutorService executors = q.getExecutors();
271-
if (this.queue.getExecutors() != executors) {
272-
// guard or otherwise we will shut it down :-(
273-
this.queue.setExecutors(executors);
274-
}
275-
} catch (NoSuchFieldException | IllegalAccessException | ClassCastException e) {
276-
queue.setExecutors(
277-
(count == 0
278-
? Executors.newCachedThreadPool(threadFactory())
279-
: Executors.newFixedThreadPool(maximumThreads, threadFactory())));
280-
}
263+
queue.setExecutors(
264+
(count == 0
265+
? Executors.newCachedThreadPool(threadFactory())
266+
: Executors.newFixedThreadPool(maximumThreads, threadFactory())));
281267
}
282268
}
283269
}

0 commit comments

Comments
 (0)
0