Avoid / by zero in SmallestMailboxRouter also, see #2442

This commit is contained in:
Patrik Nordwall 2012-08-31 12:57:33 +02:00
parent ccfd8454fc
commit d9bd43a1fa

View file

@ -859,7 +859,9 @@ trait SmallestMailboxLike { this: RouterConfig ⇒
currentScore: Long = Long.MaxValue,
at: Int = 0,
deep: Boolean = false): ActorRef =
if (at >= targets.size) {
if (targets.isEmpty)
routeeProvider.context.system.deadLetters
else if (at >= targets.size) {
if (deep) {
if (proposedTarget.isTerminated) targets(ThreadLocalRandom.current.nextInt(targets.size)) else proposedTarget
} else getNext(targets, proposedTarget, currentScore, 0, deep = true)