!1232 修改创建线程池返回类

Merge pull request !1232 from 温良恭/v6-dev
This commit is contained in:
Looly
2024-07-02 01:00:17 +00:00
committed by Gitee
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);