summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Suereth <joshua.suereth@gmail.com>2012-10-30 15:17:05 -0400
committerJosh Suereth <joshua.suereth@gmail.com>2012-10-30 15:17:05 -0400
commit557fe9e9d2c14f363918e89056233a981dc5ef5c (patch)
tree6b76f04fa1cb4a8624bbb060df540505194d9688
parent2c554249fd8e99286134b217027b6e3cb2c92d77 (diff)
downloadscala-557fe9e9d2c14f363918e89056233a981dc5ef5c.tar.gz
scala-557fe9e9d2c14f363918e89056233a981dc5ef5c.tar.bz2
scala-557fe9e9d2c14f363918e89056233a981dc5ef5c.zip
Removing actors-migration from main repository so it can live on elsewhere.
* Removes actors-migration hooks from partest * Removes actors-migration code * removes actors-migration tests * removes actors-migration distribution packaging.
-rw-r--r--build.xml77
-rw-r--r--project/Build.scala5
-rw-r--r--src/actors-migration/scala/actors/migration/ActorDSL.scala56
-rw-r--r--src/actors-migration/scala/actors/migration/Pattern.scala27
-rw-r--r--src/actors-migration/scala/actors/migration/Props.scala14
-rw-r--r--src/actors-migration/scala/actors/migration/StashingActor.scala257
-rw-r--r--src/actors-migration/scala/actors/migration/Timeout.scala40
-rw-r--r--src/build/bnd/scala-actors-migration.bnd5
-rw-r--r--src/build/maven/maven-deploy.xml3
-rw-r--r--src/build/maven/scala-actors-migration-pom.xml66
-rw-r--r--src/build/pack.xml5
-rw-r--r--src/partest/scala/tools/partest/PartestTask.scala11
-rw-r--r--src/partest/scala/tools/partest/nest/AntRunner.scala1
-rw-r--r--src/partest/scala/tools/partest/nest/ConsoleFileManager.scala9
-rw-r--r--src/partest/scala/tools/partest/nest/DirectRunner.scala3
-rw-r--r--src/partest/scala/tools/partest/nest/FileManager.scala1
-rw-r--r--src/partest/scala/tools/partest/nest/ReflectiveRunner.scala4
-rw-r--r--src/partest/scala/tools/partest/nest/SBTRunner.scala2
-rw-r--r--test/files/jvm/actmig-PinS.check19
-rw-r--r--test/files/jvm/actmig-PinS.scala116
-rw-r--r--test/files/jvm/actmig-PinS_1.check19
-rw-r--r--test/files/jvm/actmig-PinS_1.scala139
-rw-r--r--test/files/jvm/actmig-PinS_2.check19
-rw-r--r--test/files/jvm/actmig-PinS_2.scala159
-rw-r--r--test/files/jvm/actmig-PinS_3.check19
-rw-r--r--test/files/jvm/actmig-PinS_3.scala164
-rw-r--r--test/files/jvm/actmig-hierarchy.check2
-rw-r--r--test/files/jvm/actmig-hierarchy.scala47
-rw-r--r--test/files/jvm/actmig-hierarchy_1.check2
-rw-r--r--test/files/jvm/actmig-hierarchy_1.scala45
-rw-r--r--test/files/jvm/actmig-instantiation.check8
-rw-r--r--test/files/jvm/actmig-instantiation.scala95
-rw-r--r--test/files/jvm/actmig-loop-react.check16
-rw-r--r--test/files/jvm/actmig-loop-react.scala195
-rw-r--r--test/files/jvm/actmig-public-methods.check6
-rw-r--r--test/files/jvm/actmig-public-methods.scala73
-rw-r--r--test/files/jvm/actmig-public-methods_1.check6
-rw-r--r--test/files/jvm/actmig-public-methods_1.scala104
-rw-r--r--test/files/jvm/actmig-react-receive.check16
-rw-r--r--test/files/jvm/actmig-react-receive.scala115
-rw-r--r--test/files/jvm/actmig-react-within.check2
-rw-r--r--test/files/jvm/actmig-react-within.scala47
-rw-r--r--test/files/jvm/actmig-receive.check27
-rw-r--r--test/files/jvm/actmig-receive.scala119
44 files changed, 9 insertions, 2156 deletions
diff --git a/build.xml b/build.xml
index c9027e0985..41a4488a55 100644
--- a/build.xml
+++ b/build.xml
@@ -1024,7 +1024,6 @@ QUICK BUILD (QUICK)
<include name="continuations/**"/>
<include name="swing/**"/>
<include name="actors/**"/>
- <include name="actors-migration/**"/>
</srcfiles>
</uptodate>
</target>
@@ -1283,33 +1282,7 @@ QUICK BUILD (QUICK)
<stopwatch name="quick.plugins.timer" action="total"/>
</target>
- <target name="quick.pre-actors-migration" depends="quick.plugins">
- <uptodate property="quick.actors-migration.available" targetfile="${build-quick.dir}/actors-migration.complete">
- <srcfiles dir="${src.dir}/actors-migration"/>
- </uptodate>
- </target>
-
- <target name="quick.actors-migration" depends="quick.pre-actors-migration" unless="quick.actors-migration.available">
- <stopwatch name="quick.actors-migration.timer"/>
- <mkdir dir="${build-quick.dir}/classes/actors-migration"/>
- <scalacfork
- destdir="${build-quick.dir}/classes/actors-migration"
- compilerpathref="quick.classpath"
- params="${scalac.args.quick}"
- srcdir="${src.dir}/actors-migration"
- jvmargs="${scalacfork.jvmargs}">
- <include name="**/*.scala"/>
- <compilationpath>
- <pathelement location="${build-quick.dir}/classes/library"/>
- <pathelement location="${build-quick.dir}/classes/actors-migration"/>
- <path refid="forkjoin.classpath"/>
- </compilationpath>
- </scalacfork>
- <touch file="${build-quick.dir}/actors-migration.complete" verbose="no"/>
- <stopwatch name="quick.actors-migration.timer" action="total"/>
- </target>
-
- <target name="quick.pre-scalacheck" depends="quick.actors-migration">
+ <target name="quick.pre-scalacheck" depends="quick.plugins">
<uptodate property="quick.scalacheck.available" targetfile="${build-quick.dir}/scalacheck.complete">
<srcfiles dir="${src.dir}/scalacheck"/>
</uptodate>
@@ -1514,14 +1487,11 @@ PACKED QUICK BUILD (PACK)
</fileset>
<fileset dir="${build-libs.dir}/classes/forkjoin"/>
</jar>
- <jar destfile="${build-pack.dir}/lib/scala-actors.jar">
+ <jar destfile="${build-pack.dir}/lib/scala-actors.jar">
<fileset dir="${build-quick.dir}/classes/library">
<include name="scala/actors/**"/>
</fileset>
- </jar>
- <jar destfile="${build-pack.dir}/lib/scala-actors-migration.jar">
- <fileset dir="${build-quick.dir}/classes/actors-migration"/>
- </jar>
+ </jar>
</target>
<target name="pack.swing" depends="pack.lib" if="has.java6">
@@ -1682,7 +1652,6 @@ PACKED QUICK BUILD (PACK)
<pathelement location="${build-pack.dir}/lib/scala-partest.jar"/>
<pathelement location="${build-pack.dir}/lib/scalap.jar"/>
<pathelement location="${build-pack.dir}/lib/scala-actors.jar"/>
- <pathelement location="${build-pack.dir}/lib/scala-actors-migration.jar"/>
<pathelement location="${ant.jar}"/>
<pathelement location="${jline.jar}"/>
<path refid="lib.extra"/>
@@ -1752,7 +1721,6 @@ OSGi Artifacts
<stopwatch name="osgi.bundle.timer"/>
<make-bundle name="scala-library" version="${osgi.version.number}" />
<make-bundle name="scala-actors" version="${osgi.version.number}" />
- <make-bundle name="scala-actors-migration" version="${osgi.version.number}" />
<make-bundle name="scala-reflect" version="${osgi.version.number}" />
<make-bundle name="scala-compiler" version="${osgi.version.number}" />
<make-plugin-bundle name="continuations" version="${osgi.version.number}" />
@@ -1773,7 +1741,6 @@ OSGi Artifacts
<pathelement location="${build-osgi.dir}/org.scala-lang.scala-reflect.jar"/>
<pathelement location="${build-osgi.dir}/org.scala-lang.scala-compiler.jar"/>
<pathelement location="${build-osgi.dir}/org.scala-lang.scala-actors.jar"/>
- <pathelement location="${build-osgi.dir}/org.scala-lang.scala-actors-migration.jar"/>
</path>
<uptodate property="osgi.test.available" targetfile="${build-osgi.dir}/test-compile.complete">
@@ -2321,7 +2288,6 @@ DOCUMENTATION
<include name="library/**"/>
<include name="swing/**"/>
<include name="actors/**"/>
- <include name="actors-migration/**"/>
<include name="reflect/**"/>
</source-includes>
</doc-uptodate-check>
@@ -2348,7 +2314,6 @@ DOCUMENTATION
rawOutput="${scaladoc.raw.output}"
noPrefixes="${scaladoc.no.prefixes}">
<src>
- <files includes="${src.dir}/actors-migration"/>
<files includes="${src.dir}/actors"/>
<files includes="${src.dir}/library"/>
<files includes="${src.dir}/reflect"/>
@@ -2547,35 +2512,9 @@ DOCUMENTATION
<stopwatch name="docs.continuations-plugin.timer" action="total"/>
</target>
- <target name="docs.pre-actors-migration" depends="docs.continuations-plugin">
- <doc-uptodate-check name="actors-migration" srcdir="${src.dir}/actors-migration" />
- </target>
-
- <target name="docs.actors-migration" depends="docs.pre-actors-migration" unless="docs.actors-migration.available">
- <stopwatch name="docs.actors-migration.timer"/>
- <mkdir dir="${build-docs.dir}/actors-migration"/>
- <scaladoc
- destdir="${build-docs.dir}/actors-migration"
- doctitle="Actors Migration Kit"
- docversion="${version.number}"
- sourcepath="${src.dir}"
- classpathref="pack.classpath"
- srcdir="${src.dir}/actors-migration"
- addparams="${scalac.args.all}"
- implicits="on"
- diagrams="on"
- groups="on"
- rawOutput="${scaladoc.raw.output}"
- noPrefixes="${scaladoc.no.prefixes}">
- <include name="**/*.scala"/>
- </scaladoc>
- <touch file="${build-docs.dir}/actors-migration.complete" verbose="no"/>
- <stopwatch name="docs.actors-migration.timer" action="total"/>
- </target>
-
<target name="docs.done" depends="docs.man"/>
- <target name="docs.all" depends="docs.jline, docs.comp, docs.man, docs.lib, docs.scalap, docs.partest, docs.continuations-plugin, docs.actors-migration"/>
+ <target name="docs.all" depends="docs.jline, docs.comp, docs.man, docs.lib, docs.scalap, docs.partest, docs.continuations-plugin"/>
<target name="docs.clean">
<delete dir="${build-docs.dir}" includeemptydirs="yes" quiet="yes" failonerror="no"/>
@@ -2592,7 +2531,6 @@ BOOTRAPING TEST AND TEST SUITE
<exclude name="bin/**"/>
<exclude name="*.complete"/>
<exclude name="misc/scala-devel/plugins/*.jar"/>
- <exclude name="classes/actors-migration/**"/>
</same>
</target>
@@ -2741,7 +2679,6 @@ DISTRIBUTION
<copy-bundle name="scala-reflect"/>
<copy-bundle name="scala-swing"/>
<copy-bundle name="scala-actors"/>
- <copy-bundle name="scala-actors-migration"/>
<copy-bundle name="scala-compiler"/>
<copy toDir="${dist.dir}/bin">
<fileset dir="${build-pack.dir}/bin"/>
@@ -2802,9 +2739,6 @@ DISTRIBUTION
<jar destfile="${dist.dir}/src/scala-actors-src.jar">
<fileset dir="${src.dir}/actors"/>
</jar>
- <jar destfile="${dist.dir}/src/scala-actors-migration-src.jar">
- <fileset dir="${src.dir}/actors-migration"/>
- </jar>
<jar destfile="${dist.dir}/src/scalap-src.jar">
<fileset dir="${src.dir}/scalap"/>
</jar>
@@ -2983,9 +2917,6 @@ POSITIONS
<param name="test.srcs" value="${src.dir}/actors"/>
</antcall>
<antcall target="test.positions.sub" inheritRefs="true">
- <param name="test.srcs" value="${src.dir}/actors-migration"/>
- </antcall>
- <antcall target="test.positions.sub" inheritRefs="true">
<param name="test.srcs" value="${src.dir}/dbc"/>
</antcall>
<antcall target="test.positions.sub" inheritRefs="true">
diff --git a/project/Build.scala b/project/Build.scala
index d8468032ef..a50a572d54 100644
--- a/project/Build.scala
+++ b/project/Build.scala
@@ -24,9 +24,9 @@ object ScalaBuild extends Build with Layers with Packaging with Testing {
)
// Collections of projects to run 'compile' on.
- lazy val compiledProjects = Seq(quickLib, quickComp, continuationsLibrary, actors, actorsMigration, swing, forkjoin, fjbg)
+ lazy val compiledProjects = Seq(quickLib, quickComp, continuationsLibrary, actors, swing, forkjoin, fjbg)
// Collection of projects to 'package' and 'publish' together.
- lazy val packagedBinaryProjects = Seq(scalaLibrary, scalaCompiler, swing, actors, actorsMigration, continuationsPlugin, jline, scalap)
+ lazy val packagedBinaryProjects = Seq(scalaLibrary, scalaCompiler, swing, actors, continuationsPlugin, jline, scalap)
lazy val partestRunProjects = Seq(testsuite, continuationsTestsuite)
private def epflPomExtra = (
@@ -205,7 +205,6 @@ object ScalaBuild extends Build with Layers with Packaging with Testing {
lazy val dependentProjectSettings = settingOverrides ++ Seq(quickScalaInstance, quickScalaLibraryDependency, addCheaterDependency("scala-library"))
lazy val actors = Project("scala-actors", file(".")) settings(dependentProjectSettings:_*) dependsOn(forkjoin % "provided")
lazy val swing = Project("scala-swing", file(".")) settings(dependentProjectSettings:_*) dependsOn(actors % "provided")
- lazy val actorsMigration = Project("scala-actors-migration", file(".")) settings(dependentProjectSettings:_*) dependsOn(actors % "provided")
// This project will generate man pages (in man1 and html) for scala.
lazy val manmakerSettings: Seq[Setting[_]] = dependentProjectSettings :+ externalDeps
lazy val manmaker = Project("manual", file(".")) settings(manmakerSettings:_*)
diff --git a/src/actors-migration/scala/actors/migration/ActorDSL.scala b/src/actors-migration/scala/actors/migration/ActorDSL.scala
deleted file mode 100644
index b8cb8ec998..0000000000
--- a/src/actors-migration/scala/actors/migration/ActorDSL.scala
+++ /dev/null
@@ -1,56 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2005-2011, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-package scala.actors
-package migration
-
-import scala.actors.{ Actor, ActorRef, InternalActorRef }
-import scala.collection.immutable
-import scala.reflect.ClassTag
-
-object ActorDSL {
-
- private[migration] val contextStack = new ThreadLocal[immutable.Stack[Boolean]] {
- override def initialValue() = immutable.Stack[Boolean]()
- }
-
- private[this] def withCleanContext(block: => ActorRef): ActorRef = {
- // push clean marker
- val old = contextStack.get
- contextStack.set(old.push(true))
- try {
- val instance = block
-
- if (instance eq null)
- throw new Exception("ActorRef can't be 'null'")
-
- instance
- } finally {
- val stackAfter = contextStack.get
- if (stackAfter.nonEmpty)
- contextStack.set(if (!stackAfter.head) stackAfter.pop.pop else stackAfter.pop)
- }
- }
-
- /**
- * Create an actor from the given thunk which must produce an [[scala.actors.Actor]].
- *
- * @param ctor is a by-name argument which captures an [[scala.actors.Actor]]
- * factory; <b>do not make the generated object accessible to code
- * outside and do not return the same object upon subsequent invocations.</b>
- */
- def actor[T <: InternalActor: ClassTag](ctor: ⇒ T): ActorRef = {
- withCleanContext {
- val newActor = ctor
- val newRef = new InternalActorRef(newActor)
- newActor.start()
- newRef
- }
- }
-
-}
diff --git a/src/actors-migration/scala/actors/migration/Pattern.scala b/src/actors-migration/scala/actors/migration/Pattern.scala
deleted file mode 100644
index 25ba191ce7..0000000000
--- a/src/actors-migration/scala/actors/migration/Pattern.scala
+++ /dev/null
@@ -1,27 +0,0 @@
-package scala.actors.migration
-
-import scala.actors._
-import scala.concurrent.duration.Duration
-import language.implicitConversions
-
-object pattern {
-
- implicit def ask(ar: ActorRef): AskableActorRef =
- new AskableActorRef(ar)
-}
-
-/**
- * ActorRef with support for ask(?) operation.
- */
-class AskableActorRef(val ar: ActorRef) extends ActorRef {
-
- def !(message: Any)(implicit sender: ActorRef = null): Unit = ar.!(message)(sender)
-
- def ?(message: Any)(implicit timeout: Timeout): scala.concurrent.Future[Any] = ar.?(message, timeout.duration)
-
- private[actors] def ?(message: Any, timeout: Duration): scala.concurrent.Future[Any] = ar.?(message, timeout)
-
- def forward(message: Any) = ar.forward(message)
-
- private[actors] def localActor: AbstractActor = ar.localActor
-}
diff --git a/src/actors-migration/scala/actors/migration/Props.scala b/src/actors-migration/scala/actors/migration/Props.scala
deleted file mode 100644
index 00bc9d93f8..0000000000
--- a/src/actors-migration/scala/actors/migration/Props.scala
+++ /dev/null
@@ -1,14 +0,0 @@
-package scala.actors.migration
-
-import scala.actors._
-
-/**
- * ActorRef configuration object. It represents the minimal subset of Akka Props class.
- */
-case class Props(creator: () ⇒ InternalActor, dispatcher: String) {
-
- /**
- * Returns a new Props with the specified creator set
- */
- final def withCreator(c: ⇒ InternalActor) = copy(creator = () ⇒ c)
-}
diff --git a/src/actors-migration/scala/actors/migration/StashingActor.scala b/src/actors-migration/scala/actors/migration/StashingActor.scala
deleted file mode 100644
index 12bad2ed1c..0000000000
--- a/src/actors-migration/scala/actors/migration/StashingActor.scala
+++ /dev/null
@@ -1,257 +0,0 @@
-package scala.actors.migration
-
-import scala.actors._
-import scala.actors.Actor._
-import scala.collection._
-import scala.concurrent.duration.Duration
-import java.util.concurrent.TimeUnit
-import scala.language.implicitConversions
-
-object StashingActor extends Combinators {
- implicit def mkBody[A](body: => A) = new InternalActor.Body[A] {
- def andThen[B](other: => B): Unit = Actor.rawSelf.seq(body, other)
- }
-}
-
-@deprecated("Scala Actors are being removed from the standard library. Please refer to the migration guide.", "2.10.0")
-trait StashingActor extends InternalActor {
- type Receive = PartialFunction[Any, Unit]
-
- // checks if StashingActor is created within the actorOf block
- creationCheck()
-
- private[actors] val ref = new InternalActorRef(this)
-
- val self: ActorRef = ref
-
- protected[this] val context: ActorContext = new ActorContext(this)
-
- @volatile
- private var myTimeout: Option[Long] = None
-
- private val stash = new MQueue[Any]("Stash")
-
- /**
- * Migration notes:
- * this method replaces receiveWithin, receive and react methods from Scala Actors.
- */
- def receive: Receive
-
- /**
- * User overridable callback.
- * <p/>
- * Is called when an Actor is started by invoking 'actor'.
- */
- def preStart() {}
-
- /**
- * User overridable callback.
- * <p/>
- * Is called when 'actor.stop()' is invoked.
- */
- def postStop() {}
-
- /**
- * User overridable callback.
- * <p/>
- * Is called on a crashed Actor right BEFORE it is restarted to allow clean
- * up of resources before Actor is terminated.
- * By default it calls postStop()
- */
- def preRestart(reason: Throwable, message: Option[Any]) { postStop() }
-
- /**
- * Changes the Actor's behavior to become the new 'Receive' (PartialFunction[Any, Unit]) handler.
- * Puts the behavior on top of the hotswap stack.
- * If "discardOld" is true, an unbecome will be issued prior to pushing the new behavior to the stack
- */
- private def become(behavior: Receive, discardOld: Boolean = true) {
- if (discardOld) unbecome()
- behaviorStack = behaviorStack.push(wrapWithSystemMessageHandling(behavior))
- }
-
- /**
- * Reverts the Actor behavior to the previous one in the hotswap stack.
- */
- private def unbecome() {
- // never unbecome the initial behavior
- if (behaviorStack.size > 1)
- behaviorStack = behaviorStack.pop
- }
-
- /**
- * User overridable callback.
- * <p/>
- * Is called when a message isn't handled by the current behavior of the actor
- * by default it does: EventHandler.warning(self, message)
- */
- def unhandled(message: Any) {
- message match {
- case Terminated(dead) ⇒ throw new DeathPactException(dead)
- case _ ⇒ System.err.println("Unhandeled message " + message)
- }
- }
-
- protected def sender: ActorRef = new OutputChannelRef(internalSender)
-
- override def act(): Unit = internalAct()
-
- override def start(): StashingActor = {
- super.start()
- this
- }
-
- override def receive[R](f: PartialFunction[Any, R]): R
-
- /*
- * Internal implementation.
- */
-
- private[actors] var behaviorStack = immutable.Stack[PartialFunction[Any, Unit]]()
-
- /*
- * Checks that StashingActor instances can only be created using the ActorDSL.
- */
- private[this] def creationCheck(): Unit = {
- // creation check (see ActorRef)
- val context = ActorDSL.contextStack.get
- if (context.isEmpty)
- throw new RuntimeException("In order to create a StashingActor one must use the ActorDSL object")
- else {
- if (!context.head)
- throw new RuntimeException("Cannot create more than one actor")
- else
- ActorDSL.contextStack.set(context.push(false))
- }
-
- }
-
- private[actors] override def preAct() {
- preStart()
- }
-
- /**
- * Adds message to a stash, to be processed later. Stashed messages can be fed back into the $actor's
- * mailbox using <code>unstashAll()</code>.
- *
- * Temporarily stashing away messages that the $actor does not (yet) handle simplifies implementing
- * certain messaging protocols.
- */
- final def stash(msg: Any): Unit = {
- stash.append(msg, null)
- }
-
- final def unstashAll(): Unit = {
- mailbox.prepend(stash)
- stash.clear()
- }
-
- /**
- * Wraps any partial function with Exit message handling.
- */
- private[actors] def wrapWithSystemMessageHandling(pf: PartialFunction[Any, Unit]): PartialFunction[Any, Unit] = {
-
- def swapExitHandler(pf: PartialFunction[Any, Unit]) = new PartialFunction[Any, Unit] {
- def swapExit(v: Any) = v match {
- case Exit(from, reason) =>
- Terminated(new InternalActorRef(from.asInstanceOf[InternalActor]))
- case v => v
- }
-
- def isDefinedAt(v: Any) = pf.isDefinedAt(swapExit(v))
- def apply(v: Any) = pf(swapExit(v))
- }
-
- swapExitHandler(pf orElse {
- case m => unhandled(m)
- })
- }
-
- /**
- * Method that models the behavior of Akka actors.
- */
- private[actors] def internalAct() {
- trapExit = true
- behaviorStack = behaviorStack.push(wrapWithSystemMessageHandling(receive))
- loop {
- if (myTimeout.isDefined)
- reactWithin(myTimeout.get)(behaviorStack.top)
- else
- react(behaviorStack.top)
- }
- }
-
- private[actors] override def internalPostStop() = postStop()
-
- // Used for pattern matching statement similar to Akka
- lazy val ReceiveTimeout = TIMEOUT
-
- /**
- * Used to simulate Akka context behavior. Should be used only for migration purposes.
- */
- protected[actors] class ActorContext(val actr: StashingActor) {
-
- /**
- * Changes the Actor's behavior to become the new 'Receive' (PartialFunction[Any, Unit]) handler.
- * Puts the behavior on top of the hotswap stack.
- * If "discardOld" is true, an unbecome will be issued prior to pushing the new behavior to the stack
- */
- def become(behavior: Receive, discardOld: Boolean = true) = actr.become(behavior, discardOld)
-
- /**
- * Reverts the Actor behavior to the previous one in the hotswap stack.
- */
- def unbecome() = actr.unbecome()
-
- /**
- * Shuts down the actor its dispatcher and message queue.
- */
- def stop(subject: ActorRef): Nothing = if (subject != ref)
- throw new RuntimeException("Only stoping of self is allowed during migration.")
- else
- actr.exit()
-
- /**
- * Registers this actor as a Monitor for the provided ActorRef.
- * @return the provided ActorRef
- */
- def watch(subject: ActorRef): ActorRef = {
- actr.watch(subject)
- subject
- }
-
- /**
- * Unregisters this actor as Monitor for the provided ActorRef.
- * @return the provided ActorRef
- */
- def unwatch(subject: ActorRef): ActorRef = {
- actr unwatch subject
- subject
- }
-
- /**
- * Defines the receiver timeout value.
- */
- final def setReceiveTimeout(timeout: Duration): Unit =
- actr.myTimeout = Some(timeout.toMillis)
-
- /**
- * Gets the current receiveTimeout
- */
- final def receiveTimeout: Option[Duration] =
- actr.myTimeout.map(Duration(_, TimeUnit.MILLISECONDS))
-
- }
-}
-
-/**
- * This message is thrown by default when an Actor does not handle termination.
- */
-class DeathPactException(ref: ActorRef = null) extends Exception {
- override def fillInStackTrace() = this //Don't waste cycles generating stack trace
-}
-
-/**
- * Message that is sent to a watching actor when the watched actor terminates.
- */
-case class Terminated(actor: ActorRef)
diff --git a/src/actors-migration/scala/actors/migration/Timeout.scala b/src/actors-migration/scala/actors/migration/Timeout.scala
deleted file mode 100644
index 32ea5f20fc..0000000000
--- a/src/actors-migration/scala/actors/migration/Timeout.scala
+++ /dev/null
@@ -1,40 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2005-2011, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-package scala.actors.migration
-
-import scala.concurrent.duration.Duration
-import java.util.concurrent.TimeUnit
-import scala.language.implicitConversions
-
-case class Timeout(duration: Duration) {
- def this(timeout: Long) = this(Duration(timeout, TimeUnit.MILLISECONDS))
- def this(length: Long, unit: TimeUnit) = this(Duration(length, unit))
-}
-
-object Timeout {
-
- /**
- * A timeout with zero duration, will cause most requests to always timeout.
- */
- val zero = new Timeout(Duration.Zero)
-
- /**
- * A Timeout with infinite duration. Will never timeout. Use extreme caution with this
- * as it may cause memory leaks, blocked threads, or may not even be supported by
- * the receiver, which would result in an exception.
- */
- val never = new Timeout(Duration.Inf)
-
- def apply(timeout: Long) = new Timeout(timeout)
- def apply(length: Long, unit: TimeUnit) = new Timeout(length, unit)
-
- implicit def durationToTimeout(duration: Duration) = new Timeout(duration)
- implicit def intToTimeout(timeout: Int) = new Timeout(timeout)
- implicit def longToTimeout(timeout: Long) = new Timeout(timeout)
-}
diff --git a/src/build/bnd/scala-actors-migration.bnd b/src/build/bnd/scala-actors-migration.bnd
deleted file mode 100644
index 2cddfb620a..0000000000
--- a/src/build/bnd/scala-actors-migration.bnd
+++ /dev/null
@@ -1,5 +0,0 @@
-Bundle-Name: Scala Actors Migration
-Bundle-SymbolicName: org.scala-lang.scala-actors-migration
-ver: @VERSION@
-Bundle-Version: ${ver}
-Export-Package: *;version=${ver}
diff --git a/src/build/maven/maven-deploy.xml b/src/build/maven/maven-deploy.xml
index 131358f0f3..bd946bf0f3 100644
--- a/src/build/maven/maven-deploy.xml
+++ b/src/build/maven/maven-deploy.xml
@@ -113,7 +113,6 @@
<deploy-local-plugin name="continuations" version="@{version}" repository="@{repository}"/>
<deploy-local name="scala-reflect" version="@{version}" repository="@{repository}" />
<deploy-local name="scala-actors" version="@{version}" repository="@{repository}" />
- <deploy-local name="scala-actors-migration" version="@{version}" repository="@{repository}" />
<deploy-local name="scala-swing" version="@{version}" repository="@{repository}"/>
<deploy-local name="scalap" version="@{version}" repository="@{repository}"/>
<deploy-local name="scala-partest" version="@{version}" repository="@{repository}"/>
@@ -175,7 +174,6 @@
<deploy-remote name="scala-compiler" version="@{version}" repository="@{repository}" />
<deploy-remote name="scala-swing" version="@{version}" repository="@{repository}"/>
<deploy-remote name="scala-actors" version="@{version}" repository="@{repository}"/>
- <deploy-remote name="scala-actors-migration" version="@{version}" repository="@{repository}"/>
<deploy-remote name="scalap" version="@{version}" repository="@{repository}"/>
<deploy-remote name="scala-partest" version="@{version}" repository="@{repository}"/>
<deploy-remote-plugin name="continuations" version="@{version}" repository="@{repository}"/>
@@ -244,7 +242,6 @@
<deploy-remote-signed name="scala-compiler" version="@{version}" repository="@{repository}" />
<deploy-remote-signed name="scala-swing" version="@{version}" repository="@{repository}"/>
<deploy-remote-signed name="scala-actors" version="@{version}" repository="@{repository}"/>
- <deploy-remote-signed name="scala-actors-migration" version="@{version}" repository="@{repository}"/>
<deploy-remote-signed name="scalap" version="@{version}" repository="@{repository}"/>
<deploy-remote-signed name="scala-partest" version="@{version}" repository="@{repository}"/>
</sequential>
diff --git a/src/build/maven/scala-actors-migration-pom.xml b/src/build/maven/scala-actors-migration-pom.xml
deleted file mode 100644
index 93fc34ece9..0000000000
--- a/src/build/maven/scala-actors-migration-pom.xml
+++ /dev/null
@@ -1,66 +0,0 @@
-<project
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.scala-lang</groupId>
- <artifactId>scala-actors-migration</artifactId>
- <packaging>jar</packaging>
- <version>@VERSION@</version>
- <name>Scala Migration Kit</name>
- <description>Migration kit that enables easy transition from the Scala Actors to Akka.</description>
- <url>http://www.scala-lang.org/</url>
- <inceptionYear>2012</inceptionYear>
- <organization>
- <name>LAMP/EPFL</name>
- <url>http://lamp.epfl.ch/</url>
- </organization>
- <licenses>
- <license>
- <name>BSD-like</name>
- <url>http://www.scala-lang.org/downloads/license.html
- </url>
- <distribution>repo</distribution>
- </license>
- </licenses>
- <scm>
- <connection>scm:git:git://github.com/scala/scala.git</connection>
- <url>https://github.com/scala/scala.git</url>
- </scm>
- <issueManagement>
- <system>JIRA</system>
- <url>https://issues.scala-lang.org/</url>
- </issueManagement>
- <dependencies>
- <dependency>
- <groupId>org.scala-lang</groupId>
- <artifactId>scala-library</artifactId>
- <version>@VERSION@</version>
- </dependency>
- <dependency>
- <groupId>org.scala-lang</groupId>
- <artifactId>scala-actors</artifactId>
- <version>@VERSION@</version>
- </dependency>
- </dependencies>
- <distributionManagement>
- <repository>
- <id>scala-tools.org</id>
- <url>@RELEASE_REPOSITORY@</url>
- </repository>
- <snapshotRepository>
- <id>scala-tools.org</id>
- <url>@SNAPSHOT_REPOSITORY@</url>
- <uniqueVersion>false</uniqueVersion>
- </snapshotRepository>
- </distributionManagement>
- <developers>
- <developer>
- <id>lamp</id>
- <name>EPFL LAMP</name>
- </developer>
- <developer>
- <id>Typesafe</id>
- <name>Typesafe, Inc.</name>
- </developer>
- </developers>
-</project>
diff --git a/src/build/pack.xml b/src/build/pack.xml
index 1735b93f3f..79611b55a2 100644
--- a/src/build/pack.xml
+++ b/src/build/pack.xml
@@ -155,7 +155,6 @@ MAIN DISTRIBUTION PACKAGING
<mvn-copy-lib mvn.artifact.name="scala-compiler"/>
<mvn-copy-lib mvn.artifact.name="scala-swing"/>
<mvn-copy-lib mvn.artifact.name="scala-actors"/>
- <mvn-copy-lib mvn.artifact.name="scala-actors-migration"/>
<mvn-copy-lib mvn.artifact.name="scala-partest"/>
<mvn-copy-lib mvn.artifact.name="scalap"/>
</target>
@@ -218,10 +217,6 @@ MAIN DISTRIBUTION PACKAGING
basedir="${build-docs.dir}/continuations-plugin">
<include name="**/*"/>
</jar>
- <jar destfile="${dists.dir}/maven/${version.number}/scala-actors-migration/scala-actors-migration-docs.jar"
- basedir="${build-docs.dir}/actors-migration">
- <include name="**/*"/>
- </jar>
<!-- TODO - Scala swing and actors should maybe have thier own jar, but creating it is SLOW. -->
<copy tofile="${dists.dir}/maven/${version.number}/scala-swing/scala-swing-docs.jar"
diff --git a/src/partest/scala/tools/partest/PartestTask.scala b/src/partest/scala/tools/partest/PartestTask.scala
index 959d682872..99ffbb5905 100644
--- a/src/partest/scala/tools/partest/PartestTask.scala
+++ b/src/partest/scala/tools/partest/PartestTask.scala
@@ -325,16 +325,6 @@ class PartestTask extends Task with CompilationPathProperty {
}
} getOrElse sys.error("Provided classpath does not contain a Scala actors.")
- val scalaActorsMigration = {
- (classpath.list map { fs => new File(fs) }) find { f =>
- f.getName match {
- case "scala-actors-migration.jar" => true
- case "actors-migration" if (f.getParentFile.getName == "classes") => true
- case _ => false
- }
- }
- } getOrElse sys.error("Provided classpath does not contain a Scala actors.")
-
def scalacArgsFlat: Option[Seq[String]] = scalacArgs map (_ flatMap { a =>
val parts = a.getParts
if(parts eq null) Seq[String]() else parts.toSeq
@@ -362,7 +352,6 @@ class PartestTask extends Task with CompilationPathProperty {
antFileManager.LATEST_COMP = scalaCompiler.getAbsolutePath
antFileManager.LATEST_PARTEST = scalaPartest.getAbsolutePath
antFileManager.LATEST_ACTORS = scalaActors.getAbsolutePath
- antFileManager.LATEST_ACTORS_MIGRATION = scalaActorsMigration.getAbsolutePath
javacmd foreach (x => antFileManager.JAVACMD = x.getAbsolutePath)
javaccmd foreach (x => antFileManager.JAVAC_CMD = x.getAbsolutePath)
diff --git a/src/partest/scala/tools/partest/nest/AntRunner.scala b/src/partest/scala/tools/partest/nest/AntRunner.scala
index ee644c5315..8c2d7029ba 100644
--- a/src/partest/scala/tools/partest/nest/AntRunner.scala
+++ b/src/partest/scala/tools/partest/nest/AntRunner.scala
@@ -24,7 +24,6 @@ class AntRunner extends DirectRunner {
var LATEST_COMP: String = _
var LATEST_PARTEST: String = _
var LATEST_ACTORS: String = _
- var LATEST_ACTORS_MIGRATION: String = _
val testRootPath: String = "test"
val testRootDir: Directory = Directory(testRootPath)
}
diff --git a/src/partest/scala/tools/partest/nest/ConsoleFileManager.scala b/src/partest/scala/tools/partest/nest/ConsoleFileManager.scala
index 32f14872ec..442c0e8427 100644
--- a/src/partest/scala/tools/partest/nest/ConsoleFileManager.scala
+++ b/src/partest/scala/tools/partest/nest/ConsoleFileManager.scala
@@ -84,7 +84,6 @@ class ConsoleFileManager extends FileManager {
latestFile = testClassesDir.parent / "bin"
latestLibFile = testClassesDir / "library"
latestActorsFile = testClassesDir / "library" / "actors"
- latestActMigFile = testClassesDir / "actors-migration"
latestReflectFile = testClassesDir / "reflect"
latestCompFile = testClassesDir / "compiler"
latestPartestFile = testClassesDir / "partest"
@@ -96,7 +95,6 @@ class ConsoleFileManager extends FileManager {
latestFile = dir / "bin"
latestLibFile = dir / "lib/scala-library.jar"
latestActorsFile = dir / "lib/scala-actors.jar"
- latestActMigFile = dir / "lib/scala-actors-migration.jar"
latestReflectFile = dir / "lib/scala-reflect.jar"
latestCompFile = dir / "lib/scala-compiler.jar"
latestPartestFile = dir / "lib/scala-partest.jar"
@@ -108,7 +106,6 @@ class ConsoleFileManager extends FileManager {
latestFile = prefixFile("build/quick/bin")
latestLibFile = prefixFile("build/quick/classes/library")
latestActorsFile = prefixFile("build/quick/classes/library/actors")
- latestActMigFile = prefixFile("build/quick/classes/actors-migration")
latestReflectFile = prefixFile("build/quick/classes/reflect")
latestCompFile = prefixFile("build/quick/classes/compiler")
latestPartestFile = prefixFile("build/quick/classes/partest")
@@ -120,7 +117,6 @@ class ConsoleFileManager extends FileManager {
latestFile = prefixFileWith(p, "bin")
latestLibFile = prefixFileWith(p, "lib/scala-library.jar")
latestActorsFile = prefixFileWith(p, "lib/scala-actors.jar")
- latestActMigFile = prefixFileWith(p, "lib/scala-actors-migration.jar")
latestReflectFile = prefixFileWith(p, "lib/scala-reflect.jar")
latestCompFile = prefixFileWith(p, "lib/scala-compiler.jar")
latestPartestFile = prefixFileWith(p, "lib/scala-partest.jar")
@@ -131,7 +127,6 @@ class ConsoleFileManager extends FileManager {
latestFile = prefixFile("dists/latest/bin")
latestLibFile = prefixFile("dists/latest/lib/scala-library.jar")
latestActorsFile = prefixFile("dists/latest/lib/scala-actors.jar")
- latestActMigFile = prefixFile("dists/latest/lib/scala-actors-migration.jar")
latestReflectFile = prefixFile("dists/latest/lib/scala-reflect.jar")
latestCompFile = prefixFile("dists/latest/lib/scala-compiler.jar")
latestPartestFile = prefixFile("dists/latest/lib/scala-partest.jar")
@@ -142,7 +137,6 @@ class ConsoleFileManager extends FileManager {
latestFile = prefixFile("build/pack/bin")
latestLibFile = prefixFile("build/pack/lib/scala-library.jar")
latestActorsFile = prefixFile("build/pack/lib/scala-actors.jar")
- latestActMigFile = prefixFile("build/pack/lib/scala-actors-migration.jar")
latestReflectFile = prefixFile("build/pack/lib/scala-reflect.jar")
latestCompFile = prefixFile("build/pack/lib/scala-compiler.jar")
latestPartestFile = prefixFile("build/pack/lib/scala-partest.jar")
@@ -180,7 +174,6 @@ class ConsoleFileManager extends FileManager {
LATEST_COMP = latestCompFile.getAbsolutePath
LATEST_PARTEST = latestPartestFile.getAbsolutePath
LATEST_ACTORS = latestActorsFile.getAbsolutePath
- LATEST_ACTORS_MIGRATION = latestActMigFile.getAbsolutePath
}
var LATEST_LIB: String = ""
@@ -188,12 +181,10 @@ class ConsoleFileManager extends FileManager {
var LATEST_COMP: String = ""
var LATEST_PARTEST: String = ""
var LATEST_ACTORS: String = ""
- var LATEST_ACTORS_MIGRATION: String = ""
var latestFile: File = _
var latestLibFile: File = _
var latestActorsFile: File = _
- var latestActMigFile: File = _
var latestReflectFile: File = _
var latestCompFile: File = _
var latestPartestFile: File = _
diff --git a/src/partest/scala/tools/partest/nest/DirectRunner.scala b/src/partest/scala/tools/partest/nest/DirectRunner.scala
index a890a57f14..0f926ee69e 100644
--- a/src/partest/scala/tools/partest/nest/DirectRunner.scala
+++ b/src/partest/scala/tools/partest/nest/DirectRunner.scala
@@ -49,10 +49,9 @@ trait DirectRunner {
val latestLibFile = new File(fileManager.LATEST_LIB)
val latestPartestFile = new File(fileManager.LATEST_PARTEST)
val latestActorsFile = new File(fileManager.LATEST_ACTORS)
- val latestActMigFile = new File(fileManager.LATEST_ACTORS_MIGRATION)
val scalacheckURL = PathSettings.scalaCheck.toURL
val scalaCheckParentClassLoader = ScalaClassLoader.fromURLs(
- scalacheckURL :: (List(latestCompFile, latestReflectFile, latestLibFile, latestActorsFile, latestActMigFile, latestPartestFile).map(_.toURI.toURL))
+ scalacheckURL :: (List(latestCompFile, latestReflectFile, latestLibFile, latestActorsFile, latestPartestFile).map(_.toURI.toURL))
)
val kindFiles = onlyValidTestPaths(_kindFiles)
diff --git a/src/partest/scala/tools/partest/nest/FileManager.scala b/src/partest/scala/tools/partest/nest/FileManager.scala
index 512c718040..b6d89177ca 100644
--- a/src/partest/scala/tools/partest/nest/FileManager.scala
+++ b/src/partest/scala/tools/partest/nest/FileManager.scala
@@ -64,7 +64,6 @@ trait FileManager extends FileUtil {
var LATEST_COMP: String
var LATEST_PARTEST: String
var LATEST_ACTORS: String
- var LATEST_ACTORS_MIGRATION: String
var showDiff = false
var updateCheck = false
diff --git a/src/partest/scala/tools/partest/nest/ReflectiveRunner.scala b/src/partest/scala/tools/partest/nest/ReflectiveRunner.scala
index 838bf56d73..99043d8f95 100644
--- a/src/partest/scala/tools/partest/nest/ReflectiveRunner.scala
+++ b/src/partest/scala/tools/partest/nest/ReflectiveRunner.scala
@@ -48,9 +48,9 @@ class ReflectiveRunner {
new ConsoleFileManager
import fileManager.
- { latestCompFile, latestReflectFile, latestLibFile, latestPartestFile, latestFjbgFile, latestScalapFile, latestActorsFile, latestActMigFile }
+ { latestCompFile, latestReflectFile, latestLibFile, latestPartestFile, latestFjbgFile, latestScalapFile, latestActorsFile }
val files =
- Array(latestCompFile, latestReflectFile, latestLibFile, latestPartestFile, latestFjbgFile, latestScalapFile, latestActorsFile, latestActMigFile) map (x => io.File(x))
+ Array(latestCompFile, latestReflectFile, latestLibFile, latestPartestFile, latestFjbgFile, latestScalapFile, latestActorsFile) map (x => io.File(x))
val sepUrls = files map (_.toURL)
var sepLoader = new URLClassLoader(sepUrls, null)
diff --git a/src/partest/scala/tools/partest/nest/SBTRunner.scala b/src/partest/scala/tools/partest/nest/SBTRunner.scala
index 206ee19c76..b0ce6579ac 100644
--- a/src/partest/scala/tools/partest/nest/SBTRunner.scala
+++ b/src/partest/scala/tools/partest/nest/SBTRunner.scala
@@ -17,7 +17,6 @@ object SBTRunner extends DirectRunner {
var LATEST_COMP: String = _
var LATEST_PARTEST: String = _
var LATEST_ACTORS: String = _
- var LATEST_ACTORS_MIGRATION: String = _
val testRootPath: String = "test"
val testRootDir: Directory = Directory(testRootPath)
}
@@ -61,7 +60,6 @@ object SBTRunner extends DirectRunner {
fileManager.LATEST_COMP = findClasspath("scala-compiler", "scala-compiler") getOrElse sys.error("No scala-compiler found! Classpath = " + fileManager.CLASSPATH)
fileManager.LATEST_PARTEST = findClasspath("scala-partest", "partest") getOrElse sys.error("No scala-partest found! Classpath = " + fileManager.CLASSPATH)
fileManager.LATEST_ACTORS = findClasspath("scala-actors", "actors") getOrElse sys.error("No scala-actors found! Classpath = " + fileManager.CLASSPATH)
- fileManager.LATEST_ACTORS_MIGRATION = findClasspath("scala-actors-migration", "actors-migration") getOrElse sys.error("No scala-actors-migration found! Classpath = " + fileManager.CLASSPATH)
// TODO - Do something useful here!!!
fileManager.JAVAC_CMD = "javac"
diff --git a/test/files/jvm/actmig-PinS.check b/test/files/jvm/actmig-PinS.check
deleted file mode 100644
index bdbdf8a692..0000000000
--- a/test/files/jvm/actmig-PinS.check
+++ /dev/null
@@ -1,19 +0,0 @@
-I'm acting!
-I'm acting!
-I'm acting!
-I'm acting!
-I'm acting!
-Post stop
-To be or not to be.
-To be or not to be.
-To be or not to be.
-To be or not to be.
-To be or not to be.
-That is the question.
-That is the question.
-That is the question.
-That is the question.
-That is the question.
-received message: hi there
-received message: 15
-Got an Int: 12
diff --git a/test/files/jvm/actmig-PinS.scala b/test/files/jvm/actmig-PinS.scala
deleted file mode 100644
index 3f07fab12e..0000000000
--- a/test/files/jvm/actmig-PinS.scala
+++ /dev/null
@@ -1,116 +0,0 @@
-/**
- * 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._
-import scala.concurrent.duration._
-import scala.concurrent.{ Promise, Await }
-
-import scala.actors.Actor._
-
-/* PinS, Listing 32.1: A simple actor
- */
-object SillyActor extends Actor {
- def act() {
- for (i <- 1 to 5)
- println("I'm acting!")
-
- println("Post stop")
- }
-}
-
-object SeriousActor extends Actor {
- def act() {
- for (i <- 1 to 5)
- println("To be or not to be.")
- }
-}
-
-/* PinS, Listing 32.3: An actor that calls react
- */
-object NameResolver extends Actor {
- import java.net.{InetAddress, UnknownHostException}
-
- def act() {
- react {
- case (name: String, actor: Actor) =>
- actor ! getIp(name)
- act()
- case "EXIT" =>
- println("Name resolver exiting.")
- // quit
- case msg =>
- println("Unhandled message: " + msg)
- act()
- }
- }
-
- def getIp(name: String): Option[InetAddress] = {
- try {
- Some(InetAddress.getByName(name))
- } catch {
- case _: UnknownHostException => None
- }
- }
-
-}
-
-object Test extends App {
- /* PinS, Listing 32.2: An actor that calls receive
- */
- def makeEchoActor(): Actor = actor {
- while (true) {
- receive {
- case 'stop =>
- exit()
- case msg =>
- println("received message: " + msg)
- }
- }
- }
-
- /* PinS, page 696
- */
- def makeIntActor(): Actor = actor {
- receive {
- case x: Int => // I only want Ints
- println("Got an Int: " + x)
- }
- }
-
- actor {
- self.trapExit = true
- self.link(SillyActor)
- SillyActor.start()
- react {
- case Exit(SillyActor, _) =>
- self.link(SeriousActor)
- SeriousActor.start()
- react {
- case Exit(SeriousActor, _) =>
- val seriousPromise2 = Promise[Boolean]
- // PinS, page 694
- val seriousActor2 = actor {
- for (i <- 1 to 5)
- println("That is the question.")
- seriousPromise2.success(true)
- }
-
- Await.ready(seriousPromise2.future, 5 seconds)
- val echoActor = makeEchoActor()
- self.link(echoActor)
- echoActor ! "hi there"
- echoActor ! 15
- echoActor ! 'stop
- react {
- case Exit(_, _) =>
- val intActor = makeIntActor()
- intActor ! "hello"
- intActor ! math.Pi
- // only the following send leads to output
- intActor ! 12
- }
- }
- }
- }
-}
diff --git a/test/files/jvm/actmig-PinS_1.check b/test/files/jvm/actmig-PinS_1.check
deleted file mode 100644
index bdbdf8a692..0000000000
--- a/test/files/jvm/actmig-PinS_1.check
+++ /dev/null
@@ -1,19 +0,0 @@
-I'm acting!
-I'm acting!
-I'm acting!
-I'm acting!
-I'm acting!
-Post stop
-To be or not to be.
-To be or not to be.
-To be or not to be.
-To be or not to be.
-To be or not to be.
-That is the question.
-That is the question.
-That is the question.
-That is the question.
-That is the question.
-received message: hi there
-received message: 15
-Got an Int: 12
diff --git a/test/files/jvm/actmig-PinS_1.scala b/test/files/jvm/actmig-PinS_1.scala
deleted file mode 100644
index 495852e812..0000000000
--- a/test/files/jvm/actmig-PinS_1.scala
+++ /dev/null
@@ -1,139 +0,0 @@
-/**
- * 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._
-import scala.actors.migration._
-import scala.concurrent.duration._
-import scala.concurrent.{ Promise, Await }
-
-object SillyActor {
- val startPromise = Promise[Boolean]()
- val ref = ActorDSL.actor(new SillyActor)
-}
-
-/* PinS, Listing 32.1: A simple actor
- */
-class SillyActor extends Actor {
-
- def act() {
- Await.ready(SillyActor.startPromise.future, 5 seconds)
- for (i <- 1 to 5)
- println("I'm acting!")
-
- println("Post stop")
- }
-}
-
-object SeriousActor {
- val startPromise = Promise[Boolean]()
- val ref = ActorDSL.actor(new SeriousActor)
-}
-
-class SeriousActor extends Actor {
- def act() {
- // used to make this test deterministic
- Await.ready(SeriousActor.startPromise.future, 5 seconds)
- for (i <- 1 to 5)
- println("To be or not to be.")
- }
-}
-
-/* PinS, Listing 32.3: An actor that calls react
- */
-object NameResolver extends Actor {
- import java.net.{ InetAddress, UnknownHostException }
-
- def act() {
- react {
- case (name: String, actor: Actor) =>
- actor ! getIp(name)
- act()
- case "EXIT" =>
- println("Name resolver exiting.")
- // quit
- case msg =>
- println("Unhandled message: " + msg)
- act()
- }
- }
-
- def getIp(name: String): Option[InetAddress] = {
- try {
- Some(InetAddress.getByName(name))
- } catch {
- case _: UnknownHostException => None
- }
- }
-
-}
-
-object Test extends App {
-
- /* PinS, Listing 32.2: An actor that calls receive
- */
- def makeEchoActor(): ActorRef = ActorDSL.actor(new Actor {
- def act() {
- while (true) {
- receive {
- case 'stop =>
- exit()
- case msg =>
- println("received message: " + msg)
- }
- }
- }
- })
-
- /* PinS, page 696
- */
- def makeIntActor(): ActorRef = ActorDSL.actor(new Actor {
- def act() {
- receive {
- case x: Int => // I only want Ints
- println("Got an Int: " + x)
- }
- }
- })
-
- ActorDSL.actor(new Actor {
- def act() {
- trapExit = true
- link(SillyActor.ref)
- SillyActor.startPromise.success(true)
- react {
- case Exit(_: SillyActor, _) =>
- link(SeriousActor.ref)
- SeriousActor.startPromise.success(true)
- react {
- case Exit(_: SeriousActor, _) =>
- val seriousPromise2 = Promise[Boolean]()
- // PinS, page 694
- val seriousActor2 = ActorDSL.actor(
- new Actor {
- def act() {
- for (i <- 1 to 5)
- println("That is the question.")
- seriousPromise2.success(true)
- }
- })
-
- Await.ready(seriousPromise2.future, 5 seconds)
- val echoActor = makeEchoActor()
- link(echoActor)
- echoActor ! "hi there"
- echoActor ! 15
- echoActor ! 'stop
- react {
- case Exit(_, _) =>
- val intActor = makeIntActor()
- intActor ! "hello"
- intActor ! math.Pi
- // only the following send leads to output
- intActor ! 12
- }
- }
- }
- }
- })
-}
diff --git a/test/files/jvm/actmig-PinS_2.check b/test/files/jvm/actmig-PinS_2.check
deleted file mode 100644
index bdbdf8a692..0000000000
--- a/test/files/jvm/actmig-PinS_2.check
+++ /dev/null
@@ -1,19 +0,0 @@
-I'm acting!
-I'm acting!
-I'm acting!
-I'm acting!
-I'm acting!
-Post stop
-To be or not to be.
-To be or not to be.
-To be or not to be.
-To be or not to be.
-To be or not to be.
-That is the question.
-That is the question.
-That is the question.
-That is the question.
-That is the question.
-received message: hi there
-received message: 15
-Got an Int: 12
diff --git a/test/files/jvm/actmig-PinS_2.scala b/test/files/jvm/actmig-PinS_2.scala
deleted file mode 100644
index 508525463f..0000000000
--- a/test/files/jvm/actmig-PinS_2.scala
+++ /dev/null
@@ -1,159 +0,0 @@
-/**
- * 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._
-import scala.actors.migration._
-import scala.concurrent.duration._
-import scala.concurrent.{ Promise, Await }
-
-object SillyActor {
- val startPromise = Promise[Boolean]()
- val ref = ActorDSL.actor(new SillyActor)
-}
-
-/* PinS, Listing 32.1: A simple actor
- */
-class SillyActor extends StashingActor {
-
- def receive = { case _ => println("Nop") }
-
- override def act() {
- Await.ready(SillyActor.startPromise.future, 5 seconds)
- for (i <- 1 to 5)
- println("I'm acting!")
-
- println("Post stop")
- }
-}
-
-object SeriousActor {
- val startPromise = Promise[Boolean]()
- val ref = ActorDSL.actor(new SeriousActor)
-}
-
-class SeriousActor extends StashingActor {
- def receive = { case _ => println("Nop") }
- override def act() {
- Await.ready(SeriousActor.startPromise.future, 5 seconds)
- for (i <- 1 to 5)
- println("To be or not to be.")
- }
-}
-
-/* PinS, Listing 32.3: An actor that calls react
- */
-object NameResolver {
- val ref = ActorDSL.actor(new NameResolver)
-}
-
-class NameResolver extends StashingActor {
- import java.net.{ InetAddress, UnknownHostException }
-
- def receive = { case _ => println("Nop") }
-
- override def act() {
- react {
- case (name: String, actor: ActorRef) =>
- actor ! getIp(name)
- act()
- case "EXIT" =>
- println("Name resolver exiting.")
- // quit
- case msg =>
- println("Unhandled message: " + msg)
- act()
- }
- }
-
- def getIp(name: String): Option[InetAddress] = {
- try {
- Some(InetAddress.getByName(name))
- } catch {
- case _: UnknownHostException => None
- }
- }
-
-}
-
-object Test extends App {
-
- /* PinS, Listing 32.2: An actor that calls receive
- */
- def makeEchoActor(): ActorRef = ActorDSL.actor(
- new StashingActor {
- def receive = { case _ => println("Nop") }
-
- override def act() {
- loop {
- react {
- case 'stop =>
- exit()
- case msg =>
- println("received message: " + msg)
- }
- }
- }
- })
-
- /* PinS, page 696
- */
- def makeIntActor(): ActorRef = ActorDSL.actor(new StashingActor {
-
- def receive = { case _ => println("Nop") }
-
- override def act() {
- react {
- case x: Int => // I only want Ints
- println("Got an Int: " + x)
- }
- }
- })
-
- ActorDSL.actor(new StashingActor {
-
- def receive = { case _ => println("Nop") }
-
- override def act() {
- trapExit = true
- link(SillyActor.ref)
- SillyActor.startPromise.success(true)
- react {
- case Exit(_: SillyActor, _) =>
- link(SeriousActor.ref)
- SeriousActor.startPromise.success(true)
- react {
- case Exit(_: SeriousActor, _) =>
- val seriousPromise2 = Promise[Boolean]()
- // PinS, page 694
- val seriousActor2 = ActorDSL.actor(
- new StashingActor {
-
- def receive = { case _ => println("Nop") }
-
- override def act() {
- for (i <- 1 to 5)
- println("That is the question.")
- seriousPromise2.success(true)
- }
- })
-
- Await.ready(seriousPromise2.future, 5 seconds)
- val echoActor = makeEchoActor()
- link(echoActor)
- echoActor ! "hi there"
- echoActor ! 15
- echoActor ! 'stop
- react {
- case Exit(_, _) =>
- val intActor = makeIntActor()
- intActor ! "hello"
- intActor ! math.Pi
- // only the following send leads to output
- intActor ! 12
- }
- }
- }
- }
- })
-}
diff --git a/test/files/jvm/actmig-PinS_3.check b/test/files/jvm/actmig-PinS_3.check
deleted file mode 100644
index bdbdf8a692..0000000000
--- a/test/files/jvm/actmig-PinS_3.check
+++ /dev/null
@@ -1,19 +0,0 @@
-I'm acting!
-I'm acting!
-I'm acting!
-I'm acting!
-I'm acting!
-Post stop
-To be or not to be.
-To be or not to be.
-To be or not to be.
-To be or not to be.
-To be or not to be.
-That is the question.
-That is the question.
-That is the question.
-That is the question.
-That is the question.
-received message: hi there
-received message: 15
-Got an Int: 12
diff --git a/test/files/jvm/actmig-PinS_3.scala b/test/files/jvm/actmig-PinS_3.scala
deleted file mode 100644
index 6c6ec6789b..0000000000
--- a/test/files/jvm/actmig-PinS_3.scala
+++ /dev/null
@@ -1,164 +0,0 @@
-/**
- * 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._
-import scala.actors.migration._
-import scala.concurrent.duration._
-import scala.concurrent.{ Promise, Await }
-
-object SillyActor {
- val startPromise = Promise[Boolean]()
- val ref = ActorDSL.actor(new SillyActor)
-}
-
-/* PinS, Listing 32.1: A simple actor
- */
-class SillyActor extends StashingActor {
- def receive = { case _ => println("Why are you not dead"); context.stop(self) }
-
- override def preStart() {
- Await.ready(SillyActor.startPromise.future, 5 seconds)
- for (i <- 1 to 5)
- println("I'm acting!")
- context.stop(self)
- }
-
- override def postStop() {
- println("Post stop")
- }
-}
-
-object SeriousActor {
- val startPromise = Promise[Boolean]()
- val ref = ActorDSL.actor(new SeriousActor)
-}
-
-class SeriousActor extends StashingActor {
- def receive = { case _ => println("Nop") }
- override def preStart() {
- Await.ready(SeriousActor.startPromise.future, 5 seconds)
- for (i <- 1 to 5)
- println("To be or not to be.")
- context.stop(self)
- }
-}
-
-/* PinS, Listing 32.3: An actor that calls react
- */
-object NameResolver {
- val ref = ActorDSL.actor(new NameResolver)
-}
-
-class NameResolver extends StashingActor {
- import java.net.{ InetAddress, UnknownHostException }
-
- def receive = {
- case (name: String, actor: ActorRef) =>
- actor ! getIp(name)
- case "EXIT" =>
- println("Name resolver exiting.")
- context.stop(self) // quit
- case msg =>
- println("Unhandled message: " + msg)
- }
-
- def getIp(name: String): Option[InetAddress] = {
- try {
- Some(InetAddress.getByName(name))
- } catch {
- case _: UnknownHostException => None
- }
- }
-
-}
-
-object Test extends App {
-
- /* PinS, Listing 32.2: An actor that calls receive
- */
- def makeEchoActor(): ActorRef = ActorDSL.actor(new StashingActor {
-
- def receive = { // how to handle receive
- case 'stop =>
- context.stop(self)
- case msg =>
- println("received message: " + msg)
- }
- })
-
- /* PinS, page 696
- */
- def makeIntActor(): ActorRef = ActorDSL.actor(new StashingActor {
-
- def receive = {
- case x: Int => // I only want Ints
- unstashAll()
- println("Got an Int: " + x)
- context.stop(self)
- case _ => stash()
- }
- })
-
- ActorDSL.actor(new StashingActor {
- val silly = SillyActor.ref
-
- override def preStart() {
- context.watch(SillyActor.ref)
- SillyActor.startPromise.success(true)
- }
-
- def receive = {
- case Terminated(`silly`) =>
- unstashAll()
- val serious = SeriousActor.ref
- context.watch(SeriousActor.ref)
- SeriousActor.startPromise.success(true)
- context.become {
- case Terminated(`serious`) =>
- val seriousPromise2 = Promise[Boolean]()
- // PinS, page 694
- val seriousActor2 = ActorDSL.actor(
- new StashingActor {
-
- def receive = { case _ => context.stop(self) }
-
- override def preStart() = {
- for (i <- 1 to 5)
- println("That is the question.")
- seriousPromise2.success(true)
- context.stop(self)
- }
- })
-
- Await.ready(seriousPromise2.future, 5 seconds)
- val echoActor = makeEchoActor()
- context.watch(echoActor)
- echoActor ! "hi there"
- echoActor ! 15
- echoActor ! 'stop
- context.become {
- case Terminated(_) =>
- unstashAll()
- val intActor = makeIntActor()
- intActor ! "hello"
- intActor ! math.Pi
- // only the following send leads to output
- intActor ! 12
- context.unbecome()
- context.unbecome()
- context.stop(self)
- case m =>
- println("Stash 1 " + m)
- stash(m)
- }
- case m =>
- println("Stash 2 " + m)
- stash(m)
- }
- case m =>
- println("Stash 3 " + m)
- stash(m)
- }
- })
-}
diff --git a/test/files/jvm/actmig-hierarchy.check b/test/files/jvm/actmig-hierarchy.check
deleted file mode 100644
index 317e9677c3..0000000000
--- a/test/files/jvm/actmig-hierarchy.check
+++ /dev/null
@@ -1,2 +0,0 @@
-hello
-hello
diff --git a/test/files/jvm/actmig-hierarchy.scala b/test/files/jvm/actmig-hierarchy.scala
deleted file mode 100644
index 17a44fda7a..0000000000
--- a/test/files/jvm/actmig-hierarchy.scala
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- * 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._
-
-
-class ReactorActor extends Reactor[String] {
- def act() {
- var cond = true
- loopWhile(cond) {
- react {
- case x if x == "hello1" => println("hello")
- case "exit" => cond = false
- }
- }
- }
-}
-
-class ReplyActor extends ReplyReactor {
- def act() {
- var cond = true
- loopWhile(cond) {
- react {
- case "hello" => println("hello")
- case "exit" => cond = false;
- }
- }
- }
-}
-
-
-object Test {
-
- def main(args: Array[String]) {
- val reactorActor = new ReactorActor
- val replyActor = new ReplyActor
- reactorActor.start()
- replyActor.start()
-
- reactorActor ! "hello1"
- replyActor ! "hello"
-
- reactorActor ! "exit"
- replyActor ! "exit"
- }
-} \ No newline at end of file
diff --git a/test/files/jvm/actmig-hierarchy_1.check b/test/files/jvm/actmig-hierarchy_1.check
deleted file mode 100644
index 317e9677c3..0000000000
--- a/test/files/jvm/actmig-hierarchy_1.check
+++ /dev/null
@@ -1,2 +0,0 @@
-hello
-hello
diff --git a/test/files/jvm/actmig-hierarchy_1.scala b/test/files/jvm/actmig-hierarchy_1.scala
deleted file mode 100644
index 14f03c9d48..0000000000
--- a/test/files/jvm/actmig-hierarchy_1.scala
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- * 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._
-
-class ReactorActor extends Actor {
- def act() {
- var cond = true
- loopWhile(cond) {
- react {
- case x: String if x == "hello1" => println("hello")
- case "exit" => cond = false
- }
- }
- }
-}
-
-class ReplyActor extends Actor {
- def act() {
- var cond = true
- loopWhile(cond) {
- react {
- case "hello" => println("hello")
- case "exit" => cond = false;
- }
- }
- }
-}
-
-object Test {
-
- def main(args: Array[String]) {
- val reactorActor = new ReactorActor
- val replyActor = new ReplyActor
- reactorActor.start()
- replyActor.start()
-
- reactorActor ! "hello1"
- replyActor ! "hello"
-
- reactorActor ! "exit"
- replyActor ! "exit"
- }
-} \ No newline at end of file
diff --git a/test/files/jvm/actmig-instantiation.check b/test/files/jvm/actmig-instantiation.check
deleted file mode 100644
index 08ef979794..0000000000
--- a/test/files/jvm/actmig-instantiation.check
+++ /dev/null
@@ -1,8 +0,0 @@
-OK error: java.lang.RuntimeException: In order to create a StashingActor one must use the ActorDSL object
-OK error: java.lang.RuntimeException: Cannot create more than one actor
-0
-100
-200
-300
-400
-500
diff --git a/test/files/jvm/actmig-instantiation.scala b/test/files/jvm/actmig-instantiation.scala
deleted file mode 100644
index 2e3ffc3c30..0000000000
--- a/test/files/jvm/actmig-instantiation.scala
+++ /dev/null
@@ -1,95 +0,0 @@
-/**
- * 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._
-import scala.actors.Actor._
-import scala.actors._
-import java.util.concurrent.{ TimeUnit, CountDownLatch }
-import scala.collection.mutable.ArrayBuffer
-
-class TestStashingActor extends StashingActor {
-
- def receive = { case v: Int => Test.append(v); Test.latch.countDown() }
-
-}
-
-object Test {
- val NUMBER_OF_TESTS = 5
-
- // used for sorting non-deterministic output
- val buff = ArrayBuffer[Int](0)
- val latch = new CountDownLatch(NUMBER_OF_TESTS)
- val toStop = ArrayBuffer[ActorRef]()
-
- def append(v: Int) = synchronized {
- buff += v
- }
-
- def main(args: Array[String]) = {
- // plain scala actor
- val a1 = actor {
- react { case v: Int => Test.append(v); Test.latch.countDown() }
- }
- a1 ! 100
-
- // simple instantiation
- val a2 = ActorDSL.actor(new TestStashingActor)
- a2 ! 200
- toStop += a2
-
- // actor of with scala actor
- val a3 = ActorDSL.actor(actor {
- react { case v: Int => Test.append(v); Test.latch.countDown() }
- })
- a3 ! 300
-
- // using the manifest
- val a4 = ActorDSL.actor(new TestStashingActor)
- a4 ! 400
- toStop += a4
-
- // deterministic part of a test
- // creation without actor
- try {
- val a3 = new TestStashingActor
- a3 ! -1
- } catch {
- case e: Throwable => println("OK error: " + e)
- }
-
- // actor double creation
- try {
- val a3 = ActorDSL.actor({
- new TestStashingActor
- new TestStashingActor
- })
- a3 ! -1
- } catch {
- case e: Throwable => println("OK error: " + e)
- }
-
- // actor nesting
- try {
- val a5 = ActorDSL.actor({
- val a6 = ActorDSL.actor(new TestStashingActor)
- toStop += a6
- new TestStashingActor
- })
-
- a5 ! 500
- toStop += a5
- } catch {
- case e: Throwable => println("Should not throw an exception: " + e)
- }
-
- // output
- latch.await(5, TimeUnit.SECONDS)
- if (latch.getCount() > 0) {
- println("Error: Tasks have not finished!!!")
- }
-
- buff.sorted.foreach(println)
- toStop.foreach(_ ! PoisonPill)
- }
-}
diff --git a/test/files/jvm/actmig-loop-react.check b/test/files/jvm/actmig-loop-react.check
deleted file mode 100644
index 2474cbe71b..0000000000
--- a/test/files/jvm/actmig-loop-react.check
+++ /dev/null
@@ -1,16 +0,0 @@
-do task
-do task
-do task
-do task
-working
-scala got exception
-working
-akka got exception
-do task 1
-do string I am a String
-do task 42
-after react
-do task 1
-do string I am a String
-do task 42
-after react
diff --git a/test/files/jvm/actmig-loop-react.scala b/test/files/jvm/actmig-loop-react.scala
deleted file mode 100644
index c9a3664526..0000000000
--- a/test/files/jvm/actmig-loop-react.scala
+++ /dev/null
@@ -1,195 +0,0 @@
-/**
- * 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.Actor._
-import scala.actors._
-import scala.actors.migration._
-import java.util.concurrent.{ TimeUnit, CountDownLatch }
-import scala.collection.mutable.ArrayBuffer
-import scala.concurrent.duration._
-import scala.concurrent.{ Promise, Await }
-
-object Test {
- val finishedLWCR, finishedTNR, finishedEH = Promise[Boolean]
- val finishedLWCR1, finishedTNR1, finishedEH1 = Promise[Boolean]
-
- def testLoopWithConditionReact() = {
- // Snippet showing composition of receives
- // Loop with Condition Snippet - before
- val myActor = actor {
- var c = true
- loopWhile(c) {
- react {
- case x: Int =>
- // do task
- println("do task")
- if (x == 42) {
- c = false
- finishedLWCR1.success(true)
- }
- }
- }
- }
-
- myActor.start()
- myActor ! 1
- myActor ! 42
-
- Await.ready(finishedLWCR1.future, 5 seconds)
-
- // Loop with Condition Snippet - migrated
- val myAkkaActor = ActorDSL.actor(new StashingActor {
-
- def receive = {
- case x: Int =>
- // do task
- println("do task")
- if (x == 42) {
- finishedLWCR.success(true)
- context.stop(self)
- }
- }
- })
- myAkkaActor ! 1
- myAkkaActor ! 42
- }
-
- def testNestedReact() = {
- // Snippet showing composition of receives
- // Loop with Condition Snippet - before
- val myActor = actor {
- var c = true
- loopWhile(c) {
- react {
- case x: Int =>
- // do task
- println("do task " + x)
- if (x == 42) {
- c = false
- } else {
- react {
- case y: String =>
- println("do string " + y)
- }
- }
- println("after react")
- finishedTNR1.success(true)
- }
- }
- }
- myActor.start()
-
- myActor ! 1
- myActor ! "I am a String"
- myActor ! 42
-
- Await.ready(finishedTNR1.future, 5 seconds)
-
- // Loop with Condition Snippet - migrated
- val myAkkaActor = ActorDSL.actor(new StashingActor {
-
- def receive = {
- case x: Int =>
- // do task
- println("do task " + x)
- if (x == 42) {
- println("after react")
- finishedTNR.success(true)
- context.stop(self)
- } else
- context.become(({
- case y: String =>
- println("do string " + y)
- }: Receive).andThen(x => {
- unstashAll()
- context.unbecome()
- }).orElse { case x => stash() })
- }
- })
-
- myAkkaActor ! 1
- myAkkaActor ! "I am a String"
- myAkkaActor ! 42
-
- }
-
- def exceptionHandling() = {
- // Stashing actor with act and exception handler
- val myActor = ActorDSL.actor(new StashingActor {
-
- def receive = { case _ => println("Dummy method.") }
- override def act() = {
- loop {
- react {
- case "fail" =>
- throw new Exception("failed")
- case "work" =>
- println("working")
- case "die" =>
- finishedEH1.success(true)
- exit()
- }
- }
- }
-
- override def exceptionHandler = {
- case x: Exception => println("scala got exception")
- }
-
- })
-
- myActor ! "work"
- myActor ! "fail"
- myActor ! "die"
-
- Await.ready(finishedEH1.future, 5 seconds)
- // Stashing actor in Akka style
- val myAkkaActor = ActorDSL.actor(new StashingActor {
- def receive = PFCatch({
- case "fail" =>
- throw new Exception("failed")
- case "work" =>
- println("working")
- case "die" =>
- finishedEH.success(true)
- context.stop(self)
- }, { case x: Exception => println("akka got exception") })
- })
-
- myAkkaActor ! "work"
- myAkkaActor ! "fail"
- myAkkaActor ! "die"
- }
-
- def main(args: Array[String]): Unit = {
- testLoopWithConditionReact()
- Await.ready(finishedLWCR.future, 5 seconds)
- exceptionHandling()
- Await.ready(finishedEH.future, 5 seconds)
- testNestedReact()
- Await.ready(finishedTNR.future, 5 seconds)
- }
-
-}
-
-// As per Jim Mcbeath's blog (http://jim-mcbeath.blogspot.com/2008/07/actor-exceptions.html)
-class PFCatch(f: PartialFunction[Any, Unit],
- handler: PartialFunction[Exception, Unit])
- extends PartialFunction[Any, Unit] {
-
- def apply(x: Any) = {
- try {
- f(x)
- } catch {
- case e: Exception if handler.isDefinedAt(e) => handler(e)
- }
- }
-
- def isDefinedAt(x: Any) = f.isDefinedAt(x)
-}
-
-object PFCatch {
- def apply(f: PartialFunction[Any, Unit],
- handler: PartialFunction[Exception, Unit]) = new PFCatch(f, handler)
-}
diff --git a/test/files/jvm/actmig-public-methods.check b/test/files/jvm/actmig-public-methods.check
deleted file mode 100644
index c861c90e63..0000000000
--- a/test/files/jvm/actmig-public-methods.check
+++ /dev/null
@@ -1,6 +0,0 @@
-None
-Some(bang qmark after 1)
-bang
-bang bang in the future after 0
-bang qmark after 0
-typed bang bang in the future after 0
diff --git a/test/files/jvm/actmig-public-methods.scala b/test/files/jvm/actmig-public-methods.scala
deleted file mode 100644
index 8891c80668..0000000000
--- a/test/files/jvm/actmig-public-methods.scala
+++ /dev/null
@@ -1,73 +0,0 @@
-/**
- * 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.collection.mutable.ArrayBuffer
-import scala.actors.Actor._
-import scala.actors._
-import scala.util.continuations._
-import java.util.concurrent.{ TimeUnit, CountDownLatch }
-
-object Test {
- val NUMBER_OF_TESTS = 6
-
- // used for sorting non-deterministic output
- val buff = ArrayBuffer[String]()
- val latch = new CountDownLatch(NUMBER_OF_TESTS)
- val toStop = ArrayBuffer[Actor]()
-
- def append(v: String) = synchronized {
- buff += v
- }
-
- def main(args: Array[String]) = {
-
- val respActor = actor {
- loop {
- react {
- case (x: String, time: Long) =>
- Thread.sleep(time)
- reply(x + " after " + time)
- case str: String =>
- append(str)
- latch.countDown()
- case _ => exit()
- }
- }
- }
-
- toStop += respActor
-
- respActor ! ("bang")
-
- val res1 = respActor !? (("bang qmark", 0L))
- append(res1.toString)
- latch.countDown()
-
- val res2 = respActor !? (5000, ("bang qmark", 1L))
- append(res2.toString)
- latch.countDown()
-
- // this one should timeout
- val res21 = respActor !? (1, ("bang qmark", 5000L))
- append(res21.toString)
- latch.countDown()
-
- val fut1 = respActor !! (("bang bang in the future", 0L))
- append(fut1().toString())
- latch.countDown()
-
- val fut2 = respActor !! (("typed bang bang in the future", 0L), { case x: String => x })
- append(fut2())
- latch.countDown()
-
- // output
- latch.await(10, TimeUnit.SECONDS)
- if (latch.getCount() > 0) {
- println("Error: Tasks have not finished!!!")
- }
-
- buff.sorted.foreach(println)
- toStop.foreach(_ ! 'stop)
- }
-}
diff --git a/test/files/jvm/actmig-public-methods_1.check b/test/files/jvm/actmig-public-methods_1.check
deleted file mode 100644
index c861c90e63..0000000000
--- a/test/files/jvm/actmig-public-methods_1.check
+++ /dev/null
@@ -1,6 +0,0 @@
-None
-Some(bang qmark after 1)
-bang
-bang bang in the future after 0
-bang qmark after 0
-typed bang bang in the future after 0
diff --git a/test/files/jvm/actmig-public-methods_1.scala b/test/files/jvm/actmig-public-methods_1.scala
deleted file mode 100644
index db21ab983c..0000000000
--- a/test/files/jvm/actmig-public-methods_1.scala
+++ /dev/null
@@ -1,104 +0,0 @@
-/**
- * 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.collection.mutable.ArrayBuffer
-import scala.actors.Actor._
-import scala.actors._
-import scala.actors.migration._
-import scala.util._
-import scala.concurrent._
-import scala.concurrent.duration._
-import java.util.concurrent.{ TimeUnit, CountDownLatch }
-import scala.concurrent.duration._
-import scala.actors.migration.pattern._
-import scala.concurrent.ExecutionContext.Implicits.global
-
-object Test {
- val NUMBER_OF_TESTS = 6
-
- // used for sorting non-deterministic output
- val buff = ArrayBuffer[String]()
- val latch = new CountDownLatch(NUMBER_OF_TESTS)
- val toStop = ArrayBuffer[ActorRef]()
-
- def append(v: String) = synchronized {
- buff += v
- }
-
- def main(args: Array[String]) = {
-
- val respActor = ActorDSL.actor(actor {
- loop {
- react {
- case (x: String, time: Long) =>
- Thread.sleep(time)
- reply(x + " after " + time)
- case str: String =>
- append(str)
- latch.countDown()
- case x =>
- exit()
- }
- }
- })
-
- toStop += respActor
-
- respActor ! "bang"
-
- {
- val msg = ("bang qmark", 0L)
- val res = respActor.?(msg)(Timeout(Duration.Inf))
- append(Await.result(res, Duration.Inf).toString)
- latch.countDown()
- }
-
- {
- val msg = ("bang qmark", 1L)
- val res = respActor.?(msg)(Timeout(5 seconds))
-
- val promise = Promise[Option[Any]]()
- res.onComplete(v => promise.success(v.toOption))
- append(Await.result(promise.future, Duration.Inf).toString)
-
- latch.countDown()
- }
-
- {
- val msg = ("bang qmark", 5000L)
- val res = respActor.?(msg)(Timeout(1 millisecond))
- val promise = Promise[Option[Any]]()
- res.onComplete(v => promise.success(v.toOption))
- append(Await.result(promise.future, Duration.Inf).toString)
- latch.countDown()
- }
-
- {
- val msg = ("bang bang in the future", 0L)
- val fut = respActor.?(msg)(Timeout(Duration.Inf))
- append(Await.result(fut, Duration.Inf).toString)
- latch.countDown()
- }
-
- {
- val handler: PartialFunction[Any, String] = {
- case x: String => x
- }
-
- val msg = ("typed bang bang in the future", 0L)
- val fut = (respActor.?(msg)(Timeout(Duration.Inf)))
- append((Await.result(fut.map(handler), Duration.Inf)).toString)
- latch.countDown()
- }
-
- // output
- latch.await(10, TimeUnit.SECONDS)
- if (latch.getCount() > 0) {
- println("Error: Tasks have not finished!!!")
- }
-
- buff.sorted.foreach(println)
- toStop.foreach(_ ! PoisonPill)
- }
-}
diff --git a/test/files/jvm/actmig-react-receive.check b/test/files/jvm/actmig-react-receive.check
deleted file mode 100644
index cc2a426e68..0000000000
--- a/test/files/jvm/actmig-react-receive.check
+++ /dev/null
@@ -1,16 +0,0 @@
-do before
-do task
-do after
-do before
-do task
-do after
-do before
-do task
-do in between
-do string
-do after
-do before
-do task
-do in between
-do string
-do after
diff --git a/test/files/jvm/actmig-react-receive.scala b/test/files/jvm/actmig-react-receive.scala
deleted file mode 100644
index bf70ce0c46..0000000000
--- a/test/files/jvm/actmig-react-receive.scala
+++ /dev/null
@@ -1,115 +0,0 @@
-/**
- * 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.Actor._
-import scala.actors._
-import scala.actors.migration._
-import java.util.concurrent.{ TimeUnit, CountDownLatch }
-import scala.collection.mutable.ArrayBuffer
-import scala.concurrent.duration._
-import scala.concurrent.{ Promise, Await }
-
-object Test {
- val finishedRS, finishedRS1, finishedRSC, finishedRSC1 = Promise[Boolean]
- def testComposition() = {
- // Snippet showing composition of receives
- // React Snippet - before
- val myActor = actor {
- // do before
- println("do before")
- receive {
- case x: Int =>
- // do task
- println("do task")
- }
- println("do in between")
- receive {
- case x: String =>
- // do string now
- println("do string")
- }
- println("do after")
- finishedRSC1.success(true)
- }
- myActor.start()
- myActor ! 1
- myActor ! "1"
- Await.ready(finishedRSC1.future, 5 seconds)
-
- // React Snippet - migrated
- val myAkkaActor = ActorDSL.actor(new StashingActor {
- override def preStart() = {
- println("do before")
- }
-
- def receive = ({
- case x: Int =>
- // do task
- println("do task")
- }: Receive) andThen { v =>
- context.become {
- case x: String =>
- //do string
- println("do string")
- context.stop(self)
- }
- println("do in between")
- }
-
- override def postStop() = {
- println("do after")
- finishedRSC.success(true)
- }
-
- })
- myAkkaActor ! 1
- myAkkaActor ! "1"
- Await.ready(finishedRSC.future, 5 seconds)
- }
-
- def main(args: Array[String]) = {
- // React Snippet - before
- val myActor = actor {
- // do before
- println("do before")
- receive {
- case x: Int =>
- // do task
- println("do task")
- }
- println("do after")
- finishedRS1.success(true)
- }
- myActor.start()
- myActor ! 1
-
- Await.ready(finishedRS1.future, 5 seconds)
-
- // React Snippet - migrated
- val myAkkaActor = ActorDSL.actor(new StashingActor {
- override def preStart() = {
- println("do before")
- }
-
- def receive = {
- case x: Int =>
- // do task
- println("do task")
- context.stop(self)
- }
-
- override def postStop() = {
- println("do after")
- finishedRS.success(true)
- }
-
- })
- myAkkaActor ! 1
-
- Await.ready(finishedRS.future, 5 seconds)
- // Starting composition test
- testComposition()
-
- }
-}
diff --git a/test/files/jvm/actmig-react-within.check b/test/files/jvm/actmig-react-within.check
deleted file mode 100644
index 57798dbefb..0000000000
--- a/test/files/jvm/actmig-react-within.check
+++ /dev/null
@@ -1,2 +0,0 @@
-received
-received
diff --git a/test/files/jvm/actmig-react-within.scala b/test/files/jvm/actmig-react-within.scala
deleted file mode 100644
index 3057398cb5..0000000000
--- a/test/files/jvm/actmig-react-within.scala
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- * 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.Actor._
-import scala.actors._
-import scala.actors.migration._
-import java.util.concurrent.{ TimeUnit, CountDownLatch }
-import scala.collection.mutable.ArrayBuffer
-import scala.concurrent.duration._
-import scala.concurrent.{ Promise, Await }
-
-object Test {
- val finished = Promise[Boolean]
-
- def testReactWithin() = {
- val sActor = actor {
- loop {
- reactWithin(1) {
- case scala.actors.TIMEOUT =>
- println("received")
- exit()
- case _ =>
- println("Should not occur.")
- }
- }
- }
-
- val myActor = ActorDSL.actor(new StashingActor {
- context.setReceiveTimeout(1 millisecond)
- def receive = {
- case ReceiveTimeout =>
- println("received")
- finished.success(true)
- context.stop(self)
- case _ =>
- println("Should not occur.")
- }
- })
- }
-
- def main(args: Array[String]) = {
- testReactWithin()
- Await.ready(finished.future, 5 seconds)
- }
-
-}
diff --git a/test/files/jvm/actmig-receive.check b/test/files/jvm/actmig-receive.check
deleted file mode 100644
index 30886140e1..0000000000
--- a/test/files/jvm/actmig-receive.check
+++ /dev/null
@@ -1,27 +0,0 @@
-Original
-do before
-receive 1
-do in between
-receive 1
-do after
-Transformed
-do before
-receive 1
-do in between
-receive 1
-do after
-Test Loop Receive
-Original
-do before body
-receive 1
-do after receive
-do before body
-do after receive
-after loop
-Transformed
-do before body
-receive 1
-do after receive
-do before body
-do after receive
-after loop
diff --git a/test/files/jvm/actmig-receive.scala b/test/files/jvm/actmig-receive.scala
deleted file mode 100644
index 308643cf41..0000000000
--- a/test/files/jvm/actmig-receive.scala
+++ /dev/null
@@ -1,119 +0,0 @@
-/**
- * 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.Actor._
-import scala.actors._
-import scala.actors.migration._
-import java.util.concurrent.{ TimeUnit, CountDownLatch }
-import scala.collection.mutable.ArrayBuffer
-import scala.concurrent.duration._
-import scala.concurrent.{ Promise, Await }
-
-object Test {
- val finishedSingle, finishedSingle1, finishedLoop, finishedLoop1 = Promise[Boolean]
-
- def testDoubleReceive() = {
- println("Original")
- // Snippet that shows how to get rid of receive calls in Scala Actors.
- // This snippet is used in the Actors Migration Kit.
- val myActor = actor {
- println("do before")
- receive {
- case "hello" =>
- println("receive 1")
- }
- println("do in between")
- receive {
- case "hello" =>
- println("receive 1")
- }
- println("do after")
- finishedSingle.success(true)
- }
-
- myActor ! "hello"
- myActor ! "hello"
-
- Await.ready(finishedSingle.future, 5 seconds)
- println("Transformed")
- val myActorReact = actor {
- println("do before")
- react (({
- case "hello" =>
- println("receive 1")
- }: PartialFunction[Any, Unit]).andThen { x =>
- println("do in between")
- react (({
- case "hello" =>
- println("receive 1")
- }: PartialFunction[Any, Unit]).andThen { x =>
- println("do after")
- finishedSingle1.success(true)
- })
- })
- }
-
- myActorReact ! "hello"
- myActorReact ! "hello"
-
- Await.ready(finishedSingle1.future, 5 seconds)
- }
-
- def testLoopReceive() = {
- println("Test Loop Receive")
- // Snippet that shows how to get rid of receive calls in loops.
- // This snippet is used in the Actors Migration Kit.
- println("Original")
- val myActor = actor {
- var c = true
- while (c) {
- println("do before body")
- receive {
- case "hello" =>
- println("receive 1")
- case "exit" =>
- c = false
- }
- println("do after receive")
- }
- println("after loop")
- finishedLoop.success(true)
- }
-
- myActor ! "hello"
- myActor ! "exit"
- Await.ready(finishedLoop.future, 5 seconds)
- println("Transformed")
-
- val myActorReact = actor {
- var c = true
- loopWhile(c) {
- println("do before body")
- react (({
- case "hello" =>
- println("receive 1")
- case "exit" =>
- c = false
- }: PartialFunction[Any, Unit]).andThen { x =>
- println("do after receive")
- if (c == false) {
- println("after loop")
- finishedLoop1.success(true)
- }
- })
- }
- }
-
- myActorReact ! "hello"
- myActorReact ! "exit"
-
- Await.ready(finishedLoop1.future, 5 seconds)
- }
-
- def main(args: Array[String]) = {
- testDoubleReceive()
- testLoopReceive()
- }
-
-}