Removing UnsupportedActorRef and replacing its use with MinimalActorRef
This commit is contained in:
parent
18bfa26272
commit
1bf5abb29a
3 changed files with 5 additions and 30 deletions
|
|
@ -312,31 +312,6 @@ case class SerializedActorRef(hostname: String, port: Int, path: String) {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Trait for ActorRef implementations where most of the methods are not supported.
|
||||
*/
|
||||
trait UnsupportedActorRef extends ActorRef with ScalaActorRef {
|
||||
|
||||
private[akka] final val uuid: akka.actor.Uuid = newUuid()
|
||||
|
||||
def startsWatching(actorRef: ActorRef): ActorRef = actorRef
|
||||
|
||||
def stopsWatching(actorRef: ActorRef): ActorRef = actorRef
|
||||
|
||||
def suspend(): Unit = ()
|
||||
|
||||
def resume(): Unit = ()
|
||||
|
||||
protected[akka] def restart(cause: Throwable): Unit = ()
|
||||
|
||||
protected[akka] def sendSystemMessage(message: SystemMessage): Unit = ()
|
||||
|
||||
def !(message: Any)(implicit sender: ActorRef = null): Unit = ()
|
||||
|
||||
def ?(message: Any)(implicit timeout: Timeout): Future[Any] =
|
||||
throw new UnsupportedOperationException("Not supported for %s".format(getClass.getName))
|
||||
}
|
||||
|
||||
/**
|
||||
* Trait for ActorRef implementations where all methods contain default stubs.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -132,11 +132,11 @@ class LocalActorRefProvider(val app: ActorSystem) extends ActorRefProvider {
|
|||
* Top-level anchor for the supervision hierarchy of this actor system. Will
|
||||
* receive only Supervise/ChildTerminated system messages or Failure message.
|
||||
*/
|
||||
private[akka] val theOneWhoWalksTheBubblesOfSpaceTime: ActorRef = new UnsupportedActorRef {
|
||||
private[akka] val theOneWhoWalksTheBubblesOfSpaceTime: ActorRef = new MinimalActorRef {
|
||||
@volatile
|
||||
var stopped = false
|
||||
|
||||
val name = app.name + "-bubble-walker"
|
||||
override val name = app.name + "-bubble-walker"
|
||||
|
||||
// FIXME (actor path): move the root path to the new root guardian
|
||||
val path = app.root
|
||||
|
|
@ -145,9 +145,9 @@ class LocalActorRefProvider(val app: ActorSystem) extends ActorRefProvider {
|
|||
|
||||
override def toString = name
|
||||
|
||||
def stop() = stopped = true
|
||||
override def stop() = stopped = true
|
||||
|
||||
def isShutdown = stopped
|
||||
override def isShutdown = stopped
|
||||
|
||||
override def !(message: Any)(implicit sender: ActorRef = null): Unit = message match {
|
||||
case Failed(ex) ⇒ sender.stop()
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ object Routing {
|
|||
/**
|
||||
* An Abstract convenience implementation for building an ActorReference that uses a Router.
|
||||
*/
|
||||
abstract private[akka] class AbstractRoutedActorRef(val app: ActorSystem, val props: RoutedProps) extends UnsupportedActorRef {
|
||||
abstract private[akka] class AbstractRoutedActorRef(val app: ActorSystem, val props: RoutedProps) extends MinimalActorRef {
|
||||
val router = props.routerFactory()
|
||||
|
||||
override def !(message: Any)(implicit sender: ActorRef = null): Unit = router.route(message)(sender)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue