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
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.RememberEntityStarter.props")
ProblemFilters.exclude[DirectMissingMethodProblem]("akka.cluster.sharding.Shard.this")
ProblemFilters.exclude[DirectMissingMethodProblem]("akka.cluster.sharding.RemoveInternalClusterShardingData.remove")

View file

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

View file

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

View file

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

View file

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