From fed695f98f059760a762e77317d91b347c2406a0 Mon Sep 17 00:00:00 2001 From: ronger Date: Thu, 8 Dec 2022 09:29:27 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E6=8C=87=E5=AE=9A=20TaskExecutor=20Bea?= =?UTF-8?q?n=20=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/rymcu/forest/handler/AccountHandler.java | 2 +- src/main/java/com/rymcu/forest/handler/ArticleHandler.java | 4 ++-- src/main/java/com/rymcu/forest/handler/CommentHandler.java | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/rymcu/forest/handler/AccountHandler.java b/src/main/java/com/rymcu/forest/handler/AccountHandler.java index 75f6dde..c6fb9e7 100644 --- a/src/main/java/com/rymcu/forest/handler/AccountHandler.java +++ b/src/main/java/com/rymcu/forest/handler/AccountHandler.java @@ -23,7 +23,7 @@ public class AccountHandler { @Resource private UserMapper userMapper; - @Async + @Async("accountThreadPool") @EventListener public void processAccountLastOnlineTimeEvent(AccountEvent accountEvent) { userMapper.updateLastOnlineTimeByAccount(accountEvent.getAccount()); diff --git a/src/main/java/com/rymcu/forest/handler/ArticleHandler.java b/src/main/java/com/rymcu/forest/handler/ArticleHandler.java index b3d372d..ae01ceb 100644 --- a/src/main/java/com/rymcu/forest/handler/ArticleHandler.java +++ b/src/main/java/com/rymcu/forest/handler/ArticleHandler.java @@ -26,7 +26,7 @@ public class ArticleHandler { private LuceneService luceneService; @EventListener - @Async + @Async("articlePostThreadPool") public void processArticlePostEvent(ArticleEvent articleEvent) throws InterruptedException { Thread.sleep(1000); log.info(String.format("执行文章发布相关事件:[%s]", JSON.toJSONString(articleEvent))); @@ -56,7 +56,7 @@ public class ArticleHandler { } @EventListener - @Async + @Async("articleDeleteThreadPool") public void processArticleDeleteEvent(ArticleDeleteEvent articleDeleteEvent) throws InterruptedException { Thread.sleep(1000); log.info(String.format("执行文章删除相关事件:[%s]", JSON.toJSONString(articleDeleteEvent))); diff --git a/src/main/java/com/rymcu/forest/handler/CommentHandler.java b/src/main/java/com/rymcu/forest/handler/CommentHandler.java index b8cab12..74f2688 100644 --- a/src/main/java/com/rymcu/forest/handler/CommentHandler.java +++ b/src/main/java/com/rymcu/forest/handler/CommentHandler.java @@ -29,7 +29,7 @@ public class CommentHandler { @Resource private CommentMapper commentMapper; - @Async + @Async("commentThreadPool") @EventListener public void processCommentCreatedEvent(CommentEvent commentEvent) throws InterruptedException { log.info(String.format("开始执行评论发布事件:[%s]", JSON.toJSONString(commentEvent)));