File tree Expand file tree Collapse file tree 3 files changed +9
-9
lines changed
main/java/org/springframework
test/java/org/springframework/core/task Expand file tree Collapse file tree 3 files changed +9
-9
lines changed Original file line number Diff line number Diff line change 48
48
* @see org.springframework.scheduling.commonj.WorkManagerTaskExecutor
49
49
*/
50
50
@ SuppressWarnings ("serial" )
51
- public class SimpleAsyncTaskExecutor extends CustomizableThreadCreator implements AsyncListenableTaskExecutor , Serializable {
51
+ public class SimpleAsyncTaskExecutor extends CustomizableThreadCreator
52
+ implements AsyncListenableTaskExecutor , Serializable {
52
53
53
54
/**
54
55
* Permit any number of concurrent invocations: that is, don't throttle concurrency.
56
+ * @see ConcurrencyThrottleSupport#UNBOUNDED_CONCURRENCY
55
57
*/
56
58
public static final int UNBOUNDED_CONCURRENCY = ConcurrencyThrottleSupport .UNBOUNDED_CONCURRENCY ;
57
59
58
60
/**
59
61
* Switch concurrency 'off': that is, don't allow any concurrent invocations.
62
+ * @see ConcurrencyThrottleSupport#NO_CONCURRENCY
60
63
*/
61
64
public static final int NO_CONCURRENCY = ConcurrencyThrottleSupport .NO_CONCURRENCY ;
62
65
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2002-2012 the original author or authors.
2
+ * Copyright 2002-2017 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.
@@ -93,7 +93,7 @@ public int getConcurrencyLimit() {
93
93
* @see #getConcurrencyLimit()
94
94
*/
95
95
public boolean isThrottleActive () {
96
- return (this .concurrencyLimit > 0 );
96
+ return (this .concurrencyLimit >= 0 );
97
97
}
98
98
99
99
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2002-2015 the original author or authors.
2
+ * Copyright 2002-2017 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.
18
18
19
19
import java .util .concurrent .ThreadFactory ;
20
20
21
- import org .junit .Ignore ;
22
21
import org .junit .Rule ;
23
22
import org .junit .Test ;
24
23
import org .junit .rules .ExpectedException ;
24
+
25
25
import org .springframework .util .ConcurrencyThrottleSupport ;
26
26
27
27
import static org .hamcrest .CoreMatchers .*;
28
-
29
28
import static org .junit .Assert .*;
30
29
31
30
/**
@@ -39,13 +38,11 @@ public class SimpleAsyncTaskExecutorTests {
39
38
public final ExpectedException exception = ExpectedException .none ();
40
39
41
40
42
- // TODO Determine why task is executed when concurrency is switched off.
43
- @ Ignore ("Disabled because task is still executed when concurrency is switched off" )
44
41
@ Test
45
42
public void cannotExecuteWhenConcurrencyIsSwitchedOff () throws Exception {
46
43
SimpleAsyncTaskExecutor executor = new SimpleAsyncTaskExecutor ();
47
44
executor .setConcurrencyLimit (ConcurrencyThrottleSupport .NO_CONCURRENCY );
48
- assertFalse (executor .isThrottleActive ());
45
+ assertTrue (executor .isThrottleActive ());
49
46
exception .expect (IllegalStateException .class );
50
47
executor .execute (new NoOpRunnable ());
51
48
}
You can’t perform that action at this time.
0 commit comments