Adding support for being able to _not_ use ExecutionHandler by setting the poolsize to 0

This commit is contained in:
Viktor Klang 2012-06-20 14:29:41 +02:00
parent 7b792a7b93
commit 28ee78bfd5
3 changed files with 13 additions and 10 deletions

View file

@ -122,7 +122,8 @@ akka {
# (I) Length in akka.time-unit how long core threads will be kept alive if idling
execution-pool-keepalive = 60s
# (I) Size of the core pool of the remote execution unit
# (I) Size in number of threads of the core pool of the remote execution unit,
# set to 0 to disable the execution pool
execution-pool-size = 4
# (I) Maximum channel size, 0 for off

View file

@ -71,7 +71,7 @@ private[akka] class NettyRemoteTransport(_system: ExtendedActorSystem, _provider
*/
def defaultStack(withTimeout: Boolean, isClient: Boolean): Seq[ChannelHandler] =
(if (settings.EnableSSL) List(NettySSLSupport(settings, NettyRemoteTransport.this.log, isClient)) else Nil) :::
(if (withTimeout) List(timeout) else Nil) ::: msgFormat ::: authenticator ::: executionHandler :: Nil
(if (withTimeout) List(timeout) else Nil) ::: msgFormat ::: authenticator ::: executionHandler
/**
* Construct an IdleStateHandler which uses [[akka.remote.netty.NettyRemoteTransport]].timer.
@ -95,13 +95,15 @@ private[akka] class NettyRemoteTransport(_system: ExtendedActorSystem, _provider
* happen on a netty thread (that could be bad if re-sending over the network for
* remote-deployed actors).
*/
val executionHandler = new ExecutionHandler(new OrderedMemoryAwareThreadPoolExecutor(
settings.ExecutionPoolSize,
settings.MaxChannelMemorySize,
settings.MaxTotalMemorySize,
settings.ExecutionPoolKeepalive.length,
settings.ExecutionPoolKeepalive.unit,
system.threadFactory))
val executionHandler = if (settings.ExecutionPoolSize != 0)
List(new ExecutionHandler(new OrderedMemoryAwareThreadPoolExecutor(
settings.ExecutionPoolSize,
settings.MaxChannelMemorySize,
settings.MaxTotalMemorySize,
settings.ExecutionPoolKeepalive.length,
settings.ExecutionPoolKeepalive.unit,
system.threadFactory)))
else Nil
/**
* Construct and authentication handler which uses the SecureCookie to somewhat

View file

@ -73,7 +73,7 @@ private[akka] class NettySettings(config: Config, val systemName: String) {
val ExecutionPoolKeepalive: Duration = Duration(getMilliseconds("execution-pool-keepalive"), MILLISECONDS)
val ExecutionPoolSize: Int = getInt("execution-pool-size") match {
case sz if sz < 1 throw new IllegalArgumentException("akka.remote.netty.execution-pool-size is less than 1")
case sz if sz < 0 throw new IllegalArgumentException("akka.remote.netty.execution-pool-size is less than 0")
case sz sz
}