测试线程池

master
陈思豪 2024-09-09 10:43:35 +08:00
parent 71f4a1d695
commit ef9f2e4b6a
1 changed files with 4 additions and 1 deletions

View File

@ -293,11 +293,14 @@ public class PriorityThreadPool {
public static void executeLow(Runnable task) { public static void executeLow(Runnable task) {
try { try {
lowPrioritySemaphore.acquire(); lowPrioritySemaphore.acquire();
log.info("获取许可");
executor.submit(() -> { executor.submit(() -> {
try { try {
log.info("开始执行任务");
task.run(); task.run();
log.info("执行任务完毕??");
} finally { } finally {
lowPrioritySemaphore.release(); // lowPrioritySemaphore.release();
} }
}); });
} catch (InterruptedException e) { } catch (InterruptedException e) {