|
|
@ -1,3 +1,20 @@
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
|
|
|
|
* contributor license agreements. See the NOTICE file distributed with
|
|
|
|
|
|
|
|
* this work for additional information regarding copyright ownership.
|
|
|
|
|
|
|
|
* The ASF licenses this file to You under the Apache License, Version 2.0
|
|
|
|
|
|
|
|
* (the "License"); you may not use this file except in compliance with
|
|
|
|
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
|
|
|
|
* limitations under the License.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
package cn.hippo4j.common.executor.support;
|
|
|
|
package cn.hippo4j.common.executor.support;
|
|
|
|
|
|
|
|
|
|
|
|
import cn.hippo4j.common.toolkit.ThreadPoolExecutorUtil;
|
|
|
|
import cn.hippo4j.common.toolkit.ThreadPoolExecutorUtil;
|
|
|
@ -11,9 +28,7 @@ import java.util.concurrent.ThreadPoolExecutor;
|
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @author Shizi
|
|
|
|
* ThreadPoolExecutor test class
|
|
|
|
* @version 1.0
|
|
|
|
|
|
|
|
* Create by 2023-07-29 18:43
|
|
|
|
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Slf4j
|
|
|
|
@Slf4j
|
|
|
|
public class ThreadPoolExecutorUtilTest {
|
|
|
|
public class ThreadPoolExecutorUtilTest {
|
|
|
@ -67,7 +82,7 @@ public class ThreadPoolExecutorUtilTest {
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void testException(){
|
|
|
|
public void testException(){
|
|
|
|
// Test when the new core pool size is greater than the new maximum pool size, which should throw an IllegalArgumentException.
|
|
|
|
// Test n
|
|
|
|
int newCorePoolSize4 = 6;
|
|
|
|
int newCorePoolSize4 = 6;
|
|
|
|
int newMaxPoolSize4 = 4;
|
|
|
|
int newMaxPoolSize4 = 4;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|