File tree Expand file tree Collapse file tree 3 files changed +11
-11
lines changed
main/java/org/springframework
test/java/org/springframework/core/task Expand file tree Collapse file tree 3 files changed +11
-11
lines changed Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2002-2016 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.
47
47
* @see org.springframework.scheduling.commonj.WorkManagerTaskExecutor
48
48
*/
49
49
@ SuppressWarnings ("serial" )
50
- public class SimpleAsyncTaskExecutor extends CustomizableThreadCreator implements AsyncListenableTaskExecutor , Serializable {
50
+ public class SimpleAsyncTaskExecutor extends CustomizableThreadCreator
51
+ implements AsyncListenableTaskExecutor , Serializable {
51
52
52
53
/**
53
54
* Permit any number of concurrent invocations: that is, don't throttle concurrency.
55
+ * @see ConcurrencyThrottleSupport#UNBOUNDED_CONCURRENCY
54
56
*/
55
57
public static final int UNBOUNDED_CONCURRENCY = ConcurrencyThrottleSupport .UNBOUNDED_CONCURRENCY ;
56
58
57
59
/**
58
60
* Switch concurrency 'off': that is, don't allow any concurrent invocations.
61
+ * @see ConcurrencyThrottleSupport#NO_CONCURRENCY
59
62
*/
60
63
public static final int NO_CONCURRENCY = ConcurrencyThrottleSupport .NO_CONCURRENCY ;
61
64
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
/**
32
31
* @author Rick Evans
33
32
* @author Juergen Hoeller
34
33
* @author Sam Brannen
35
34
*/
36
- public final class SimpleAsyncTaskExecutorTests {
35
+ public class SimpleAsyncTaskExecutorTests {
37
36
38
37
@ Rule
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