From 47148b172bac3c50a7b64ac16b105d86e04fec00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=89=91=E5=99=A8=E8=BF=91?= Date: Thu, 12 Nov 2020 15:24:07 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E9=99=A4lang3=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 21 ++++++++------ .../netmc/core/handler/AsyncBatchHandler.java | 4 +-- .../yezhihao/netmc/core/model/Header.java | 7 +++-- src/main/resources/log4j2.xml | 29 ------------------- 4 files changed, 19 insertions(+), 42 deletions(-) delete mode 100644 src/main/resources/log4j2.xml diff --git a/pom.xml b/pom.xml index d9db2d6..fc5d164 100644 --- a/pom.xml +++ b/pom.xml @@ -44,7 +44,13 @@ junit junit - 4.12 + 4.13.1 + test + + + org.slf4j + slf4j-simple + 1.7.30 test @@ -53,25 +59,22 @@ 1.7.30 provided - - org.apache.commons - commons-lang3 - 3.11 - io.netty netty-handler - 4.1.51.Final + 4.1.54.Final + provided com.github.ben-manes.caffeine caffeine - 2.8.5 + 2.8.6 + provided org.springframework spring-context - 5.2.8.RELEASE + 5.2.11.RELEASE compile diff --git a/src/main/java/io/github/yezhihao/netmc/core/handler/AsyncBatchHandler.java b/src/main/java/io/github/yezhihao/netmc/core/handler/AsyncBatchHandler.java index 2bfbb4f..e023c71 100644 --- a/src/main/java/io/github/yezhihao/netmc/core/handler/AsyncBatchHandler.java +++ b/src/main/java/io/github/yezhihao/netmc/core/handler/AsyncBatchHandler.java @@ -2,8 +2,8 @@ package io.github.yezhihao.netmc.core.handler; import io.github.yezhihao.netmc.core.model.Message; import io.github.yezhihao.netmc.session.Session; +import io.github.yezhihao.netmc.util.BasicThreadFactory; import io.github.yezhihao.netmc.util.VirtualList; -import org.apache.commons.lang3.concurrent.BasicThreadFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -51,7 +51,7 @@ public class AsyncBatchHandler extends Handler { this.queue = new ConcurrentLinkedQueue(); this.executor = new ThreadPoolExecutor(this.poolSize, this.poolSize, 1000L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(400), - new BasicThreadFactory.Builder().namingPattern(actionMethod.getName() + "-pool-%d").build()); + new BasicThreadFactory.Builder().daemon(true).namingPattern(actionMethod.getName() + "-pool-%d").build()); for (int i = 0; i < poolSize; i++) { boolean master = i == 0; diff --git a/src/main/java/io/github/yezhihao/netmc/core/model/Header.java b/src/main/java/io/github/yezhihao/netmc/core/model/Header.java index f48bad7..a30cd19 100644 --- a/src/main/java/io/github/yezhihao/netmc/core/model/Header.java +++ b/src/main/java/io/github/yezhihao/netmc/core/model/Header.java @@ -7,10 +7,13 @@ import java.io.Serializable; * @author yezhihao * home https://gitee.com/yezhihao/jt808-server */ -public interface Header extends Serializable { +public interface Header extends Serializable { /** 客户端唯一标识 */ - T getClientId(); + ClientID getClientId(); + + /** 消息类型 */ + Type getType(); /** 消息流水号 */ int getSerialNo(); diff --git a/src/main/resources/log4j2.xml b/src/main/resources/log4j2.xml deleted file mode 100644 index 241de4e..0000000 --- a/src/main/resources/log4j2.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - logs/ - jt808 - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file