Fix lookup of coordinator for sharding proxies (#23995)

This commit is contained in:
Christopher Batey 2017-11-15 13:03:48 +00:00 committed by GitHub
parent 9e506b25b7
commit 1eb3abb27e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 12 deletions

View file

@ -479,15 +479,17 @@ class ClusterSharding(system: ExtendedActorSystem) extends Extension {
* The entity type must be registered with the [[#start]] or [[#startProxy]] method before it
* can be used here. Messages to the entity is always sent via the `ShardRegion`.
*/
def shardRegion(typeName: String): ActorRef = regions.get(typeName) match {
case null
regions.get(typeName) match {
case null
throw new IllegalArgumentException(
s"Shard type [$typeName] must be started first")
case ref ref
}
case ref ref
def shardRegion(typeName: String): ActorRef = {
regions.get(typeName) match {
case null
proxies.get(proxyName(typeName, None)) match {
case null
throw new IllegalArgumentException(
s"Shard type [$typeName] must be started first")
case ref ref
}
case ref ref
}
}
/**
@ -650,7 +652,7 @@ private[akka] class ClusterShardingGuardian extends Actor {
try {
val encName = URLEncoder.encode(s"${typeName}Proxy", ByteString.UTF_8)
val cName = coordinatorSingletonManagerName(encName)
val cPath = coordinatorPath(encName)
val cPath = coordinatorPath(URLEncoder.encode(typeName, ByteString.UTF_8))
// it must be possible to start several proxies, one per data center
val actorName = dataCenter match {
case None encName

View file

@ -27,7 +27,6 @@ import akka.cluster.ClusterSettings.DataCenter
* @see [[ClusterSharding$ ClusterSharding extension]]
*/
object ShardRegion {
/**
* INTERNAL API
* Factory method for the [[akka.actor.Props]] of the [[ShardRegion]] actor.

View file

@ -195,7 +195,6 @@ abstract class MultiDcClusterShardingSpec extends MultiNodeSpec(MultiDcClusterSh
dataCenter = None, // by default use own DC
extractEntityId = extractEntityId,
extractShardId = extractShardId)
proxy ! GetCount("5")
expectMsg(1)
}