Optimize the comments and logs of the dynamic example module.

pull/161/head
chen.ma 3 years ago
parent 6faba78bab
commit 48786bc738

@ -6,7 +6,7 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
/** /**
* 线 * Thread pool config.
* *
* @author chen.ma * @author chen.ma
* @date 2021/6/20 17:16 * @date 2021/6/20 17:16

@ -33,7 +33,7 @@ public class AlarmSendMessageTest {
try { try {
poolExecutor.execute(() -> ThreadUtil.sleep(10240124)); poolExecutor.execute(() -> ThreadUtil.sleep(10240124));
} catch (Exception ex) { } catch (Exception ex) {
log.error("抛出拒绝策略", ex.getMessage()); log.error("Throw reject policy.", ex.getMessage());
} }
}, 3, 1, TimeUnit.SECONDS); }, 3, 1, TimeUnit.SECONDS);
} }

@ -26,7 +26,7 @@ public class RunStateHandlerTest {
// @PostConstruct // @PostConstruct
@SuppressWarnings("all") @SuppressWarnings("all")
public void runStateHandlerTest() { public void runStateHandlerTest() {
log.info("测试线程池运行时状态接口, 30s 后开始触发拒绝策略..."); log.info("Test thread pool runtime state interface, The rejection policy will be triggered after 30s...");
ScheduledExecutorService scheduledThreadPool = Executors.newSingleThreadScheduledExecutor(); ScheduledExecutorService scheduledThreadPool = Executors.newSingleThreadScheduledExecutor();
scheduledThreadPool.scheduleAtFixedRate(() -> { scheduledThreadPool.scheduleAtFixedRate(() -> {
@ -34,12 +34,12 @@ public class RunStateHandlerTest {
ThreadPoolExecutor pool = executorService.getPool(); ThreadPoolExecutor pool = executorService.getPool();
try { try {
pool.execute(() -> { pool.execute(() -> {
log.info("线程池名称 :: {}, 正在执行即将进入阻塞...", Thread.currentThread().getName()); log.info("Thread pool name :: {}, Executing incoming blocking...", Thread.currentThread().getName());
try { try {
int maxRandom = 10; int maxRandom = 10;
int temp = 2; int temp = 2;
Random random = new Random(); Random random = new Random();
// 这里为了赋值线程池 completedTaskCount // Assignment thread pool completedTaskCount
if (random.nextInt(maxRandom) % temp == 0) { if (random.nextInt(maxRandom) % temp == 0) {
Thread.sleep(10241024); Thread.sleep(10241024);
} else { } else {
@ -55,4 +55,5 @@ public class RunStateHandlerTest {
}, 5, 2, TimeUnit.SECONDS); }, 5, 2, TimeUnit.SECONDS);
} }
} }

Loading…
Cancel
Save