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 4848 * @see org.springframework.scheduling.commonj.WorkManagerTaskExecutor
4949 */
5050@ SuppressWarnings ("serial" )
51- public class SimpleAsyncTaskExecutor extends CustomizableThreadCreator implements AsyncListenableTaskExecutor , Serializable {
51+ public class SimpleAsyncTaskExecutor extends CustomizableThreadCreator
52+ implements AsyncListenableTaskExecutor , Serializable {
5253
5354 /**
5455 * Permit any number of concurrent invocations: that is, don't throttle concurrency.
56+ * @see ConcurrencyThrottleSupport#UNBOUNDED_CONCURRENCY
5557 */
5658 public static final int UNBOUNDED_CONCURRENCY = ConcurrencyThrottleSupport .UNBOUNDED_CONCURRENCY ;
5759
5860 /**
5961 * Switch concurrency 'off': that is, don't allow any concurrent invocations.
62+ * @see ConcurrencyThrottleSupport#NO_CONCURRENCY
6063 */
6164 public static final int NO_CONCURRENCY = ConcurrencyThrottleSupport .NO_CONCURRENCY ;
6265
Original file line number Diff line number Diff line change 11/*
2- * Copyright 2002-2012 the original author or authors.
2+ * Copyright 2002-2017 the original author or authors.
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
@@ -93,7 +93,7 @@ public int getConcurrencyLimit() {
9393 * @see #getConcurrencyLimit()
9494 */
9595 public boolean isThrottleActive () {
96- return (this .concurrencyLimit > 0 );
96+ return (this .concurrencyLimit >= 0 );
9797 }
9898
9999
Original file line number Diff line number Diff line change 11/*
2- * Copyright 2002-2015 the original author or authors.
2+ * Copyright 2002-2017 the original author or authors.
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
1818
1919import java .util .concurrent .ThreadFactory ;
2020
21- import org .junit .Ignore ;
2221import org .junit .Rule ;
2322import org .junit .Test ;
2423import org .junit .rules .ExpectedException ;
24+
2525import org .springframework .util .ConcurrencyThrottleSupport ;
2626
2727import static org .hamcrest .CoreMatchers .*;
28-
2928import static org .junit .Assert .*;
3029
3130/**
@@ -39,13 +38,11 @@ public class SimpleAsyncTaskExecutorTests {
3938 public final ExpectedException exception = ExpectedException .none ();
4039
4140
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" )
4441 @ Test
4542 public void cannotExecuteWhenConcurrencyIsSwitchedOff () throws Exception {
4643 SimpleAsyncTaskExecutor executor = new SimpleAsyncTaskExecutor ();
4744 executor .setConcurrencyLimit (ConcurrencyThrottleSupport .NO_CONCURRENCY );
48- assertFalse (executor .isThrottleActive ());
45+ assertTrue (executor .isThrottleActive ());
4946 exception .expect (IllegalStateException .class );
5047 executor .execute (new NoOpRunnable ());
5148 }
You can’t perform that action at this time.
0 commit comments