Skip to content

Commit 3918005

Browse files
authored
🎨 修改消息去重时线程池关闭问题
2 parents a435ee5 + d19fec7 commit 3918005

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

weixin-java-common/src/main/java/me/chanjar/weixin/common/api/WxMessageInMemoryDuplicateCheckerSingleton.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
* @author jiangby
1313
* @version 1.0
1414
* <p>
15-
* 消息去重,记录消息ID首次出现时的时间戳,
16-
* 15S后定时任务触发时废除该记录消息ID
15+
* 消息去重,记录消息ID首次出现时的时间戳,
16+
* 15S后定时任务触发时废除该记录消息ID
1717
* </p>
1818
* created on 2022/5/26 1:32
1919
*/
@@ -34,7 +34,7 @@ public class WxMessageInMemoryDuplicateCheckerSingleton implements WxMessageDupl
3434
* 线程池
3535
*/
3636
private static final ScheduledThreadPoolExecutor SCHEDULED_THREAD_POOL_EXECUTOR = new ScheduledThreadPoolExecutor(1,
37-
new ThreadFactoryBuilder().setNameFormat("wxMessage-memory-pool-%d").build(), new ThreadPoolExecutor.AbortPolicy());
37+
new ThreadFactoryBuilder().setNameFormat("wxMessage-memory-pool-%d").setDaemon(true).build(), new ThreadPoolExecutor.AbortPolicy());
3838

3939
/**
4040
* 消息id->消息时间戳的map.
@@ -71,7 +71,7 @@ public static WxMessageInMemoryDuplicateCheckerSingleton getInstance() {
7171
* 内部类实现单例
7272
*/
7373
private static class WxMessageInnerClass {
74-
static final WxMessageInMemoryDuplicateCheckerSingleton CHECKER_SINGLETON = new WxMessageInMemoryDuplicateCheckerSingleton();
74+
static final WxMessageInMemoryDuplicateCheckerSingleton CHECKER_SINGLETON = new WxMessageInMemoryDuplicateCheckerSingleton();
7575
}
7676

7777
/**

0 commit comments

Comments
 (0)