Removing akka.actor.Actors since they were deprecated in 2.0.2

This commit is contained in:
Viktor Klang 2012-05-07 20:37:56 +02:00
parent 5c9dff8ad2
commit 57c5dd00e0
11 changed files with 19 additions and 82 deletions

View file

@ -86,9 +86,5 @@ class ReceiveTimeoutSpec extends AkkaSpec {
intercept[TimeoutException] { Await.ready(timeoutLatch, 1 second) }
system.stop(timeoutActor)
}
"have ReceiveTimeout eq to Actors ReceiveTimeout" in {
akka.actor.Actors.receiveTimeout must be theSameInstanceAs (ReceiveTimeout)
}
}
}

View file

@ -1,51 +0,0 @@
/**
* Copyright (C) 2009-2012 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.actor;
/**
* JAVA API for - creating actors, - creating remote actors, - locating actors
*/
public class Actors {
/**
* The message that is sent when an Actor gets a receive timeout.
*
* <pre>
* if (message == receiveTimeout()) {
* // Timed out
* }
* </pre>
*
* @return the single instance of ReceiveTimeout
*/
public final static ReceiveTimeout$ receiveTimeout() {
return ReceiveTimeout$.MODULE$;
}
/**
* The message that when sent to an Actor kills it by throwing an exception.
*
* <pre>
* actor.tell(kill());
* </pre>
*
* @return the single instance of Kill
*/
public final static Kill$ kill() {
return Kill$.MODULE$;
}
/**
* The message that when sent to an Actor shuts it down by calling 'stop'.
*
* <pre>
* actor.tell(poisonPill());
* </pre>
*
* @return the single instance of PoisonPill
*/
public final static PoisonPill$ poisonPill() {
return PoisonPill$.MODULE$;
}
}

View file

@ -217,8 +217,8 @@ trait FSM[S, D] extends Listeners with ActorLogging {
* @param timeout state timeout for the initial state, overriding the default timeout for that state
*/
protected final def startWith(stateName: S,
stateData: D,
timeout: Timeout = None): Unit =
stateData: D,
timeout: Timeout = None): Unit =
currentState = FSM.State(stateName, stateData, timeout)
/**

View file

@ -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());
}
}

View file

@ -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);

View file

@ -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();
}

View file

@ -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();

View file

@ -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

View file

@ -3,26 +3,26 @@ package akka.docs.camel
object Consumers {
{
//#Consumer1
import akka.camel.{CamelMessage, Consumer}
import akka.camel.{ CamelMessage, Consumer }
class Consumer1 extends Consumer {
def endpointUri = "file:data/input/actor"
def receive = {
case msg: CamelMessage => println("received %s" format msg.bodyAs[String])
case msg: CamelMessage println("received %s" format msg.bodyAs[String])
}
}
//#Consumer1
}
{
//#Consumer2
import akka.camel.{CamelMessage, Consumer}
import akka.camel.{ CamelMessage, Consumer }
class Consumer2 extends Consumer {
def endpointUri = "jetty:http://localhost:8877/camel/default"
def receive = {
case msg: CamelMessage => sender ! ("Hello %s" format msg.bodyAs[String])
case msg: CamelMessage sender ! ("Hello %s" format msg.bodyAs[String])
}
}
//#Consumer2

View file

@ -1,6 +1,5 @@
package akka.spring.foo;
import static akka.actor.Actors.*;
import akka.actor.ActorRef;
import akka.actor.UntypedActor;

View file

@ -5,7 +5,6 @@
package akka.transactor;
import akka.actor.ActorRef;
import akka.actor.Actors;
import akka.actor.UntypedActor;
import scala.concurrent.stm.Ref;
import scala.concurrent.stm.japi.STM;