7153400: ThreadPoolExecutor's setCorePoolSize method allows corePoolSize > maxPoolSize
Reviewed-by: chegar, martin, mduigou
This commit is contained in:
parent
d395efe8f5
commit
a134b62a96
@ -1532,10 +1532,12 @@ public class ThreadPoolExecutor extends AbstractExecutorService {
|
|||||||
*
|
*
|
||||||
* @param corePoolSize the new core size
|
* @param corePoolSize the new core size
|
||||||
* @throws IllegalArgumentException if {@code corePoolSize < 0}
|
* @throws IllegalArgumentException if {@code corePoolSize < 0}
|
||||||
|
* or {@code corePoolSize} is greater than the {@linkplain
|
||||||
|
* #getMaximumPoolSize() maximum pool size}
|
||||||
* @see #getCorePoolSize
|
* @see #getCorePoolSize
|
||||||
*/
|
*/
|
||||||
public void setCorePoolSize(int corePoolSize) {
|
public void setCorePoolSize(int corePoolSize) {
|
||||||
if (corePoolSize < 0)
|
if (corePoolSize < 0 || maximumPoolSize < corePoolSize)
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException();
|
||||||
int delta = corePoolSize - this.corePoolSize;
|
int delta = corePoolSize - this.corePoolSize;
|
||||||
this.corePoolSize = corePoolSize;
|
this.corePoolSize = corePoolSize;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user