withBroadcastPredicate is freezing App


I’ve got a simple app to play around with routers and noticed a strange problem: As soon as I add withBroadcastPredicate( … ), the app does not start up correctly anymore, but freezes (with a high processor load). Without that line, it works totally fine as expected and spawns four workers (logging a message while doing so).

public static void main(final String[] args)
      final Behavior<Worker.Command> guardian = Behaviors.setup(PoolRouterDemo::createPoolRouter);

      final ActorSystem system = ActorSystem.create(guardian, "poolRouterSystem");

   private static Behavior<Worker.Command> createPoolRouter(final ActorContext<Worker.Command> context)
      // A simple Worker behavior
      final Behavior<Worker.Command> workerBehavior = Worker.create();

      // Make sure the router restart on failure
      final Behavior<Worker.Command> supervisedBehavior = Behaviors.supervise(workerBehavior).onFailure(SupervisorStrategy.restart());

      // Create a pool router with the given Dispatcher
      final PoolRouter<Worker.Command> pool = Routers.pool(4, supervisedBehavior)
            .withBroadcastPredicate(msg -> msg instanceof Worker.DoABroadcast); // If this line is here, nothing works anymore

      // Spawn a new actor with this pool
      final ActorRef<Worker.Command> router = context.spawn(pool, "worker-pool");

      // Some logging
      context.getLog().info("I am {} and my router is {}", context.getSelf().path(), router.path());

      // Behavior of the user guardian: Relay all messages to router
      return Behaviors.receive(Worker.Command.class)
            .onAnyMessage(msg -> {
               return Behaviors.same();

Worker is a simple actor (from here, with an added DoABroadcast class) and Command the interface for the protocol. I am only using the dependency akka-actor-typed_2.13 in version 2.6.12.

Any idea what is happening here?