rename becomeOpen/becomeSuspended to resume/suspend on Mailbox
This commit is contained in:
parent
7ab9fb4135
commit
4bbb1dbcbd
3 changed files with 10 additions and 10 deletions
|
|
@ -392,7 +392,7 @@ abstract class MessageDispatcher(val prerequisites: DispatcherPrerequisites) ext
|
|||
def suspend(actor: ActorCell): Unit = {
|
||||
val mbox = actor.mailbox
|
||||
if ((mbox.actor eq actor) && (mbox.dispatcher eq this))
|
||||
mbox.becomeSuspended()
|
||||
mbox.suspend()
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -400,7 +400,7 @@ abstract class MessageDispatcher(val prerequisites: DispatcherPrerequisites) ext
|
|||
*/
|
||||
def resume(actor: ActorCell): Unit = {
|
||||
val mbox = actor.mailbox
|
||||
if ((mbox.actor eq actor) && (mbox.dispatcher eq this) && mbox.becomeOpen())
|
||||
if ((mbox.actor eq actor) && (mbox.dispatcher eq this) && mbox.resume())
|
||||
registerForExecution(mbox, false, false)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -124,32 +124,32 @@ private[akka] abstract class Mailbox(val messageQueue: MessageQueue)
|
|||
Unsafe.instance.putIntVolatile(this, AbstractMailbox.mailboxStatusOffset, newStatus)
|
||||
|
||||
/**
|
||||
* set new primary status Open. Caller does not need to worry about whether
|
||||
* Reduce the suspend count by one. Caller does not need to worry about whether
|
||||
* status was Scheduled or not.
|
||||
*
|
||||
* @returns true if the suspend count reached zero
|
||||
*/
|
||||
@tailrec
|
||||
final def becomeOpen(): Boolean = status match {
|
||||
final def resume(): Boolean = status match {
|
||||
case Closed ⇒ setStatus(Closed); false
|
||||
case s ⇒
|
||||
val next = if (s < suspendUnit) s else s - suspendUnit
|
||||
if (updateStatus(s, next)) next < suspendUnit
|
||||
else becomeOpen()
|
||||
else resume()
|
||||
}
|
||||
|
||||
/**
|
||||
* set new primary status Suspended. Caller does not need to worry about whether
|
||||
* Increment the suspend count by one. Caller does not need to worry about whether
|
||||
* status was Scheduled or not.
|
||||
*
|
||||
* @returns true if the previous suspend count was zero
|
||||
*/
|
||||
@tailrec
|
||||
final def becomeSuspended(): Boolean = status match {
|
||||
final def suspend(): Boolean = status match {
|
||||
case Closed ⇒ setStatus(Closed); false
|
||||
case s ⇒
|
||||
if (updateStatus(s, s + suspendUnit)) s < suspendUnit
|
||||
else becomeSuspended()
|
||||
else suspend()
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ class CallingThreadDispatcher(
|
|||
|
||||
override def suspend(actor: ActorCell) {
|
||||
actor.mailbox match {
|
||||
case m: CallingThreadMailbox ⇒ m.suspendSwitch.switchOn; m.becomeSuspended()
|
||||
case m: CallingThreadMailbox ⇒ m.suspendSwitch.switchOn; m.suspend()
|
||||
case m ⇒ m.systemEnqueue(actor.self, Suspend())
|
||||
}
|
||||
}
|
||||
|
|
@ -163,7 +163,7 @@ class CallingThreadDispatcher(
|
|||
val wasActive = queue.isActive
|
||||
val switched = mbox.suspendSwitch.switchOff {
|
||||
CallingThreadDispatcherQueues(actor.system).gatherFromAllOtherQueues(mbox, queue)
|
||||
mbox.becomeOpen()
|
||||
mbox.resume()
|
||||
}
|
||||
if (switched && !wasActive) {
|
||||
runQueue(mbox, queue)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue