| @@ -1,24 +1,25 @@ | |||
| package me.chanjar.weixin.mp.api; | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| import java.util.concurrent.ExecutionException; | |||
| import java.util.concurrent.ExecutorService; | |||
| import java.util.concurrent.Executors; | |||
| import java.util.concurrent.Future; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| 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.session.InternalSession; | |||
| import me.chanjar.weixin.common.session.InternalSessionManager; | |||
| import me.chanjar.weixin.common.session.StandardSessionManager; | |||
| import me.chanjar.weixin.common.session.WxSessionManager; | |||
| import me.chanjar.weixin.common.util.LogExceptionHandler; | |||
| 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.mp.bean.WxMpXmlMessage; | |||
| import me.chanjar.weixin.mp.bean.WxMpXmlOutMessage; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| import java.util.concurrent.ExecutionException; | |||
| import java.util.concurrent.ExecutorService; | |||
| import java.util.concurrent.Executors; | |||
| import java.util.concurrent.Future; | |||
| /** | |||
| * <pre> | |||
| @@ -155,7 +156,7 @@ public class WxMpMessageRouter { | |||
| } | |||
| WxMpXmlOutMessage res = null; | |||
| final List<Future> futures = new ArrayList<>(); | |||
| final List<Future<?>> futures = new ArrayList<>(); | |||
| for (final WxMpMessageRouterRule rule : matchRules) { | |||
| // 返回最后一个非异步的rule的执行结果 | |||
| if(rule.isAsync()) { | |||
| @@ -179,7 +180,7 @@ public class WxMpMessageRouter { | |||
| this.executorService.submit(new Runnable() { | |||
| @Override | |||
| public void run() { | |||
| for (Future future : futures) { | |||
| for (Future<?> future : futures) { | |||
| try { | |||
| future.get(); | |||
| WxMpMessageRouter.this.log.debug("End session access: async=true, sessionId={}", wxMessage.getFromUserName()); | |||
| @@ -1,16 +1,25 @@ | |||
| package me.chanjar.weixin.mp.util.xml; | |||
| import com.thoughtworks.xstream.XStream; | |||
| import me.chanjar.weixin.common.util.xml.XStreamInitializer; | |||
| import me.chanjar.weixin.mp.bean.*; | |||
| import java.io.InputStream; | |||
| import java.util.HashMap; | |||
| import java.util.Map; | |||
| import com.thoughtworks.xstream.XStream; | |||
| import me.chanjar.weixin.common.util.xml.XStreamInitializer; | |||
| import me.chanjar.weixin.mp.bean.WxMpXmlMessage; | |||
| import me.chanjar.weixin.mp.bean.WxMpXmlOutImageMessage; | |||
| import me.chanjar.weixin.mp.bean.WxMpXmlOutMessage; | |||
| import me.chanjar.weixin.mp.bean.WxMpXmlOutMusicMessage; | |||
| import me.chanjar.weixin.mp.bean.WxMpXmlOutNewsMessage; | |||
| import me.chanjar.weixin.mp.bean.WxMpXmlOutTextMessage; | |||
| import me.chanjar.weixin.mp.bean.WxMpXmlOutTransferCustomerServiceMessage; | |||
| import me.chanjar.weixin.mp.bean.WxMpXmlOutVideoMessage; | |||
| import me.chanjar.weixin.mp.bean.WxMpXmlOutVoiceMessage; | |||
| public class XStreamTransformer { | |||
| protected static final Map<Class, XStream> CLASS_2_XSTREAM_INSTANCE = configXStreamInstance(); | |||
| protected static final Map<Class<?>, XStream> CLASS_2_XSTREAM_INSTANCE = configXStreamInstance(); | |||
| /** | |||
| * xml -> pojo | |||
| @@ -32,7 +41,7 @@ public class XStreamTransformer { | |||
| * @param clz 类型 | |||
| * @param xStream xml解析器 | |||
| */ | |||
| public static void register(Class clz,XStream xStream){ | |||
| public static void register(Class<?> clz, XStream xStream) { | |||
| CLASS_2_XSTREAM_INSTANCE.put(clz,xStream); | |||
| } | |||
| @@ -44,8 +53,8 @@ public class XStreamTransformer { | |||
| return CLASS_2_XSTREAM_INSTANCE.get(clazz).toXML(object); | |||
| } | |||
| private static Map<Class, XStream> configXStreamInstance() { | |||
| Map<Class, XStream> map = new HashMap<>(); | |||
| private static Map<Class<?>, XStream> configXStreamInstance() { | |||
| Map<Class<?>, XStream> map = new HashMap<>(); | |||
| map.put(WxMpXmlMessage.class, config_WxMpXmlMessage()); | |||
| map.put(WxMpXmlOutMusicMessage.class, config_WxMpXmlOutMusicMessage()); | |||
| map.put(WxMpXmlOutNewsMessage.class, config_WxMpXmlOutNewsMessage()); | |||