From 70ec85b084d4a6ef23346e7c7a2c2b26fdae484b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Antonsson?= Date: Thu, 30 Aug 2012 15:21:51 +0200 Subject: [PATCH] Clear out interrupted flag before we recurse. See #2454 --- .../main/scala/akka/testkit/CallingThreadDispatcher.scala | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/akka-testkit/src/main/scala/akka/testkit/CallingThreadDispatcher.scala b/akka-testkit/src/main/scala/akka/testkit/CallingThreadDispatcher.scala index 04d344b707..f47fa1acb6 100644 --- a/akka-testkit/src/main/scala/akka/testkit/CallingThreadDispatcher.scala +++ b/akka-testkit/src/main/scala/akka/testkit/CallingThreadDispatcher.scala @@ -237,11 +237,15 @@ class CallingThreadDispatcher( try { if (Mailbox.debug) println(mbox.actor.self + " processing message " + handle) mbox.actor.invoke(handle) + if (Thread.interrupted()) { // clear interrupted flag before we continue + intex = new InterruptedException("Interrupted during message processing") + log.error(intex, "Interrupted during message processing") + } true } catch { case ie: InterruptedException ⇒ log.error(ie, "Interrupted during message processing") - Thread.currentThread().interrupt() + Thread.interrupted() // clear interrupted flag before continuing intex = ie true case NonFatal(e) ⇒ @@ -262,7 +266,7 @@ class CallingThreadDispatcher( runQueue(mbox, queue, intex) } else { if (intex ne null) { - Thread.interrupted // clear interrupted flag before throwing according to java convention + Thread.interrupted() // clear interrupted flag before throwing according to java convention throw intex } }