Had to revert back to synchronizing on actor when processing mailbox in dispatcher
This commit is contained in:
parent
11cc8f2a22
commit
d46504f72d
2 changed files with 7 additions and 14 deletions
|
|
@ -62,22 +62,15 @@ class ExecutorBasedEventDrivenDispatcher(_name: String) extends MessageDispatche
|
|||
def dispatch(invocation: MessageInvocation) = if (active) {
|
||||
executor.execute(new Runnable() {
|
||||
def run = {
|
||||
var messageInvocation = invocation.receiver._mailbox.poll
|
||||
while (messageInvocation != null) {
|
||||
messageInvocation.invoke
|
||||
messageInvocation = invocation.receiver._mailbox.poll
|
||||
}
|
||||
}
|
||||
/* invocation.receiver.synchronized {
|
||||
val messages = invocation.receiver._mailbox.iterator
|
||||
while (messages.hasNext) {
|
||||
messages.next.invoke
|
||||
messages.remove
|
||||
invocation.receiver.synchronized {
|
||||
var messageInvocation = invocation.receiver._mailbox.poll
|
||||
while (messageInvocation != null) {
|
||||
messageInvocation.invoke
|
||||
messageInvocation = invocation.receiver._mailbox.poll
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
})
|
||||
})
|
||||
} else throw new IllegalStateException("Can't submit invocations to dispatcher since it's not started")
|
||||
|
||||
def start = if (!active) {
|
||||
|
|
|
|||
|
|
@ -21,4 +21,4 @@ class AgentTest extends junit.framework.TestCase with Suite with MustMatchers wi
|
|||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue