|
1 | 1 | package me.chanjar.weixin.mp.api; |
2 | 2 |
|
| 3 | +import java.util.ArrayList; |
| 4 | +import java.util.HashMap; |
| 5 | +import java.util.List; |
| 6 | +import java.util.Map; |
| 7 | +import java.util.concurrent.ExecutionException; |
| 8 | +import java.util.concurrent.ExecutorService; |
| 9 | +import java.util.concurrent.Executors; |
| 10 | +import java.util.concurrent.Future; |
| 11 | + |
| 12 | +import org.apache.commons.lang3.StringUtils; |
| 13 | +import org.slf4j.Logger; |
| 14 | +import org.slf4j.LoggerFactory; |
| 15 | + |
3 | 16 | import me.chanjar.weixin.common.api.WxErrorExceptionHandler; |
4 | 17 | import me.chanjar.weixin.common.api.WxMessageDuplicateChecker; |
5 | 18 | import me.chanjar.weixin.common.api.WxMessageInMemoryDuplicateChecker; |
|
10 | 23 | import me.chanjar.weixin.common.util.LogExceptionHandler; |
11 | 24 | import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage; |
12 | 25 | import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage; |
13 | | -import org.apache.commons.lang3.StringUtils; |
14 | | -import org.slf4j.Logger; |
15 | | -import org.slf4j.LoggerFactory; |
16 | | - |
17 | | -import java.util.ArrayList; |
18 | | -import java.util.HashMap; |
19 | | -import java.util.List; |
20 | | -import java.util.Map; |
21 | | -import java.util.concurrent.ExecutionException; |
22 | | -import java.util.concurrent.ExecutorService; |
23 | | -import java.util.concurrent.Executors; |
24 | | -import java.util.concurrent.Future; |
25 | 26 |
|
26 | 27 | /** |
27 | 28 | * <pre> |
@@ -155,11 +156,12 @@ public WxMpMessageRouterRule rule() { |
155 | 156 | public WxMpXmlOutMessage route(final WxMpXmlMessage wxMessage, final Map<String, Object> context) { |
156 | 157 | return route(wxMessage, context, null); |
157 | 158 | } |
| 159 | + |
158 | 160 | /** |
159 | 161 | * 处理微信消息 |
160 | 162 | */ |
161 | 163 | public WxMpXmlOutMessage route(final WxMpXmlMessage wxMessage, final Map<String, Object> context, WxMpService wxMpService) { |
162 | | - if(wxMpService == null){ |
| 164 | + if (wxMpService == null) { |
163 | 165 | wxMpService = this.wxMpService; |
164 | 166 | } |
165 | 167 | final WxMpService mpService = wxMpService; |
@@ -214,7 +216,10 @@ public void run() { |
214 | 216 | WxMpMessageRouter.this.log.debug("End session access: async=true, sessionId={}", wxMessage.getFromUser()); |
215 | 217 | // 异步操作结束,session访问结束 |
216 | 218 | sessionEndAccess(wxMessage); |
217 | | - } catch (InterruptedException | ExecutionException e) { |
| 219 | + } catch (InterruptedException e) { |
| 220 | + WxMpMessageRouter.this.log.error("Error happened when wait task finish", e); |
| 221 | + Thread.currentThread().interrupt(); |
| 222 | + } catch (ExecutionException e) { |
218 | 223 | WxMpMessageRouter.this.log.error("Error happened when wait task finish", e); |
219 | 224 | } |
220 | 225 | } |
|
0 commit comments