Moving tests after first invocation

This commit is contained in:
Viktor Klang 2012-01-21 01:33:07 +01:00
parent a22d01f595
commit 42d3328815
2 changed files with 6 additions and 9 deletions

View file

@ -172,19 +172,18 @@ private[akka] abstract class Mailbox(val actor: ActorCell) extends MessageQueue
/**
* Process the messages in the mailbox
*
* @return true if the processing finished before the mailbox was empty, due to the throughput constraint
*/
private final def processMailbox(): Unit = if (dispatcher.isThroughputDefined) process(dispatcher.throughput) else process(1)
@tailrec private final def process(left: Int, deadlineNs: Long = if (dispatcher.isThroughputDeadlineTimeDefined) System.nanoTime + dispatcher.throughputDeadlineTime.toNanos else 0l): Unit =
if ((left > 0) && (shouldProcessMessage) && (!dispatcher.isThroughputDeadlineTimeDefined || System.nanoTime < deadlineNs)) {
@tailrec private final def processMailbox(
left: Int = java.lang.Math.min(dispatcher.throughput, 1),
deadlineNs: Long = if (dispatcher.isThroughputDeadlineTimeDefined) System.nanoTime + dispatcher.throughputDeadlineTime.toNanos else 0l): Unit =
if (shouldProcessMessage) {
val next = dequeue()
if (next ne null) {
if (Mailbox.debug) println(actor.self + " processing message " + next)
actor invoke next
processAllSystemMessages()
process(left - 1, deadlineNs)
if ((left > 1) && (!dispatcher.isThroughputDeadlineTimeDefined || System.nanoTime < deadlineNs))
processMailbox(left - 1, deadlineNs)
}
}