Update 'managing blocking' examples

Having only one blocking actor is not enough, since then only one dispatcher
thread will be blocked at a time.
This commit is contained in:
Arnout Engelen 2020-01-17 15:33:37 +01:00
parent 098118251d
commit 3dc20796ca
3 changed files with 14 additions and 24 deletions

View file

@ -13,12 +13,9 @@ public class BlockingDispatcherTest {
Behavior<Void> root =
Behaviors.setup(
context -> {
ActorRef<Integer> actor1 = context.spawn(BlockingActor.create(), "BlockingActor");
ActorRef<Integer> actor2 = context.spawn(PrintActor.create(), "PrintActor");
for (int i = 0; i < 100; i++) {
actor1.tell(i);
actor2.tell(i);
context.spawn(BlockingActor.create(), "BlockingActor-" + i).tell(i);
context.spawn(PrintActor.create(), "PrintActor-" + i).tell(i);
}
return Behaviors.ignore();
});