From d7658c4ece3cb64aff5e99a5e369627e2f3d8c34 Mon Sep 17 00:00:00 2001 From: Viktor Klang Date: Mon, 20 May 2013 15:46:18 +0200 Subject: [PATCH] #3345 - making sure not to close the Netty Bootstrap on the Netty IO thread, and making sure to close the channel and release the external resources. --- .../src/main/scala/akka/remote/testconductor/Player.scala | 2 +- .../scala/akka/remote/testconductor/RemoteConnection.scala | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/akka-multi-node-testkit/src/main/scala/akka/remote/testconductor/Player.scala b/akka-multi-node-testkit/src/main/scala/akka/remote/testconductor/Player.scala index 94ddf5760c..f0d8a1a43f 100644 --- a/akka-multi-node-testkit/src/main/scala/akka/remote/testconductor/Player.scala +++ b/akka-multi-node-testkit/src/main/scala/akka/remote/testconductor/Player.scala @@ -317,7 +317,7 @@ private[akka] class PlayerHandler( val channel = event.getChannel log.debug("disconnected from {}", getAddrString(channel)) fsm ! PoisonPill - RemoteConnection.shutdown(channel) + executor.execute(new Runnable { def run = RemoteConnection.shutdown(channel) }) // Must be shutdown outside of the Netty IO pool } override def messageReceived(ctx: ChannelHandlerContext, event: MessageEvent) = { diff --git a/akka-multi-node-testkit/src/main/scala/akka/remote/testconductor/RemoteConnection.scala b/akka-multi-node-testkit/src/main/scala/akka/remote/testconductor/RemoteConnection.scala index 08ce020b3c..94a76a21d3 100644 --- a/akka-multi-node-testkit/src/main/scala/akka/remote/testconductor/RemoteConnection.scala +++ b/akka-multi-node-testkit/src/main/scala/akka/remote/testconductor/RemoteConnection.scala @@ -71,7 +71,6 @@ private[akka] object RemoteConnection { case _ ⇒ "[unknown]" } - def shutdown(channel: Channel) = { - channel.getFactory.releaseExternalResources() - } + def shutdown(channel: Channel) = + try channel.close() finally try channel.getFactory.shutdown() finally channel.getFactory.releaseExternalResources() }