changeset 9922:eb6f07ec4509

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 14eb478a5c4c
children 5c7a17a81afd
files src/share/classes/java/util/concurrent/ThreadPoolExecutor.java
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/java/util/concurrent/ThreadPoolExecutor.java	Thu May 15 18:18:19 2014 +0400
+++ b/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;