Fixed misc stuff after review.

Signed-off-by: Jonas Bonér <jonas@jonasboner.com>
This commit is contained in:
Jonas Bonér 2012-02-04 17:50:11 +01:00
parent ff62a1cf2a
commit f855ff2add
3 changed files with 12 additions and 6 deletions

View file

@ -8,10 +8,10 @@ import akka.actor.newUuid
import java.net.{ InetAddress, UnknownHostException }
object AkkaException {
val hostname = try InetAddress.getLocalHost.getHostAddress catch { case e: UnknownHostException "unknown" }
val hostname = try InetAddress.getLocalHost.getHostAddress catch { case e: UnknownHostException "unknown host" }
def toStringWithStackTrace(throwable: Throwable): String = {
if (throwable eq null) "Unknown Exception"
if (throwable eq null) "Unknown Throwable: was 'null'"
throwable match {
case ae: AkkaException ae.toLongString
case e "%s:%s\n%s" format (e.getClass.getName, e.getMessage, stackTraceToString(e))

View file

@ -728,6 +728,9 @@ case class ScatterGatherFirstCompletedRouter(nrOfInstances: Int = 0, routees: It
override val resizer: Option[Resizer] = None)
extends RouterConfig with ScatterGatherFirstCompletedLike {
if (within.length <= 0) throw new IllegalArgumentException(
"[within: Duration] can not be zero or negative, was [" + within + "]")
/**
* Constructor that sets nrOfInstances to be created.
* Java API

View file

@ -5,22 +5,25 @@ import com.typesafe.config.{Config, ConfigFactory}
trait AbstractRemoteActorMultiJvmSpec {
def NrOfNodes: Int
def commonConfig: Config
def PortRangeStart = 1990
def NodeRange = 1 to NrOfNodes
def PortRange = PortRangeStart to NrOfNodes
private[this] val remotes: IndexedSeq[String] = {
val nodesOpt = Option(AkkaRemoteSpec.testNodes).map(_.split(",").toIndexedSeq)
nodesOpt getOrElse IndexedSeq.fill(NrOfNodes)("localhost")
}
val nodeConfigs = ((1 to NrOfNodes).toList zip remotes) map {
case (idx, host) =>
val nodeConfigs = (NodeRange.toList zip remotes) map {
case (port, host) =>
ConfigFactory.parseString("""
akka {
remote.netty.hostname="%s"
remote.netty.port = "%d"
}""".format(host, PortRangeStart + idx, idx)) withFallback commonConfig
}""".format(host, PortRangeStart + port, port)) withFallback commonConfig
}
def akkaSpec(idx: Int) = "AkkaRemoteSpec@%s:%d".format(remotes(idx), PortRangeStart + 1 + idx)
def akkaSpec(port: Int) = "AkkaRemoteSpec@%s:%d".format(remotes(port), PortRangeStart + 1 + port)
def akkaURIs(count: Int): String = 0 until count map {idx => "\"akka://" + akkaSpec(idx) + "\""} mkString ","
}