Removing akka.actor.Actors since they were deprecated in 2.0.2
This commit is contained in:
parent
5c9dff8ad2
commit
57c5dd00e0
11 changed files with 19 additions and 82 deletions
|
|
@ -5,7 +5,7 @@ package akka.docs.actor;
|
|||
|
||||
import akka.actor.ActorRef;
|
||||
import akka.actor.Props;
|
||||
import static akka.actor.Actors.*;
|
||||
import akka.actor.PoisonPill;
|
||||
import akka.actor.UntypedActor;
|
||||
|
||||
//#context-actorOf
|
||||
|
|
@ -16,6 +16,6 @@ public class FirstUntypedActor extends UntypedActor {
|
|||
|
||||
public void onReceive(Object message) {
|
||||
myActor.forward(message, getContext());
|
||||
myActor.tell(poisonPill());
|
||||
myActor.tell(PoisonPill.getInstance());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@
|
|||
package akka.docs.actor;
|
||||
|
||||
//#receive-timeout
|
||||
import akka.actor.Actors;
|
||||
import akka.actor.ReceiveTimeout;
|
||||
import akka.actor.UntypedActor;
|
||||
import akka.util.Duration;
|
||||
|
|
@ -18,7 +17,7 @@ public class MyReceivedTimeoutUntypedActor extends UntypedActor {
|
|||
public void onReceive(Object message) {
|
||||
if (message.equals("Hello")) {
|
||||
getSender().tell("Hello world");
|
||||
} else if (message == Actors.receiveTimeout()) {
|
||||
} else if (message == ReceiveTimeout.getInstance()) {
|
||||
throw new RuntimeException("received timeout");
|
||||
} else {
|
||||
unhandled(message);
|
||||
|
|
|
|||
|
|
@ -19,7 +19,8 @@ import akka.util.Timeout;
|
|||
//#import-future
|
||||
|
||||
//#import-actors
|
||||
import static akka.actor.Actors.*;
|
||||
import akka.actor.PoisonPill;
|
||||
import akka.actor.Kill;
|
||||
//#import-actors
|
||||
|
||||
//#import-procedure
|
||||
|
|
@ -158,7 +159,7 @@ public class UntypedActorDocTestBase {
|
|||
ActorSystem system = ActorSystem.create("MySystem");
|
||||
ActorRef myActor = system.actorOf(new Props(MyUntypedActor.class));
|
||||
//#poison-pill
|
||||
myActor.tell(poisonPill());
|
||||
myActor.tell(PoisonPill.getInstance());
|
||||
//#poison-pill
|
||||
system.shutdown();
|
||||
}
|
||||
|
|
@ -168,7 +169,7 @@ public class UntypedActorDocTestBase {
|
|||
ActorSystem system = ActorSystem.create("MySystem");
|
||||
ActorRef victim = system.actorOf(new Props(MyUntypedActor.class));
|
||||
//#kill
|
||||
victim.tell(kill());
|
||||
victim.tell(Kill.getInstance());
|
||||
//#kill
|
||||
system.shutdown();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ public class FaultHandlingDocSample {
|
|||
log.info("That's all, shutting down");
|
||||
getContext().system().shutdown();
|
||||
}
|
||||
} else if (msg == Actors.receiveTimeout()) {
|
||||
} else if (msg == ReceiveTimeout.getInstance()) {
|
||||
// No progress within 15 seconds, ServiceUnavailable
|
||||
log.error("Shutting down due to unavailable service");
|
||||
getContext().system().shutdown();
|
||||
|
|
|
|||
|
|
@ -4,27 +4,22 @@
|
|||
package akka.docs.dispatcher;
|
||||
|
||||
//#imports
|
||||
import akka.actor.*;
|
||||
import akka.actor.ActorRef;
|
||||
import akka.actor.Props;
|
||||
import akka.dispatch.MessageDispatcher;
|
||||
|
||||
import akka.actor.UntypedActor;
|
||||
import akka.actor.UntypedActorFactory;
|
||||
//#imports
|
||||
|
||||
//#imports-prio
|
||||
import akka.actor.UntypedActor;
|
||||
import akka.actor.UntypedActorFactory;
|
||||
import akka.actor.Actors;
|
||||
import akka.event.Logging;
|
||||
import akka.event.LoggingAdapter;
|
||||
|
||||
//#imports-prio
|
||||
|
||||
//#imports-prio-mailbox
|
||||
import akka.actor.ActorContext;
|
||||
import akka.dispatch.PriorityGenerator;
|
||||
import akka.dispatch.UnboundedPriorityMailbox;
|
||||
import akka.dispatch.MailboxType;
|
||||
import akka.dispatch.MessageQueue;
|
||||
import com.typesafe.config.Config;
|
||||
|
||||
//#imports-prio-mailbox
|
||||
|
|
@ -37,7 +32,6 @@ import static org.junit.Assert.*;
|
|||
|
||||
import com.typesafe.config.ConfigFactory;
|
||||
|
||||
import akka.actor.ActorSystem;
|
||||
import akka.docs.actor.MyUntypedActor;
|
||||
import akka.docs.actor.UntypedActorDocTestBase.MyActor;
|
||||
import akka.testkit.AkkaSpec;
|
||||
|
|
@ -93,7 +87,7 @@ public class DispatcherDocTestBase {
|
|||
getSelf().tell("pigdog2");
|
||||
getSelf().tell("pigdog3");
|
||||
getSelf().tell("highpriority");
|
||||
getSelf().tell(Actors.poisonPill());
|
||||
getSelf().tell(PoisonPill.getInstance());
|
||||
}
|
||||
|
||||
public void onReceive(Object message) {
|
||||
|
|
@ -133,7 +127,7 @@ public class DispatcherDocTestBase {
|
|||
return 0; // 'highpriority messages should be treated first if possible
|
||||
else if (message.equals("lowpriority"))
|
||||
return 2; // 'lowpriority messages should be treated last if possible
|
||||
else if (message.equals(Actors.poisonPill()))
|
||||
else if (message.equals(PoisonPill.getInstance()))
|
||||
return 3; // PoisonPill when no other left
|
||||
else
|
||||
return 1; // By default they go between high and low prio
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue