diff options
Diffstat (limited to 'test/disabled/jvm/reactor-exceptionOnSend.scala')
-rw-r--r-- | test/disabled/jvm/reactor-exceptionOnSend.scala | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/test/disabled/jvm/reactor-exceptionOnSend.scala b/test/disabled/jvm/reactor-exceptionOnSend.scala new file mode 100644 index 0000000000..3684943b9b --- /dev/null +++ b/test/disabled/jvm/reactor-exceptionOnSend.scala @@ -0,0 +1,44 @@ +import scala.actors.Reactor +import scala.actors.Actor._ + +case class MyException(text: String) extends Exception(text) + +object A extends Reactor { + override def exceptionHandler = { + case MyException(text) => + println("receiver handles exception") + } + + def guard(): Boolean = + if (state == 0) { + state = 1 + throw MyException("illegal state") + } else + true + + var state = 0 + + def act() { + loop { + react { + case 'hello if guard() => + println("process") + exit() + } + } + } +} + +object B extends Reactor { + def act() { + A.start() + A ! 'hello + A ! 'hello + } +} + +object Test { + def main(args: Array[String]) { + B.start() + } +} |