mirror of
https://github.com/tursom/TursomServer.git
synced 2025-02-01 23:30:24 +08:00
update
This commit is contained in:
parent
c401579426
commit
cfbeeabf98
@ -16,7 +16,7 @@ class ThreadPoolNioThread(
|
|||||||
override lateinit var thread: Thread
|
override lateinit var thread: Thread
|
||||||
val threadPool: ExecutorService = ThreadPoolExecutor(1, 1,
|
val threadPool: ExecutorService = ThreadPoolExecutor(1, 1,
|
||||||
0L, TimeUnit.MILLISECONDS,
|
0L, TimeUnit.MILLISECONDS,
|
||||||
LinkedBlockingQueue<Runnable>(),
|
LinkedBlockingQueue(),
|
||||||
ThreadFactory {
|
ThreadFactory {
|
||||||
val thread = Thread(it)
|
val thread = Thread(it)
|
||||||
this.thread = thread
|
this.thread = thread
|
||||||
@ -35,7 +35,13 @@ class ThreadPoolNioThread(
|
|||||||
while (keyIter.hasNext()) {
|
while (keyIter.hasNext()) {
|
||||||
val key = keyIter.next()
|
val key = keyIter.next()
|
||||||
keyIter.remove()
|
keyIter.remove()
|
||||||
workLoop(this@ThreadPoolNioThread, key)
|
try {
|
||||||
|
workLoop(this@ThreadPoolNioThread, key)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
e.printStackTrace()
|
||||||
|
key.cancel()
|
||||||
|
key.channel().close()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!threadPool.isShutdown) threadPool.execute(this)
|
if (!threadPool.isShutdown) threadPool.execute(this)
|
||||||
|
@ -25,7 +25,13 @@ class WorkerLoopNioThread(
|
|||||||
while (keyIter.hasNext()) {
|
while (keyIter.hasNext()) {
|
||||||
val key = keyIter.next()
|
val key = keyIter.next()
|
||||||
keyIter.remove()
|
keyIter.remove()
|
||||||
workLoop(this, key)
|
try {
|
||||||
|
workLoop(this, key)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
e.printStackTrace()
|
||||||
|
key.cancel()
|
||||||
|
key.channel().close()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
@ -115,6 +121,4 @@ class WorkerLoopNioThread(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -29,14 +29,7 @@ open class BossLoopHandler(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e: Throwable) {
|
} catch (e: Throwable) {
|
||||||
try {
|
protocol.exceptionCause(key, nioThread, e)
|
||||||
protocol.exceptionCause(key, nioThread, e)
|
|
||||||
} catch (e1: Throwable) {
|
|
||||||
e.printStackTrace()
|
|
||||||
e1.printStackTrace()
|
|
||||||
key.cancel()
|
|
||||||
key.channel().close()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -19,14 +19,7 @@ class WorkerLoopHandler(private val protocol: NioProtocol) : (NioThread, Selecti
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e: Throwable) {
|
} catch (e: Throwable) {
|
||||||
try {
|
protocol.exceptionCause(key, nioThread, e)
|
||||||
protocol.exceptionCause(key, nioThread, e)
|
|
||||||
} catch (e1: Throwable) {
|
|
||||||
e.printStackTrace()
|
|
||||||
e1.printStackTrace()
|
|
||||||
key.cancel()
|
|
||||||
key.channel().close()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user