Skip to content

Commit 105ee8f

Browse files
committed
[JENKINS-36144] Ooops need a guard when we can borrow
1 parent 3b8aaee commit 105ee8f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import hudson.util.SequentialExecutionQueue;
2020
import hudson.util.StreamTaskListener;
2121
import java.lang.reflect.Field;
22+
import java.util.concurrent.ExecutorService;
2223
import java.util.concurrent.Executors;
2324
import java.util.concurrent.ThreadFactory;
2425
import jenkins.model.Jenkins;
@@ -266,7 +267,11 @@ synchronized void checkThreadPoolSize() {
266267
Field getQueue = SCMTrigger.DescriptorImpl.class.getDeclaredField("queue");
267268
getQueue.setAccessible(true);
268269
SequentialExecutionQueue q = (SequentialExecutionQueue) getQueue.get(scmTrigger);
269-
this.queue.setExecutors(q.getExecutors());
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+
}
270275
} catch (NoSuchFieldException | IllegalAccessException | ClassCastException e) {
271276
queue.setExecutors(
272277
(count == 0

0 commit comments

Comments
 (0)