This commit is contained in:
Looly 2024-07-02 09:02:42 +08:00
parent 64e4d9db7b
commit 5c60b626cd

View File

@ -29,20 +29,18 @@ public class ThreadUtilTest {
@Test
@Disabled
public void testNewFixedExecutor(){
ThreadPoolExecutor executor = ThreadUtil.newFixedExecutor(1, 2, "test-", true);
final 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);
final ThreadPoolExecutor executor = ThreadUtil.newExecutorByBlockingCoefficient(0.5f);
Console.log(executor.getCorePoolSize());
}