Fixing #655: Stopping all actors connected to remote server on shutdown
This commit is contained in:
parent
8d2dc6891a
commit
25ce71f79a
1 changed files with 27 additions and 1 deletions
|
|
@ -216,7 +216,33 @@ abstract class RemoteSupport extends ListenerManagement with RemoteServerModule
|
||||||
private[akka] val typedActorsFactories = new ConcurrentHashMap[String, () => AnyRef]
|
private[akka] val typedActorsFactories = new ConcurrentHashMap[String, () => AnyRef]
|
||||||
|
|
||||||
def clear {
|
def clear {
|
||||||
List(actors,actorsByUuid,actorsFactories,typedActors,typedActorsByUuid,typedActorsFactories) foreach (_.clear)
|
def clearActorMap(map: ConcurrentHashMap[String, ActorRef]) {
|
||||||
|
val i = map.values.iterator
|
||||||
|
while (i.hasNext) {
|
||||||
|
i.next match {
|
||||||
|
case ref: LocalActorRef => try { ref.stop } catch { case e: Exception => }
|
||||||
|
case _ =>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
map.clear
|
||||||
|
}
|
||||||
|
|
||||||
|
def clearTypedActorMap(map: ConcurrentHashMap[String, AnyRef]) {
|
||||||
|
ReflectiveAccess.TypedActorModule.typedActorObjectInstance foreach {
|
||||||
|
case typedActor =>
|
||||||
|
val i = map.values.iterator
|
||||||
|
//FIXME Only stop local TypedActor?
|
||||||
|
while (i.hasNext) { try { typedActor.stop(i.next) } catch { case e: Exception => } }
|
||||||
|
}
|
||||||
|
map.clear
|
||||||
|
}
|
||||||
|
|
||||||
|
clearActorMap(actors)
|
||||||
|
clearActorMap(actorsByUuid)
|
||||||
|
clearTypedActorMap(typedActors)
|
||||||
|
clearTypedActorMap(typedActorsByUuid)
|
||||||
|
actorsFactories.clear
|
||||||
|
typedActorsFactories.clear
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue