Enforing an acknowledgement of the mailbox status after each message has been processed
This commit is contained in:
parent
c2a8e8d6a6
commit
d8d639e259
2 changed files with 16 additions and 10 deletions
|
|
@ -40,6 +40,16 @@ abstract class Mailbox extends MessageQueue with SystemMessageQueue with Runnabl
|
|||
final def isClosed: Boolean = status == Closed
|
||||
final def isOpen: Boolean = status == Open
|
||||
|
||||
/**
|
||||
* Internal method to enforce a volatile write of the status
|
||||
*/
|
||||
@tailrec
|
||||
final def acknowledgeStatus(): Unit = {
|
||||
val s = _status.get()
|
||||
if (_status.compareAndSet(s, s)) ()
|
||||
else acknowledgeStatus()
|
||||
}
|
||||
|
||||
def become(newStatus: Status): Boolean = {
|
||||
@tailrec
|
||||
def transcend(): Boolean = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue