making Netty's EventLoopGroup shutdown's eager (#1255)

This commit is contained in:
Gabor Aranyossy 2019-05-21 09:30:38 +02:00 committed by Francesco Mazzoli
parent d15f952dcc
commit e50222ce30
4 changed files with 12 additions and 4 deletions

View File

@ -198,7 +198,9 @@ final class Server private (
logger.info("Shutting down server...")
server.shutdownNow()
assume(server.awaitTermination(10, TimeUnit.SECONDS))
serverEventLoopGroup.shutdownGracefully().await(10L, TimeUnit.SECONDS)
serverEventLoopGroup
.shutdownGracefully(0, 0, TimeUnit.SECONDS)
.await(10, TimeUnit.SECONDS)
serverEsf.close()
}
}

View File

@ -58,7 +58,9 @@ class RemoteServerResource(host: String, port: Int, tlsConfig: Option[TlsConfigu
override def close(): Unit = {
channel.shutdownNow()
channel.awaitTermination(1L, TimeUnit.SECONDS)
eventLoopGroup.shutdownGracefully().await(1L, TimeUnit.SECONDS)
eventLoopGroup
.shutdownGracefully(0, 0, TimeUnit.SECONDS)
.await(10L, TimeUnit.SECONDS)
channel = null
eventLoopGroup = null
}

View File

@ -52,7 +52,9 @@ class SandboxServerResource(sandboxConfig: SandboxConfig) extends Resource[Platf
override def close(): Unit = {
channel.shutdownNow()
channel.awaitTermination(5L, TimeUnit.SECONDS)
eventLoopGroup.shutdownGracefully().await(10L, TimeUnit.SECONDS)
eventLoopGroup
.shutdownGracefully(0, 0, TimeUnit.SECONDS)
.await(10L, TimeUnit.SECONDS)
sandboxServer.close()
channel = null
eventLoopGroup = null

View File

@ -46,7 +46,9 @@ class SandboxServerResource(config: => SandboxConfig) extends Resource[Channel]
override def close(): Unit = {
channel.shutdownNow()
eventLoopGroup.shutdownGracefully().await(10L, TimeUnit.SECONDS)
eventLoopGroup
.shutdownGracefully(0, 0, TimeUnit.SECONDS)
.await(10L, TimeUnit.SECONDS)
sandboxServer.close()
channel = null
eventLoopGroup = null