2011-01-03 12:42:30 +01:00
|
|
|
/**
|
|
|
|
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
package akka.remote
|
|
|
|
|
|
|
|
|
|
import akka.util.Duration
|
|
|
|
|
import akka.config.Config._
|
|
|
|
|
import akka.config.ConfigurationException
|
|
|
|
|
|
|
|
|
|
object RemoteClientSettings {
|
|
|
|
|
val SECURE_COOKIE: Option[String] = config.getString("akka.remote.secure-cookie", "") match {
|
|
|
|
|
case "" => None
|
|
|
|
|
case cookie => Some(cookie)
|
|
|
|
|
}
|
|
|
|
|
val RECONNECTION_TIME_WINDOW = Duration(config.getInt("akka.remote.client.reconnection-time-window", 600), TIME_UNIT).toMillis
|
2011-03-08 06:31:30 +01:00
|
|
|
val READ_TIMEOUT = Duration(config.getInt("akka.remote.client.read-timeout", 10), TIME_UNIT)
|
2011-01-03 12:42:30 +01:00
|
|
|
val RECONNECT_DELAY = Duration(config.getInt("akka.remote.client.reconnect-delay", 5), TIME_UNIT)
|
2011-02-08 15:06:13 +01:00
|
|
|
val REAP_FUTURES_DELAY = Duration(config.getInt("akka.remote.client.reap-futures-delay", 5), TIME_UNIT)
|
2011-01-03 12:42:30 +01:00
|
|
|
val MESSAGE_FRAME_SIZE = config.getInt("akka.remote.client.message-frame-size", 1048576)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
object RemoteServerSettings {
|
|
|
|
|
val isRemotingEnabled = config.getList("akka.enabled-modules").exists(_ == "remote")
|
|
|
|
|
val MESSAGE_FRAME_SIZE = config.getInt("akka.remote.server.message-frame-size", 1048576)
|
|
|
|
|
val SECURE_COOKIE = config.getString("akka.remote.secure-cookie")
|
|
|
|
|
val REQUIRE_COOKIE = {
|
2011-01-08 19:50:44 +01:00
|
|
|
val requireCookie = config.getBool("akka.remote.server.require-cookie", false)
|
2011-01-03 12:42:30 +01:00
|
|
|
if (isRemotingEnabled && requireCookie && SECURE_COOKIE.isEmpty) throw new ConfigurationException(
|
|
|
|
|
"Configuration option 'akka.remote.server.require-cookie' is turned on but no secure cookie is defined in 'akka.remote.secure-cookie'.")
|
|
|
|
|
requireCookie
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
val UNTRUSTED_MODE = config.getBool("akka.remote.server.untrusted-mode", false)
|
|
|
|
|
val HOSTNAME = config.getString("akka.remote.server.hostname", "localhost")
|
|
|
|
|
val PORT = config.getInt("akka.remote.server.port", 2552)
|
|
|
|
|
val CONNECTION_TIMEOUT_MILLIS = Duration(config.getInt("akka.remote.server.connection-timeout", 1), TIME_UNIT)
|
|
|
|
|
val COMPRESSION_SCHEME = config.getString("akka.remote.compression-scheme", "zlib")
|
|
|
|
|
val ZLIB_COMPRESSION_LEVEL = {
|
|
|
|
|
val level = config.getInt("akka.remote.zlib-compression-level", 6)
|
|
|
|
|
if (level < 1 && level > 9) throw new IllegalArgumentException(
|
|
|
|
|
"zlib compression level has to be within 1-9, with 1 being fastest and 9 being the most compressed")
|
|
|
|
|
level
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-07 10:31:05 +01:00
|
|
|
val BACKLOG = config.getInt("akka.remote.server.backlog", 4096)
|
2011-03-23 11:31:19 +01:00
|
|
|
|
|
|
|
|
val EXECUTION_POOL_KEEPALIVE = Duration(config.getInt("akka.remote.server.execution-pool-keepalive", 60), TIME_UNIT)
|
|
|
|
|
|
|
|
|
|
val EXECUTION_POOL_SIZE = {
|
|
|
|
|
val sz = config.getInt("akka.remote.server.execution-pool-size",16)
|
|
|
|
|
if (sz < 1) throw new IllegalArgumentException("akka.remote.server.execution-pool-size is less than 1")
|
|
|
|
|
sz
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
val MAX_CHANNEL_MEMORY_SIZE = {
|
|
|
|
|
val sz = config.getInt("akka.remote.server.max-channel-memory-size", 0)
|
|
|
|
|
if (sz < 0) throw new IllegalArgumentException("akka.remote.server.max-channel-memory-size is less than 0")
|
|
|
|
|
sz
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
val MAX_TOTAL_MEMORY_SIZE = {
|
|
|
|
|
val sz = config.getInt("akka.remote.server.max-total-memory-size", 0)
|
|
|
|
|
if (sz < 0) throw new IllegalArgumentException("akka.remote.server.max-total-memory-size is less than 0")
|
|
|
|
|
sz
|
|
|
|
|
}
|
2011-01-03 12:42:30 +01:00
|
|
|
}
|