+act #17257 add Actor.ignoringBehavior
This commit is contained in:
Roland Kuhn 2015-05-11 17:13:49 +02:00
commit fe2eb27405

View file

@ -5,10 +5,11 @@
package akka.actor
import akka.AkkaException
import akka.event.LoggingAdapter
import scala.annotation.tailrec
import scala.beans.BeanProperty
import scala.util.control.NoStackTrace
import akka.event.LoggingAdapter
/**
* INTERNAL API
@ -340,6 +341,15 @@ object Actor {
def apply(x: Any) = throw new UnsupportedOperationException("Empty behavior apply()")
}
/**
* ignoringBehavior is a Receive-expression that consumes and ignores all messages.
*/
@SerialVersionUID(1L)
object ignoringBehavior extends Receive {
def isDefinedAt(x: Any): Boolean = true
def apply(x: Any): Unit = ()
}
/**
* Default placeholder (null) used for "!" to indicate that there is no sender of the message,
* that will be translated to the receiving system's deadLetters.
@ -401,8 +411,6 @@ object Actor {
*/
trait Actor {
import Actor._
// to make type Receive known in subclasses without import
type Receive = Actor.Receive