|
18 | 18 | import hudson.util.NamingThreadFactory;
|
19 | 19 | import hudson.util.SequentialExecutionQueue;
|
20 | 20 | import hudson.util.StreamTaskListener;
|
21 |
| -import java.lang.reflect.Field; |
22 |
| -import java.util.concurrent.ExecutorService; |
23 | 21 | import java.util.concurrent.Executors;
|
24 | 22 | import java.util.concurrent.ThreadFactory;
|
25 | 23 | import jenkins.model.Jenkins;
|
@@ -262,22 +260,10 @@ synchronized void checkThreadPoolSize() {
|
262 | 260 | if (scmTrigger != null) {
|
263 | 261 | int count = scmTrigger.getPollingThreadCount();
|
264 | 262 | 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()))); |
281 | 267 | }
|
282 | 268 | }
|
283 | 269 | }
|
|
0 commit comments