|
@@ -13,6 +13,8 @@ import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.Map;
|
|
|
import java.util.UUID;
|
|
|
+import java.util.concurrent.ExecutorService;
|
|
|
+import java.util.concurrent.Executors;
|
|
|
|
|
|
import org.apache.commons.lang.ArrayUtils;
|
|
|
import org.slf4j.Logger;
|
|
@@ -57,7 +59,7 @@ public class WatchServerHandler extends ChannelInboundHandlerAdapter {
|
|
|
public static Map<String, Channel> manageChannelMap = new HashMap<>();
|
|
|
public static Map<String, Channel> channelMapOfChannelKey = new HashMap<>();
|
|
|
public static Map<String, String> commandCopy = new HashMap<>();
|
|
|
-
|
|
|
+ private static ExecutorService singleThreadPool = Executors.newSingleThreadExecutor();
|
|
|
@Autowired
|
|
|
private JedisPool jedisPool;
|
|
|
|
|
@@ -66,7 +68,9 @@ public class WatchServerHandler extends ChannelInboundHandlerAdapter {
|
|
|
ByteBuf byteBuf = (ByteBuf)msg;
|
|
|
String str = byteBufferToString(byteBuf.nioBuffer());
|
|
|
logger.info("上传数据:{}", str);
|
|
|
- dataStorage(str);
|
|
|
+
|
|
|
+ singleThreadPool.execute(()->dataStorage(str));
|
|
|
+
|
|
|
|
|
|
//try {
|
|
|
// reply(ctx, str);
|
|
@@ -294,6 +298,8 @@ public class WatchServerHandler extends ChannelInboundHandlerAdapter {
|
|
|
}
|
|
|
|
|
|
public static void writeDevice2File(File file, String deviceStr){
|
|
|
+
|
|
|
+
|
|
|
Integer length = deviceStr.getBytes().length;
|
|
|
try {
|
|
|
OutputStream outputStream = new FileOutputStream(file, true);
|