diff options
author | Vojin Jovanovic <vojin.jovanovic@epfl.ch> | 2012-08-03 18:07:35 +0200 |
---|---|---|
committer | Vojin Jovanovic <vojin.jovanovic@epfl.ch> | 2012-09-12 11:48:26 +0200 |
commit | 518a8e2c57c92f38932fabad50bd8e91f04fcfb3 (patch) | |
tree | e27324dd97f7e128c2a61cdad7ebb28056388002 /test/files/jvm/actmig-react-within.scala | |
parent | 930c85d6c96507d798d1847ea078eebf93dc0acb (diff) | |
download | scala-518a8e2c57c92f38932fabad50bd8e91f04fcfb3.tar.gz scala-518a8e2c57c92f38932fabad50bd8e91f04fcfb3.tar.bz2 scala-518a8e2c57c92f38932fabad50bd8e91f04fcfb3.zip |
Additional Actor Migration test cases.
Diffstat (limited to 'test/files/jvm/actmig-react-within.scala')
-rw-r--r-- | test/files/jvm/actmig-react-within.scala | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/test/files/jvm/actmig-react-within.scala b/test/files/jvm/actmig-react-within.scala new file mode 100644 index 0000000000..f0326f885d --- /dev/null +++ b/test/files/jvm/actmig-react-within.scala @@ -0,0 +1,43 @@ +import scala.actors.MigrationSystem._ +import scala.actors.Actor._ +import scala.actors.{ Actor, StashingActor, ActorRef, Props, MigrationSystem, PoisonPill } +import java.util.concurrent.{ TimeUnit, CountDownLatch } +import scala.collection.mutable.ArrayBuffer +import scala.concurrent.util.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 = MigrationSystem.actorOf(Props(() => new StashingActor { + context.setReceiveTimeout(1 millisecond) + def receive = { + case ReceiveTimeout => + println("received") + finished.success(true) + context.stop(self) + case _ => + println("Should not occur.") + } + }, "default-stashing-dispatcher")) + } + + def main(args: Array[String]) = { + testReactWithin() + Await.ready(finished.future, 5 seconds) + } + +}
\ No newline at end of file |