Commit 2144d4c6 authored by 马乐's avatar 马乐

1.修改线程命名方式

parent f848c1da
......@@ -74,7 +74,7 @@ internal class TcpManager(
* 发送线程
* */
private val sendExecutors: ExecutorService by lazy {
Executors.newCachedThreadPool(NamedThreadFactory("Send"))
Executors.newCachedThreadPool(NamedThreadFactory("Send",false))
}
/**
......
......@@ -7,7 +7,7 @@ import java.util.concurrent.atomic.AtomicInteger
* 现场创建工厂
* @param prefix
* */
class NamedThreadFactory(private val prefix: String) : ThreadFactory {
class NamedThreadFactory(private val prefix: String, private val ignoreThreadNumber:Boolean = true) : ThreadFactory {
private val threadNumber by lazy {
AtomicInteger(1)
......@@ -16,6 +16,6 @@ class NamedThreadFactory(private val prefix: String) : ThreadFactory {
override fun newThread(r: Runnable?): Thread = Thread(
null,
r,
if (prefix == "Receive" || prefix == "Parser") prefix else "$prefix-${threadNumber.getAndIncrement()}"
if (ignoreThreadNumber) prefix else "$prefix-${threadNumber.getAndIncrement()}"
)
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment