changeset 24376:ad2f268e4a25

7153400: ThreadPoolExecutor's setCorePoolSize method allows corePoolSize > maxPoolSize Reviewed-by: chegar, martin, mduigou Contributed-by: Pavel Rappo <pavel.rappo@oracle.com>
author chegar
date Wed, 14 May 2014 15:46:27 +0100
parents b24c12a4c734
children 2e754d3dbdf2
files jdk/src/share/classes/java/util/concurrent/ThreadPoolExecutor.java
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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;