revert Shard constructor signature changes

* because it breaks instrumentation
This commit is contained in:
Patrik Nordwall 2019-04-09 16:11:35 +00:00
parent 8376bee244
commit 75d3117d7d
5 changed files with 30 additions and 10 deletions

View file

@ -1,9 +1,5 @@
# Cleaning up compiler warnings # Cleaning up compiler warnings
ProblemFilters.exclude[DirectMissingMethodProblem]("akka.cluster.sharding.RememberEntityStarter.this") ProblemFilters.exclude[DirectMissingMethodProblem]("akka.cluster.sharding.RememberEntityStarter.this")
ProblemFilters.exclude[DirectMissingMethodProblem]("akka.cluster.sharding.Shard.props")
ProblemFilters.exclude[DirectMissingMethodProblem]("akka.cluster.sharding.DDataShard.this")
ProblemFilters.exclude[DirectMissingMethodProblem]("akka.cluster.sharding.PersistentShard.this")
ProblemFilters.exclude[DirectMissingMethodProblem]("akka.cluster.sharding.ShardCoordinator.this") ProblemFilters.exclude[DirectMissingMethodProblem]("akka.cluster.sharding.ShardCoordinator.this")
ProblemFilters.exclude[DirectMissingMethodProblem]("akka.cluster.sharding.RememberEntityStarter.props") ProblemFilters.exclude[DirectMissingMethodProblem]("akka.cluster.sharding.RememberEntityStarter.props")
ProblemFilters.exclude[DirectMissingMethodProblem]("akka.cluster.sharding.Shard.this")
ProblemFilters.exclude[DirectMissingMethodProblem]("akka.cluster.sharding.RemoveInternalClusterShardingData.remove") ProblemFilters.exclude[DirectMissingMethodProblem]("akka.cluster.sharding.RemoveInternalClusterShardingData.remove")

View file

@ -119,6 +119,7 @@ private[akka] object Shard {
entityProps: String => Props, entityProps: String => Props,
settings: ClusterShardingSettings, settings: ClusterShardingSettings,
extractEntityId: ShardRegion.ExtractEntityId, extractEntityId: ShardRegion.ExtractEntityId,
extractShardId: ShardRegion.ExtractShardId,
handOffStopMessage: Any, handOffStopMessage: Any,
replicator: ActorRef, replicator: ActorRef,
majorityMinCap: Int): Props = { majorityMinCap: Int): Props = {
@ -130,14 +131,22 @@ private[akka] object Shard {
entityProps, entityProps,
settings, settings,
extractEntityId, extractEntityId,
extractShardId,
handOffStopMessage, handOffStopMessage,
replicator, replicator,
majorityMinCap)).withDeploy(Deploy.local) majorityMinCap)).withDeploy(Deploy.local)
} else if (settings.rememberEntities && settings.stateStoreMode == ClusterShardingSettings.StateStoreModePersistence) } else if (settings.rememberEntities && settings.stateStoreMode == ClusterShardingSettings.StateStoreModePersistence)
Props(new PersistentShard(typeName, shardId, entityProps, settings, extractEntityId, handOffStopMessage)) Props(
.withDeploy(Deploy.local) new PersistentShard(
typeName,
shardId,
entityProps,
settings,
extractEntityId,
extractShardId,
handOffStopMessage)).withDeploy(Deploy.local)
else else
Props(new Shard(typeName, shardId, entityProps, settings, extractEntityId, handOffStopMessage)) Props(new Shard(typeName, shardId, entityProps, settings, extractEntityId, extractShardId, handOffStopMessage))
.withDeploy(Deploy.local) .withDeploy(Deploy.local)
} }
@ -159,6 +168,7 @@ private[akka] class Shard(
entityProps: String => Props, entityProps: String => Props,
settings: ClusterShardingSettings, settings: ClusterShardingSettings,
extractEntityId: ShardRegion.ExtractEntityId, extractEntityId: ShardRegion.ExtractEntityId,
@unused extractShardId: ShardRegion.ExtractShardId,
handOffStopMessage: Any) handOffStopMessage: Any)
extends Actor extends Actor
with ActorLogging with ActorLogging
@ -623,8 +633,9 @@ private[akka] class PersistentShard(
entityProps: String => Props, entityProps: String => Props,
override val settings: ClusterShardingSettings, override val settings: ClusterShardingSettings,
extractEntityId: ShardRegion.ExtractEntityId, extractEntityId: ShardRegion.ExtractEntityId,
extractShardId: ShardRegion.ExtractShardId,
handOffStopMessage: Any) handOffStopMessage: Any)
extends Shard(typeName, shardId, entityProps, settings, extractEntityId, handOffStopMessage) extends Shard(typeName, shardId, entityProps, settings, extractEntityId, extractShardId, handOffStopMessage)
with RememberingShard with RememberingShard
with PersistentActor with PersistentActor
with ActorLogging { with ActorLogging {
@ -720,10 +731,11 @@ private[akka] class DDataShard(
entityProps: String => Props, entityProps: String => Props,
override val settings: ClusterShardingSettings, override val settings: ClusterShardingSettings,
extractEntityId: ShardRegion.ExtractEntityId, extractEntityId: ShardRegion.ExtractEntityId,
extractShardId: ShardRegion.ExtractShardId,
handOffStopMessage: Any, handOffStopMessage: Any,
replicator: ActorRef, replicator: ActorRef,
majorityMinCap: Int) majorityMinCap: Int)
extends Shard(typeName, shardId, entityProps, settings, extractEntityId, handOffStopMessage) extends Shard(typeName, shardId, entityProps, settings, extractEntityId, extractShardId, handOffStopMessage)
with RememberingShard with RememberingShard
with Stash with Stash
with ActorLogging { with ActorLogging {

View file

@ -915,7 +915,16 @@ private[akka] class ShardRegion(
val shard = context.watch( val shard = context.watch(
context.actorOf( context.actorOf(
Shard Shard
.props(typeName, id, props, settings, extractEntityId, handOffStopMessage, replicator, majorityMinCap) .props(
typeName,
id,
props,
settings,
extractEntityId,
extractShardId,
handOffStopMessage,
replicator,
majorityMinCap)
.withDispatcher(context.props.dispatcher), .withDispatcher(context.props.dispatcher),
name)) name))
shardsByRef = shardsByRef.updated(shard, id) shardsByRef = shardsByRef.updated(shard, id)

View file

@ -32,6 +32,8 @@ class PersistentShardSpec extends AkkaSpec(PersistentShardSpec.config) with Word
val props = val props =
Props(new PersistentShard("cats", "shard-1", _ => Props(new EntityActor), ClusterShardingSettings(system), { Props(new PersistentShard("cats", "shard-1", _ => Props(new EntityActor), ClusterShardingSettings(system), {
case _ => ("entity-1", "msg") case _ => ("entity-1", "msg")
}, { _ =>
"shard-1"
}, PoisonPill)) }, PoisonPill))
val persistentShard = system.actorOf(props) val persistentShard = system.actorOf(props)
watch(persistentShard) watch(persistentShard)

View file

@ -114,6 +114,7 @@ class ShardSpec extends AkkaSpec(ShardSpec.config) with ImplicitSender {
_ Props(new EntityActor()), _ Props(new EntityActor()),
settings, settings,
extractEntityId, extractEntityId,
extractShardId,
PoisonPill, PoisonPill,
system.deadLetters, system.deadLetters,
1)) 1))