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 @Test
@Disabled
public void testNewFixedExecutor(){ public void testNewFixedExecutor(){
final ThreadPoolExecutor executor = ThreadUtil.newFixedExecutor(1, 2, "test-", true);
ThreadPoolExecutor executor = ThreadUtil.newFixedExecutor(1, 2, "test-", true);
for (int i = 0; i < 20; i++) { for (int i = 0; i < 20; i++) {
executor.execute(()->{ executor.execute(()->{
Console.log("执行任务1"); Console.log("执行任务1");
}); });
} }
} }
@Test @Test
public void testNewExecutorByBlockingCoefficient(){ public void testNewExecutorByBlockingCoefficient(){
ThreadPoolExecutor executor = ThreadUtil.newExecutorByBlockingCoefficient(0.5f); final ThreadPoolExecutor executor = ThreadUtil.newExecutorByBlockingCoefficient(0.5f);
Console.log(executor.getCorePoolSize()); Console.log(executor.getCorePoolSize());
} }