Skip to content

Commit

Permalink
Added support for a config flag that allows the user to reuse the def…
Browse files Browse the repository at this point in the history
…ault dispatcher as the ExecutorService for the Netty Remote Pipeline (IO)
  • Loading branch information
viktorklang committed Apr 25, 2012
1 parent 1f30be1 commit 45694c6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 4 additions & 0 deletions akka-remote/src/main/resources/reference.conf
Expand Up @@ -92,6 +92,10 @@ akka {
# (I) Reuse inbound connections for outbound messages
use-passive-connections = on

# (I) If "on" then the default dispatcher will be used to accept inbound connections,
# and IO. If "off" then dedicated threads will be used.
use-default-dispatcher-for-io = off

# (I) The hostname or ip to bind the remoting to,
# InetAddress.getLocalHost.getHostAddress is used if empty
hostname = ""
Expand Down
7 changes: 4 additions & 3 deletions akka-remote/src/main/scala/akka/remote/netty/Server.scala
Expand Up @@ -26,9 +26,10 @@ class NettyRemoteServer(val netty: NettyRemoteTransport) {

val ip = InetAddress.getByName(settings.Hostname)

private val factory = new NioServerSocketChannelFactory(
Executors.newCachedThreadPool(netty.system.threadFactory),
Executors.newCachedThreadPool(netty.system.threadFactory))
private val factory = {
val boss, worker = if (settings.UseDefaultDispatcherForIO) netty.system.dispatcher else Executors.newCachedThreadPool()
new NioServerSocketChannelFactory(boss, worker)
}

private val executionHandler = new ExecutionHandler(netty.executor)

Expand Down
Expand Up @@ -27,6 +27,7 @@ class NettySettings(config: Config, val systemName: String) {
}

val UsePassiveConnections = getBoolean("use-passive-connections")
val UseDefaultDispatcherForIO = getBoolean("use-default-dispatcher-for-io")

val ReconnectionTimeWindow = Duration(getMilliseconds("reconnection-time-window"), MILLISECONDS)
val ReadTimeout = Duration(getMilliseconds("read-timeout"), MILLISECONDS)
Expand Down

0 comments on commit 45694c6

Please sign in to comment.