Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import scala.actors.Actor
- class Foo extends Exception
- class MyActor extends Actor {
- def act {
- loop {
- react {
- case x =>
- try {
- x match {
- case "die" => throw new Foo
- case _ => println("nothing...")
- }
- } catch {
- case _ => println("got exception")
- }
- }
- }
- }
- }
- object App {
- def main(args: Array[String]): Unit = {
- val a = new MyActor
- println("starting actor...")
- a.start
- a ! "hello"
- a ! "die"
- a ! "hello"
- }
- }
Add Comment
Please, Sign In to add comment