1.修改创建线程池返回类

2.add Test
This commit is contained in:
wenlianggong
2024-07-01 20:38:53 +08:00
parent b587caca0d
commit 5474735197
2 changed files with 14 additions and 2 deletions

View File

@@ -28,6 +28,18 @@ import java.util.concurrent.atomic.AtomicInteger;
public class ThreadUtilTest {
@Test
public void testNewFixedExecutor(){
ThreadPoolExecutor executor = ThreadUtil.newFixedExecutor(1, 2, "test-", true);
for (int i = 0; i < 20; i++) {
executor.execute(()->{
Console.log("执行任务1");
});
}
}
@Test
public void testNewExecutorByBlockingCoefficient(){
ThreadPoolExecutor executor = ThreadUtil.newExecutorByBlockingCoefficient(0.5f);