fixed imports

This commit is contained in:
RickLatrine 2012-12-08 15:13:58 +01:00
parent c17b1eb263
commit 3f1bab2328
2 changed files with 33 additions and 8 deletions

View file

@ -1,5 +1,25 @@
package docs.pattern;
import java.util.concurrent.TimeoutException;
import akka.actor.ActorKilledException;
import akka.actor.ActorRef;
import akka.actor.ActorRefFactory;
import akka.actor.Cancellable;
import akka.actor.OneForOneStrategy;
import akka.actor.Props;
import akka.actor.Scheduler;
import akka.actor.Status;
import akka.actor.SupervisorStrategy;
import akka.actor.SupervisorStrategy.Directive;
import akka.actor.Terminated;
import akka.actor.UntypedActor;
import akka.dispatch.Future;
import akka.japi.Function;
import akka.pattern.Patterns;
import akka.util.Duration;
import akka.util.Timeout;
public class SupervisedAsk {
private static class AskParam {

View file

@ -1,23 +1,28 @@
package docs.pattern;
import docs.testkit.TestKitSampleTest.SomeActor;
import scala.actors.Future;
import actor.ActorRef;
import actor.Props;
import akka.actor.ActorRef;
import akka.actor.ActorRefFactory;
import akka.actor.Props;
import akka.actor.UntypedActor;
import akka.dispatch.Await;
import akka.dispatch.Future;
import akka.util.Timeout;
public class SupervisedAskSpec {
public void execute() {
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.apply(SomeActor.class), message, timeout);
Object result = Await.result(finished,
timeout.duration());
Props.apply(someActor), message, timeout);
return Await.result(finished, timeout.duration());
} catch (Exception e) {
// exception propagated by supervision
throw e;
}
}
}