Merge pull request #17265 from hepin1989/fix-#17257
+act #17257 add Actor.ignoringBehavior
This commit is contained in:
commit
fe2eb27405
1 changed files with 11 additions and 3 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue