parent
3b3ce85b22
commit
4e705f1d18
8 changed files with 36 additions and 32 deletions
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
package jdocs.actor.typed;
|
||||
|
||||
// #blocking-in-actor
|
||||
import akka.actor.typed.*;
|
||||
import akka.actor.typed.javadsl.*;
|
||||
|
||||
|
|
@ -31,3 +32,4 @@ public class BlockingActor extends AbstractBehavior<Integer> {
|
|||
.build();
|
||||
}
|
||||
}
|
||||
// #blocking-in-actor
|
||||
|
|
|
|||
|
|
@ -10,6 +10,10 @@ import akka.actor.typed.javadsl.*;
|
|||
// #print-actor
|
||||
class PrintActor extends AbstractBehavior<Integer> {
|
||||
|
||||
public static Behavior<Integer> create() {
|
||||
return Behaviors.setup(context -> new PrintActor());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Receive<Integer> createReceive() {
|
||||
return newReceiveBuilder()
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import akka.actor.typed.javadsl.*;
|
|||
|
||||
// #separate-dispatcher
|
||||
class SeparateDispatcherFutureActor extends AbstractBehavior<Integer> {
|
||||
final Executor ec;
|
||||
private final Executor ec;
|
||||
|
||||
public static Behavior<Integer> create() {
|
||||
return Behaviors.setup(SeparateDispatcherFutureActor::new);
|
||||
|
|
@ -38,7 +38,7 @@ class SeparateDispatcherFutureActor extends AbstractBehavior<Integer> {
|
|||
.build();
|
||||
}
|
||||
|
||||
private static final void triggerFutureBlockingOperation(Integer i, Executor ec) {
|
||||
private static void triggerFutureBlockingOperation(Integer i, Executor ec) {
|
||||
System.out.println("Calling blocking Future on separate dispatcher: " + i);
|
||||
CompletableFuture<Integer> f =
|
||||
CompletableFuture.supplyAsync(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue