Moved example code, fixed indentation in SupervisedAsk
This commit is contained in:
parent
b965506f10
commit
1d4d65d449
3 changed files with 100 additions and 79 deletions
23
akka-docs/rst/java/code/docs/pattern/SupervisedAskSpec.java
Normal file
23
akka-docs/rst/java/code/docs/pattern/SupervisedAskSpec.java
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
package docs.pattern;
|
||||
|
||||
import docs.testkit.TestKitSampleTest.SomeActor;
|
||||
import scala.actors.Future;
|
||||
import actor.ActorRef;
|
||||
import actor.Props;
|
||||
|
||||
public class SupervisedAskSpec {
|
||||
|
||||
public void execute() {
|
||||
// example usage
|
||||
try {
|
||||
ActorRef supervisorCreator = SupervisedAsk
|
||||
.createSupervisorCreator(actorSystem);
|
||||
Future<Object> finished = SupervisedAsk.askOf(supervisorCreator,
|
||||
Props.apply(SomeActor.class), message, timeout);
|
||||
Object result = Await.result(finished,
|
||||
timeout.duration());
|
||||
} catch (Exception e) {
|
||||
// exception propagated by supervision
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue