删除无效的判断代码;

pull/1476/head
jiaoshuaiyi 2 years ago
parent d645c49450
commit f8df4dfc10

@ -37,13 +37,7 @@ public final class ThreadPoolExecutorUtil {
*/ */
public static void safeSetPoolSize(ThreadPoolExecutor executor, int newCorePoolSize, int newMaximumPoolSize) { public static void safeSetPoolSize(ThreadPoolExecutor executor, int newCorePoolSize, int newMaximumPoolSize) {
Assert.isTrue(newCorePoolSize <= newMaximumPoolSize, "newCorePoolSize must be smaller than newMaximumPoolSize"); Assert.isTrue(newCorePoolSize <= newMaximumPoolSize, "newCorePoolSize must be smaller than newMaximumPoolSize");
int originalMaximumPoolSize = executor.getMaximumPoolSize(); executor.setMaximumPoolSize(newMaximumPoolSize);
if (newCorePoolSize > originalMaximumPoolSize) { executor.setCorePoolSize(newCorePoolSize);
executor.setMaximumPoolSize(newMaximumPoolSize);
executor.setCorePoolSize(newCorePoolSize);
} else {
executor.setCorePoolSize(newCorePoolSize);
executor.setMaximumPoolSize(newMaximumPoolSize);
}
} }
} }

Loading…
Cancel
Save