|
1 | 1 | /*
|
2 |
| - * Copyright 2002-2022 the original author or authors. |
| 2 | + * Copyright 2002-2023 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.
|
|
33 | 33 | * {@link TaskExecutor} implementation that fires up a new Thread for each task,
|
34 | 34 | * executing it asynchronously.
|
35 | 35 | *
|
36 |
| - * <p>Supports limiting concurrent threads through the "concurrencyLimit" |
37 |
| - * bean property. By default, the number of concurrent threads is unlimited. |
| 36 | + * <p>Supports limiting concurrent threads through {@link #setConcurrencyLimit}. |
| 37 | + * By default, the number of concurrent task executions is unlimited. |
38 | 38 | *
|
39 | 39 | * <p><b>NOTE: This implementation does not reuse threads!</b> Consider a
|
40 | 40 | * thread-pooling TaskExecutor implementation instead, in particular for
|
@@ -133,33 +133,31 @@ public final ThreadFactory getThreadFactory() {
|
133 | 133 | * have to cast it and call {@code Future#get} to evaluate exceptions.
|
134 | 134 | * @since 4.3
|
135 | 135 | */
|
136 |
| - public final void setTaskDecorator(TaskDecorator taskDecorator) { |
| 136 | + public void setTaskDecorator(TaskDecorator taskDecorator) { |
137 | 137 | this.taskDecorator = taskDecorator;
|
138 | 138 | }
|
139 | 139 |
|
140 | 140 | /**
|
141 |
| - * Set the maximum number of parallel accesses allowed. |
142 |
| - * -1 indicates no concurrency limit at all. |
143 |
| - * <p>In principle, this limit can be changed at runtime, |
144 |
| - * although it is generally designed as a config time setting. |
145 |
| - * NOTE: Do not switch between -1 and any concrete limit at runtime, |
146 |
| - * as this will lead to inconsistent concurrency counts: A limit |
147 |
| - * of -1 effectively turns off concurrency counting completely. |
| 141 | + * Set the maximum number of parallel task executions allowed. |
| 142 | + * The default of -1 indicates no concurrency limit at all. |
| 143 | + * <p>This is the equivalent of a maximum pool size in a thread pool, |
| 144 | + * preventing temporary overload of the thread management system. |
148 | 145 | * @see #UNBOUNDED_CONCURRENCY
|
| 146 | + * @see org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor#setMaxPoolSize |
149 | 147 | */
|
150 | 148 | public void setConcurrencyLimit(int concurrencyLimit) {
|
151 | 149 | this.concurrencyThrottle.setConcurrencyLimit(concurrencyLimit);
|
152 | 150 | }
|
153 | 151 |
|
154 | 152 | /**
|
155 |
| - * Return the maximum number of parallel accesses allowed. |
| 153 | + * Return the maximum number of parallel task executions allowed. |
156 | 154 | */
|
157 | 155 | public final int getConcurrencyLimit() {
|
158 | 156 | return this.concurrencyThrottle.getConcurrencyLimit();
|
159 | 157 | }
|
160 | 158 |
|
161 | 159 | /**
|
162 |
| - * Return whether this throttle is currently active. |
| 160 | + * Return whether the concurrency throttle is currently active. |
163 | 161 | * @return {@code true} if the concurrency limit for this instance is active
|
164 | 162 | * @see #getConcurrencyLimit()
|
165 | 163 | * @see #setConcurrencyLimit
|
|
0 commit comments