Allow different types of mailboxes on the same dispatcher. See #2687
This commit is contained in:
parent
c86cc0b8f7
commit
c3eed374f1
32 changed files with 735 additions and 74 deletions
|
|
@ -10,7 +10,7 @@ import scala.reflect.ClassTag
|
|||
import akka.routing._
|
||||
import akka.util.Reflect
|
||||
import scala.annotation.varargs
|
||||
import Deploy.NoDispatcherGiven
|
||||
import Deploy.{ NoDispatcherGiven, NoMailboxGiven }
|
||||
import scala.collection.immutable
|
||||
|
||||
/**
|
||||
|
|
@ -177,6 +177,15 @@ case class Props(deploy: Deploy, clazz: Class[_], args: immutable.Seq[Any]) {
|
|||
case x ⇒ x
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for extracting the mailbox information from the
|
||||
* contained [[Deploy]] instance.
|
||||
*/
|
||||
def mailbox: Option[String] = deploy.mailbox match {
|
||||
case NoMailboxGiven ⇒ None
|
||||
case x ⇒ Some(x)
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for extracting the router configuration from the
|
||||
* contained [[Deploy]] instance.
|
||||
|
|
@ -218,6 +227,11 @@ case class Props(deploy: Deploy, clazz: Class[_], args: immutable.Seq[Any]) {
|
|||
*/
|
||||
def withDispatcher(d: String): Props = copy(deploy = deploy.copy(dispatcher = d))
|
||||
|
||||
/**
|
||||
* Returns a new Props with the specified mailbox set.
|
||||
*/
|
||||
def withMailbox(m: String): Props = copy(deploy = deploy.copy(mailbox = m))
|
||||
|
||||
/**
|
||||
* Returns a new Props with the specified router config set.
|
||||
*/
|
||||
|
|
@ -309,3 +323,11 @@ private[akka] class CreatorConsumer(creator: Creator[Actor]) extends IndirectAct
|
|||
override def actorClass = classOf[Actor]
|
||||
override def produce() = creator.create()
|
||||
}
|
||||
|
||||
/**
|
||||
* INTERNAL API
|
||||
*/
|
||||
private[akka] class TypedCreatorFunctionConsumer(clz: Class[_ <: Actor], creator: () ⇒ Actor) extends IndirectActorProducer {
|
||||
override def actorClass = clz
|
||||
override def produce() = creator()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue