foreachChild instead of allChildren, see #2552

This commit is contained in:
Patrik Nordwall 2012-09-27 09:20:52 +02:00
parent 7d47091e59
commit e7a075a0d9
2 changed files with 6 additions and 6 deletions

View file

@ -10,7 +10,7 @@ import java.lang.{ UnsupportedOperationException, IllegalStateException }
import akka.serialization.{ Serialization, JavaSerializer }
import akka.event.EventStream
import scala.annotation.tailrec
import java.util.concurrent.{ ConcurrentHashMap }
import java.util.concurrent.ConcurrentHashMap
import akka.event.LoggingAdapter
import scala.concurrent.forkjoin.ThreadLocalRandom
import scala.collection.JavaConverters
@ -520,8 +520,8 @@ private[akka] class VirtualPathContainer(
def hasChildren: Boolean = !children.isEmpty
def allChildren: Iterable[ActorRef] = {
import scala.collection.JavaConverters._
children.values.asScala
def foreachChild(f: ActorRef Unit) = {
val iter = children.values.iterator
while (iter.hasNext) f(iter.next)
}
}

View file

@ -90,11 +90,11 @@ private[akka] class RemoteSystemDaemon(system: ActorSystemImpl, _path: ActorPath
case TerminationHook
terminating.switchOn {
terminationHookDoneWhenNoChildren()
allChildren foreach system.stop
foreachChild { system.stop(_) }
}
case AddressTerminated(address)
allChildren foreach { case a: InternalActorRef if a.getParent.path.address == address system.stop(a) }
foreachChild { case a: InternalActorRef if a.getParent.path.address == address system.stop(a) }
case unknown log.warning("Unknown message {} received by {}", unknown, this)
}