summaryrefslogtreecommitdiff
path: root/test/files/jvm/actmig-loop-react.scala
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/jvm/actmig-loop-react.scala')
-rw-r--r--test/files/jvm/actmig-loop-react.scala19
1 files changed, 9 insertions, 10 deletions
diff --git a/test/files/jvm/actmig-loop-react.scala b/test/files/jvm/actmig-loop-react.scala
index 7f4c6f96dc..c9a3664526 100644
--- a/test/files/jvm/actmig-loop-react.scala
+++ b/test/files/jvm/actmig-loop-react.scala
@@ -2,7 +2,6 @@
* NOTE: Code snippets from this test are included in the Actor Migration Guide. In case you change
* code in these tests prior to the 2.10.0 release please send the notification to @vjovanov.
*/
-import scala.actors.migration.MigrationSystem._
import scala.actors.Actor._
import scala.actors._
import scala.actors.migration._
@@ -40,7 +39,7 @@ object Test {
Await.ready(finishedLWCR1.future, 5 seconds)
// Loop with Condition Snippet - migrated
- val myAkkaActor = MigrationSystem.actorOf(Props(() => new StashingActor {
+ val myAkkaActor = ActorDSL.actor(new StashingActor {
def receive = {
case x: Int =>
@@ -51,7 +50,7 @@ object Test {
context.stop(self)
}
}
- }, "default-stashing-dispatcher"))
+ })
myAkkaActor ! 1
myAkkaActor ! 42
}
@@ -88,7 +87,7 @@ object Test {
Await.ready(finishedTNR1.future, 5 seconds)
// Loop with Condition Snippet - migrated
- val myAkkaActor = MigrationSystem.actorOf(Props(() => new StashingActor {
+ val myAkkaActor = ActorDSL.actor(new StashingActor {
def receive = {
case x: Int =>
@@ -107,7 +106,7 @@ object Test {
context.unbecome()
}).orElse { case x => stash() })
}
- }, "default-stashing-dispatcher"))
+ })
myAkkaActor ! 1
myAkkaActor ! "I am a String"
@@ -117,7 +116,7 @@ object Test {
def exceptionHandling() = {
// Stashing actor with act and exception handler
- val myActor = MigrationSystem.actorOf(Props(() => new StashingActor {
+ val myActor = ActorDSL.actor(new StashingActor {
def receive = { case _ => println("Dummy method.") }
override def act() = {
@@ -138,7 +137,7 @@ object Test {
case x: Exception => println("scala got exception")
}
- }, "default-stashing-dispatcher"))
+ })
myActor ! "work"
myActor ! "fail"
@@ -146,7 +145,7 @@ object Test {
Await.ready(finishedEH1.future, 5 seconds)
// Stashing actor in Akka style
- val myAkkaActor = MigrationSystem.actorOf(Props(() => new StashingActor {
+ val myAkkaActor = ActorDSL.actor(new StashingActor {
def receive = PFCatch({
case "fail" =>
throw new Exception("failed")
@@ -156,14 +155,14 @@ object Test {
finishedEH.success(true)
context.stop(self)
}, { case x: Exception => println("akka got exception") })
- }, "default-stashing-dispatcher"))
+ })
myAkkaActor ! "work"
myAkkaActor ! "fail"
myAkkaActor ! "die"
}
- def main(args: Array[String]) = {
+ def main(args: Array[String]): Unit = {
testLoopWithConditionReact()
Await.ready(finishedLWCR.future, 5 seconds)
exceptionHandling()