mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-10-29 09:38:19 +08:00
🎨 #2663 优化重复消息检查器多实例导致多守护线程的问题,修改成单例+定时任务线程池处理
This commit is contained in:
committed by
GitHub
parent
41bb3b9901
commit
95be03bf1c
@ -6,6 +6,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import me.chanjar.weixin.common.api.WxErrorExceptionHandler;
|
||||
import me.chanjar.weixin.common.api.WxMessageDuplicateChecker;
|
||||
import me.chanjar.weixin.common.api.WxMessageInMemoryDuplicateChecker;
|
||||
import me.chanjar.weixin.common.api.WxMessageInMemoryDuplicateCheckerSingleton;
|
||||
import me.chanjar.weixin.common.session.InternalSession;
|
||||
import me.chanjar.weixin.common.session.InternalSessionManager;
|
||||
import me.chanjar.weixin.common.session.StandardSessionManager;
|
||||
@ -72,7 +73,7 @@ public class WxMpMessageRouter {
|
||||
ThreadFactory namedThreadFactory = new ThreadFactoryBuilder().setNameFormat("WxMpMessageRouter-pool-%d").build();
|
||||
this.executorService = new ThreadPoolExecutor(DEFAULT_THREAD_POOL_SIZE, DEFAULT_THREAD_POOL_SIZE,
|
||||
0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(), namedThreadFactory);
|
||||
this.messageDuplicateChecker = new WxMessageInMemoryDuplicateChecker();
|
||||
this.messageDuplicateChecker = WxMessageInMemoryDuplicateCheckerSingleton.getInstance();
|
||||
this.sessionManager = new StandardSessionManager();
|
||||
this.exceptionHandler = new LogExceptionHandler();
|
||||
}
|
||||
@ -83,7 +84,7 @@ public class WxMpMessageRouter {
|
||||
public WxMpMessageRouter(WxMpService wxMpService, ExecutorService executorService) {
|
||||
this.wxMpService = wxMpService;
|
||||
this.executorService = executorService;
|
||||
this.messageDuplicateChecker = new WxMessageInMemoryDuplicateChecker();
|
||||
this.messageDuplicateChecker = WxMessageInMemoryDuplicateCheckerSingleton.getInstance();
|
||||
this.sessionManager = new StandardSessionManager();
|
||||
this.exceptionHandler = new LogExceptionHandler();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user