Moved the dispatcher/router verification to RoutedActorRef, also checks dispatcher only through the config so we don't trigger creation of dispatcher.
Signed-off-by: Jonas Bonér <jonas@jonasboner.com>
This commit is contained in:
parent
6d962174fe
commit
66600f9c52
3 changed files with 11 additions and 17 deletions
|
|
@ -357,19 +357,7 @@ private[akka] class ActorCell(
|
|||
case _ ⇒ true
|
||||
}
|
||||
|
||||
private def verifyActorConfiguration(system: ActorSystem, props: Props, actorName: String): Unit = {
|
||||
import akka.config.ConfigurationException
|
||||
import akka.routing.NoRouter
|
||||
// verify that a BalancingDispatcher is not used with a Router
|
||||
if (system.dispatchers.lookup(props.dispatcher).isInstanceOf[BalancingDispatcher] && props.routerConfig != NoRouter)
|
||||
throw new ConfigurationException(
|
||||
"Configuration for actor [" + actorName +
|
||||
"] is invalid - you can not use a 'BalancingDispatcher' together with any type of 'Router'")
|
||||
}
|
||||
|
||||
private def _actorOf(props: Props, name: String): ActorRef = {
|
||||
verifyActorConfiguration(systemImpl, props, name)
|
||||
|
||||
if (system.settings.SerializeAllCreators && !props.creator.isInstanceOf[NoSerializationVerificationNeeded]) {
|
||||
val ser = SerializationExtension(system)
|
||||
ser.serialize(props.creator) match {
|
||||
|
|
|
|||
|
|
@ -120,9 +120,9 @@ class Dispatchers(val settings: ActorSystem.Settings, val prerequisites: Dispatc
|
|||
* Throws: IllegalArgumentException if the value of "type" is not valid
|
||||
* IllegalArgumentException if it cannot create the MessageDispatcherConfigurator
|
||||
*/
|
||||
private[akka] def from(cfg: Config): MessageDispatcher = {
|
||||
configuratorFrom(cfg).dispatcher()
|
||||
}
|
||||
private[akka] def from(cfg: Config): MessageDispatcher = configuratorFrom(cfg).dispatcher()
|
||||
|
||||
private[akka] def isBalancingDispatcher(id: String): Boolean = settings.config.hasPath(id) && config(id).getString("type") == "BalancingDispatcher"
|
||||
|
||||
/*
|
||||
* Creates a MessageDispatcherConfigurator from a Config.
|
||||
|
|
|
|||
|
|
@ -31,11 +31,17 @@ private[akka] class RoutedActorRef(_system: ActorSystemImpl, _props: Props, _sup
|
|||
_supervisor,
|
||||
_path) {
|
||||
|
||||
// verify that a BalancingDispatcher is not used with a Router
|
||||
if (_system.dispatchers.isBalancingDispatcher(_props.dispatcher) && _props.routerConfig != NoRouter)
|
||||
throw new ConfigurationException(
|
||||
"Configuration for actor [" + _path.toString +
|
||||
"] is invalid - you can not use a 'BalancingDispatcher' together with any type of 'Router'")
|
||||
|
||||
/*
|
||||
* CAUTION: RoutedActorRef is PROBLEMATIC
|
||||
* ======================================
|
||||
*
|
||||
* We are constructing/assembling the children outside of the scope of the
|
||||
*
|
||||
* We are constructing/assembling the children outside of the scope of the
|
||||
* Router actor, inserting them in its childrenRef list, which is not at all
|
||||
* synchronized. This is done exactly once at start-up, all other accesses
|
||||
* are done from the Router actor. This means that the only thing which is
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue