You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When initializing a router with a group of actors, I find that gracefulStop always hangs. I can see each individual actor is stopped but the gracefulStop times out. This issue persists regardless of the type of group I'm using. I'm unsure whether this is an issue with my initialization of the router or a bug.
import akka.actor._
import akka.routing._
import akka.pattern._
import java.util.Calendar
import java.util.concurrent.TimeoutException
import scala.concurrent.Await
import scala.concurrent.duration._
object Main {
class Foo(index: Int) extends Actor {
def receive = { case _ => println(s"Received by ${index}.") }
override def postStop() = { println(s"Stopped ${index}.") }
}
def main(args: Array[String]): Unit = {
val system = ActorSystem("test")
val fooActors = (1 to 10).map(i => system.actorOf(Props(new Foo(i)), s"foo-${i}"))
val fooRouter = system.actorOf(Props.empty.withRouter(
RoundRobinGroup(fooActors.map(_.path.toStringWithoutAddress))), "foo-router")
fooRouter ! Broadcast("bar")
println("Shutting down Foo router :" + Calendar.getInstance().getTime())
try {
Await.result(gracefulStop(fooRouter, 10 seconds, Broadcast(PoisonPill)), 10 seconds)
} catch {
case te: TimeoutException => println("Timed out waiting for router to stop.")
}
println("Done shutting down Foo router :" + Calendar.getInstance().getTime())
system.shutdown()
}
}
The text was updated successfully, but these errors were encountered:
This works as intended: Groups don’t supervise their routees, hence they also don’t monitor them. This is why they are configured with an ActorPath instead of ActorRefs.
When initializing a router with a group of actors, I find that gracefulStop always hangs. I can see each individual actor is stopped but the gracefulStop times out. This issue persists regardless of the type of group I'm using. I'm unsure whether this is an issue with my initialization of the router or a bug.
The text was updated successfully, but these errors were encountered: