7153400: ThreadPoolExecutor's setCorePoolSize method allows corePoolSize > maxPoolSize
Reviewed-by: chegar, martin, mduigou
Contributed-by: Pavel Rappo <pavel.rappo@oracle.com>
--- a/jdk/src/share/classes/java/util/concurrent/ThreadPoolExecutor.java Thu May 15 18:18:19 2014 +0400
+++ b/jdk/src/share/classes/java/util/concurrent/ThreadPoolExecutor.java Wed May 14 15:46:27 2014 +0100
@@ -1532,10 +1532,12 @@
*
* @param corePoolSize the new core size
* @throws IllegalArgumentException if {@code corePoolSize < 0}
+ * or {@code corePoolSize} is greater than the {@linkplain
+ * #getMaximumPoolSize() maximum pool size}
* @see #getCorePoolSize
*/
public void setCorePoolSize(int corePoolSize) {
- if (corePoolSize < 0)
+ if (corePoolSize < 0 || maximumPoolSize < corePoolSize)
throw new IllegalArgumentException();
int delta = corePoolSize - this.corePoolSize;
this.corePoolSize = corePoolSize;