Tweaking the interrupt restore it and breaking out of throughput
This commit is contained in:
parent
11cbebbee4
commit
f3c019df8c
4 changed files with 16 additions and 11 deletions
|
|
@ -217,12 +217,6 @@ abstract class ActorModelSpec extends JUnitSuite {
|
|||
|
||||
protected def newInterceptedDispatcher: MessageDispatcherInterceptor
|
||||
|
||||
@After
|
||||
def after {
|
||||
//remove the interrupted status since we are messing with interrupted exceptions.
|
||||
Thread.interrupted()
|
||||
}
|
||||
|
||||
@Test
|
||||
def dispatcherShouldDynamicallyHandleItsOwnLifeCycle {
|
||||
implicit val dispatcher = newInterceptedDispatcher
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ package akka.testkit
|
|||
|
||||
import akka.actor.dispatch.ActorModelSpec
|
||||
import java.util.concurrent.CountDownLatch
|
||||
import org.junit.{After, Test}
|
||||
|
||||
class CallingThreadDispatcherModelSpec extends ActorModelSpec {
|
||||
import ActorModelSpec._
|
||||
|
|
@ -42,6 +43,13 @@ class CallingThreadDispatcherModelSpec extends ActorModelSpec {
|
|||
//Can't handle this...
|
||||
}
|
||||
|
||||
|
||||
@After
|
||||
def after {
|
||||
//remove the interrupted status since we are messing with interrupted exceptions.
|
||||
Thread.interrupted()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// vim: set ts=2 sw=2 et:
|
||||
|
|
|
|||
|
|
@ -700,7 +700,7 @@ class LocalActorRef private[akka](private[this] val actorFactory: () ⇒ Actor,
|
|||
} catch {
|
||||
case e: InterruptedException ⇒
|
||||
handleExceptionInDispatch(e, messageHandle.message)
|
||||
Thread.currentThread().interrupt() //Restore interrupt
|
||||
throw e
|
||||
case e ⇒
|
||||
handleExceptionInDispatch(e, messageHandle.message)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -193,11 +193,14 @@ trait ExecutableMailbox extends Runnable { self: MessageQueue ⇒
|
|||
def dispatcher: Dispatcher
|
||||
|
||||
final def run = {
|
||||
try { processMailbox()} finally {dispatcherLock.unlock()}
|
||||
|
||||
try { processMailbox() } catch {
|
||||
case ie: InterruptedException => Thread.currentThread().interrupt() //Restore interrupt
|
||||
} finally {
|
||||
dispatcherLock.unlock()
|
||||
if (!self.isEmpty)
|
||||
dispatcher.reRegisterForExecution(this)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Process the messages in the mailbox
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue