make ActorRestartSpec thread safe

This commit is contained in:
Roland 2011-07-03 20:38:06 +02:00
parent 956d055d87
commit 00b9166b57

View file

@ -70,12 +70,18 @@ class ActorRestartSpec extends WordSpec with MustMatchers with TestKit with Befo
import ActorRestartSpec._
override def beforeEach { generation = 0 }
override def afterEach { toStop foreach (_.stop()) }
override def afterEach {
val it = toStop.iterator
while (it.hasNext) {
it.next.stop()
it.remove
}
}
private var toStop = List.empty[ActorRef]
private var toStop = new java.util.concurrent.ConcurrentSkipListSet[ActorRef]
private def newActor(f: Actor): ActorRef = {
val ref = actorOf(f)
toStop ::= ref
toStop add ref
ref.start()
}