Moving tests after first invocation
This commit is contained in:
parent
a22d01f595
commit
42d3328815
2 changed files with 6 additions and 9 deletions
|
|
@ -282,8 +282,6 @@ abstract class MessageDispatcher(val prerequisites: DispatcherPrerequisites) ext
|
||||||
|
|
||||||
@inline
|
@inline
|
||||||
protected[akka] final val isThroughputDeadlineTimeDefined = throughputDeadlineTime.toMillis > 0
|
protected[akka] final val isThroughputDeadlineTimeDefined = throughputDeadlineTime.toMillis > 0
|
||||||
@inline
|
|
||||||
protected[akka] final val isThroughputDefined = throughput > 1
|
|
||||||
|
|
||||||
protected[akka] def executeTask(invocation: TaskInvocation)
|
protected[akka] def executeTask(invocation: TaskInvocation)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -172,19 +172,18 @@ private[akka] abstract class Mailbox(val actor: ActorCell) extends MessageQueue
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Process the messages in the mailbox
|
* 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 processMailbox(
|
||||||
|
left: Int = java.lang.Math.min(dispatcher.throughput, 1),
|
||||||
@tailrec private final def process(left: Int, deadlineNs: Long = if (dispatcher.isThroughputDeadlineTimeDefined) System.nanoTime + dispatcher.throughputDeadlineTime.toNanos else 0l): Unit =
|
deadlineNs: Long = if (dispatcher.isThroughputDeadlineTimeDefined) System.nanoTime + dispatcher.throughputDeadlineTime.toNanos else 0l): Unit =
|
||||||
if ((left > 0) && (shouldProcessMessage) && (!dispatcher.isThroughputDeadlineTimeDefined || System.nanoTime < deadlineNs)) {
|
if (shouldProcessMessage) {
|
||||||
val next = dequeue()
|
val next = dequeue()
|
||||||
if (next ne null) {
|
if (next ne null) {
|
||||||
if (Mailbox.debug) println(actor.self + " processing message " + next)
|
if (Mailbox.debug) println(actor.self + " processing message " + next)
|
||||||
actor invoke next
|
actor invoke next
|
||||||
processAllSystemMessages()
|
processAllSystemMessages()
|
||||||
process(left - 1, deadlineNs)
|
if ((left > 1) && (!dispatcher.isThroughputDeadlineTimeDefined || System.nanoTime < deadlineNs))
|
||||||
|
processMailbox(left - 1, deadlineNs)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue