|
Akka/Scala example source code file (SupervisedAskSpec.java)
The SupervisedAskSpec.java Akka example source codepackage docs.pattern; import scala.concurrent.Await; import scala.concurrent.Future; import akka.actor.ActorRef; import akka.actor.ActorRefFactory; import akka.actor.Props; import akka.actor.UntypedActor; import akka.util.Timeout; public class SupervisedAskSpec { public Object execute(Class<? extends UntypedActor> someActor, Object message, Timeout timeout, ActorRefFactory actorSystem) throws Exception { // example usage try { ActorRef supervisorCreator = SupervisedAsk .createSupervisorCreator(actorSystem); Future<Object> finished = SupervisedAsk.askOf(supervisorCreator, Props.create(someActor), message, timeout); return Await.result(finished, timeout.duration()); } catch (Exception e) { // exception propagated by supervision throw e; } } } Other Akka source code examplesHere is a short list of links related to this Akka SupervisedAskSpec.java source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.