Skip to content

Instantly share code, notes, and snippets.

@seanparsons
Created January 30, 2011 23:46
Show Gist options
  • Save seanparsons/803431 to your computer and use it in GitHub Desktop.
Save seanparsons/803431 to your computer and use it in GitHub Desktop.
val supervisor = Supervisor(SupervisorConfig(
AllForOneStrategy(List(classOf[IllegalStateException]), Some(3), Some(1000)),
Supervise(actorOf[BrokenActor], Permanent) :: Nil
))
supervisor.start
val brokenActor = supervisor.children.head
printlnRequestResult(brokenActor, 1)
printlnRequestResult(brokenActor, 5)
try {
printlnRequestResult(brokenActor, 20)
} catch {
case _=> println("Expected exception thrown.")
}
printlnRequestResult(brokenActor, 5)
// Output is:
// Request = 1, Result = Some(1)
// Request = 5, Result = Some(6)
// Expected exception thrown.
// Creating new BrokenLibrary.
// Request = 5, Result = Some(5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment