File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed
main/java/org/springframework/scheduling/concurrent
test/java/org/springframework/scheduling/concurrent Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2002-2020 the original author or authors.
2
+ * Copyright 2002-2021 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -84,10 +84,10 @@ public class ThreadPoolTaskScheduler extends ExecutorConfigurationSupport
84
84
*/
85
85
public void setPoolSize (int poolSize ) {
86
86
Assert .isTrue (poolSize > 0 , "'poolSize' must be 1 or higher" );
87
- this .poolSize = poolSize ;
88
87
if (this .scheduledExecutor instanceof ScheduledThreadPoolExecutor ) {
89
88
((ScheduledThreadPoolExecutor ) this .scheduledExecutor ).setCorePoolSize (poolSize );
90
89
}
90
+ this .poolSize = poolSize ;
91
91
}
92
92
93
93
/**
@@ -97,13 +97,13 @@ public void setPoolSize(int poolSize) {
97
97
* <p><b>This setting can be modified at runtime, for example through JMX.</b>
98
98
*/
99
99
public void setRemoveOnCancelPolicy (boolean removeOnCancelPolicy ) {
100
- this .removeOnCancelPolicy = removeOnCancelPolicy ;
101
100
if (this .scheduledExecutor instanceof ScheduledThreadPoolExecutor ) {
102
101
((ScheduledThreadPoolExecutor ) this .scheduledExecutor ).setRemoveOnCancelPolicy (removeOnCancelPolicy );
103
102
}
104
103
else if (removeOnCancelPolicy && this .scheduledExecutor != null ) {
105
104
logger .debug ("Could not apply remove-on-cancel policy - not a ScheduledThreadPoolExecutor" );
106
105
}
106
+ this .removeOnCancelPolicy = removeOnCancelPolicy ;
107
107
}
108
108
109
109
/**
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2002-2020 the original author or authors.
2
+ * Copyright 2002-2021 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
19
19
import java .util .concurrent .TimeUnit ;
20
20
21
21
import org .junit .jupiter .api .Test ;
22
+
22
23
import org .springframework .core .task .AsyncListenableTaskExecutor ;
23
24
24
25
import static org .assertj .core .api .Assertions .assertThat ;
@@ -32,6 +33,7 @@ class ThreadPoolTaskExecutorTests extends AbstractSchedulingTaskExecutorTests {
32
33
33
34
private final ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor ();
34
35
36
+
35
37
@ Override
36
38
protected AsyncListenableTaskExecutor buildExecutor () {
37
39
executor .setThreadNamePrefix (this .threadNamePrefix );
@@ -40,6 +42,7 @@ protected AsyncListenableTaskExecutor buildExecutor() {
40
42
return executor ;
41
43
}
42
44
45
+
43
46
@ Test
44
47
void modifyCorePoolSizeWhileRunning () {
45
48
assertThat (executor .getCorePoolSize ()).isEqualTo (1 );
@@ -108,4 +111,5 @@ void modifyKeepAliveSecondsWithInvalidValueWhileRunning() {
108
111
assertThat (executor .getKeepAliveSeconds ()).isEqualTo (60 );
109
112
assertThat (executor .getThreadPoolExecutor ().getKeepAliveTime (TimeUnit .SECONDS )).isEqualTo (60 );
110
113
}
114
+
111
115
}
You can’t perform that action at this time.
0 commit comments