From 54280decdb166ab8e32aba9c3877a2ea85e51465 Mon Sep 17 00:00:00 2001 From: Viktor Klang Date: Tue, 25 Jan 2011 16:23:50 +0100 Subject: [PATCH] Potential fix for #628 and #629 --- .../typed-actor/TypedActorLifecycleSpec.scala | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/akka-typed-actor/src/test/scala/actor/typed-actor/TypedActorLifecycleSpec.scala b/akka-typed-actor/src/test/scala/actor/typed-actor/TypedActorLifecycleSpec.scala index 7478f2566a..1e38e7034b 100644 --- a/akka-typed-actor/src/test/scala/actor/typed-actor/TypedActorLifecycleSpec.scala +++ b/akka-typed-actor/src/test/scala/actor/typed-actor/TypedActorLifecycleSpec.scala @@ -113,5 +113,31 @@ class TypedActorLifecycleSpec extends Spec with ShouldMatchers with BeforeAndAft conf.stop } } + + it("should be restarted when supervision handles the problem in") { + val actorSupervision = new SuperviseTypedActor(classOf[TypedActorFailer],classOf[TypedActorFailerImpl],permanent(),30000) + val conf = new TypedActorConfigurator().configure(OneForOneStrategy(classOf[Throwable] :: Nil, 3, 500000), Array(actorSupervision)).inject.supervise + try { + val first = conf.getInstance(classOf[TypedActorFailer]) + try { + first.fail + fail("shouldn't get here") + } catch { + case r: RuntimeException if r.getMessage == "expected" => //expected + } + val second = conf.getInstance(classOf[TypedActorFailer]) + + first should be (second) + + try { + first.fail + fail("shouldn't get here") + } catch { + case r: RuntimeException if r.getMessage == "expected" => //expected + } + } finally { + conf.stop + } + } } }