Best method to peek into a Scala Actor's Mailbox
Posted
by scaling_out
on Stack Overflow
See other posts from Stack Overflow
or by scaling_out
Published on 2010-04-27T12:59:51Z
Indexed on
2010/04/27
14:53 UTC
Read the original article
Hit count: 218
Using Scala 2.8 RC1 or newer, what is the best (easiest and/or most direct) method to "peek" at the waiting messages in an actor's mailbox (from within the same actor's act() method) in order to examine what is in the queue, without having to react/receive the messages and/or disturb the current contents of the mailbox in any way.
The purpose of this is so that an actor may determine if it is safe to process a request to exit by first determining if any of the remaining mailbox messages are ones that must be processed, instead of just dropped by stopping the actor immediately.
© Stack Overflow or respective owner