All started with question "Scala, Actors, what happens to unread inbox messages?". I was thinking how to avoid such problems in large system with many actors.
I found myself writing something like this:
react {
//all cases
case any: AnyRef => logMessageWithoutCase(any)
}
Is it good avoidance from memory leaks or is it have some side effects?
UPDATE 1 Thanks to @Alexey Romanov and @Luigi Plinge, if in the system will have some Spam actor?
Something like this:
react{
//all cases
case msg: Any => Spam!msg
}
And finally in Spam will log or save to database. I think, it is more intuitive solution.
AnyRef
type restriction, or changing it toAny
, so you capture all theAnyVal
types as well – Luigi Plinge