akka-cluster-sharding compiler warnings as fatal errors (#26648)
This commit is contained in:
parent
38e63a0e41
commit
4bb60bbcc8
21 changed files with 101 additions and 114 deletions
|
|
@ -20,19 +20,21 @@ import akka.actor.{
|
|||
Timers
|
||||
}
|
||||
import akka.util.{ ConstantFun, MessageBufferMap }
|
||||
import scala.concurrent.Future
|
||||
|
||||
import scala.concurrent.Future
|
||||
import akka.cluster.Cluster
|
||||
import akka.cluster.ddata.ORSet
|
||||
import akka.cluster.ddata.ORSetKey
|
||||
import akka.cluster.ddata.Replicator._
|
||||
import akka.cluster.ddata.SelfUniqueAddress
|
||||
import akka.persistence._
|
||||
import akka.util.PrettyDuration._
|
||||
import akka.coordination.lease.scaladsl.{ Lease, LeaseProvider }
|
||||
import akka.pattern.pipe
|
||||
import scala.concurrent.duration._
|
||||
|
||||
import scala.concurrent.duration._
|
||||
import akka.cluster.sharding.ShardRegion.ShardInitialized
|
||||
import akka.util.unused
|
||||
|
||||
/**
|
||||
* INTERNAL API
|
||||
|
|
@ -117,7 +119,6 @@ private[akka] object Shard {
|
|||
entityProps: String => Props,
|
||||
settings: ClusterShardingSettings,
|
||||
extractEntityId: ShardRegion.ExtractEntityId,
|
||||
extractShardId: ShardRegion.ExtractShardId,
|
||||
handOffStopMessage: Any,
|
||||
replicator: ActorRef,
|
||||
majorityMinCap: Int): Props = {
|
||||
|
|
@ -129,22 +130,14 @@ 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,
|
||||
extractShardId,
|
||||
handOffStopMessage)).withDeploy(Deploy.local)
|
||||
Props(new PersistentShard(typeName, shardId, entityProps, settings, extractEntityId, handOffStopMessage))
|
||||
.withDeploy(Deploy.local)
|
||||
else
|
||||
Props(new Shard(typeName, shardId, entityProps, settings, extractEntityId, extractShardId, handOffStopMessage))
|
||||
Props(new Shard(typeName, shardId, entityProps, settings, extractEntityId, handOffStopMessage))
|
||||
.withDeploy(Deploy.local)
|
||||
}
|
||||
|
||||
|
|
@ -166,7 +159,6 @@ private[akka] class Shard(
|
|||
entityProps: String => Props,
|
||||
settings: ClusterShardingSettings,
|
||||
extractEntityId: ShardRegion.ExtractEntityId,
|
||||
extractShardId: ShardRegion.ExtractShardId,
|
||||
handOffStopMessage: Any)
|
||||
extends Actor
|
||||
with ActorLogging
|
||||
|
|
@ -321,7 +313,7 @@ private[akka] class Shard(
|
|||
}
|
||||
|
||||
def restartEntities(ids: Set[EntityId]): Unit = {
|
||||
context.actorOf(RememberEntityStarter.props(context.parent, typeName, shardId, ids, settings, sender()))
|
||||
context.actorOf(RememberEntityStarter.props(context.parent, ids, settings, sender()))
|
||||
}
|
||||
|
||||
def receiveShardRegionCommand(msg: ShardRegionCommand): Unit = msg match {
|
||||
|
|
@ -460,7 +452,7 @@ private[akka] class Shard(
|
|||
}
|
||||
}
|
||||
|
||||
def deliverTo(id: EntityId, msg: Any, payload: Msg, snd: ActorRef): Unit = {
|
||||
def deliverTo(id: EntityId, @unused msg: Any, payload: Msg, snd: ActorRef): Unit = {
|
||||
if (passivateIdleTask.isDefined) {
|
||||
lastMessageTimestamp = lastMessageTimestamp.updated(id, System.nanoTime())
|
||||
}
|
||||
|
|
@ -491,14 +483,8 @@ private[akka] class Shard(
|
|||
}
|
||||
|
||||
private[akka] object RememberEntityStarter {
|
||||
def props(
|
||||
region: ActorRef,
|
||||
typeName: String,
|
||||
shardId: ShardRegion.ShardId,
|
||||
ids: Set[ShardRegion.EntityId],
|
||||
settings: ClusterShardingSettings,
|
||||
requestor: ActorRef) =
|
||||
Props(new RememberEntityStarter(region, typeName, shardId, ids, settings, requestor))
|
||||
def props(region: ActorRef, ids: Set[ShardRegion.EntityId], settings: ClusterShardingSettings, requestor: ActorRef) =
|
||||
Props(new RememberEntityStarter(region, ids, settings, requestor))
|
||||
|
||||
private case object Tick extends NoSerializationVerificationNeeded
|
||||
}
|
||||
|
|
@ -508,8 +494,6 @@ private[akka] object RememberEntityStarter {
|
|||
*/
|
||||
private[akka] class RememberEntityStarter(
|
||||
region: ActorRef,
|
||||
typeName: String,
|
||||
shardId: ShardRegion.ShardId,
|
||||
ids: Set[ShardRegion.EntityId],
|
||||
settings: ClusterShardingSettings,
|
||||
requestor: ActorRef)
|
||||
|
|
@ -639,9 +623,8 @@ 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, extractShardId, handOffStopMessage)
|
||||
extends Shard(typeName, shardId, entityProps, settings, extractEntityId, handOffStopMessage)
|
||||
with RememberingShard
|
||||
with PersistentActor
|
||||
with ActorLogging {
|
||||
|
|
@ -737,11 +720,10 @@ 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, extractShardId, handOffStopMessage)
|
||||
extends Shard(typeName, shardId, entityProps, settings, extractEntityId, handOffStopMessage)
|
||||
with RememberingShard
|
||||
with Stash
|
||||
with ActorLogging {
|
||||
|
|
@ -755,6 +737,7 @@ private[akka] class DDataShard(
|
|||
private val maxUpdateAttempts = 3
|
||||
|
||||
implicit private val node = Cluster(context.system)
|
||||
implicit private val selfUniqueAddress = SelfUniqueAddress(node.selfUniqueAddress)
|
||||
|
||||
// The default maximum-frame-size is 256 KiB with Artery.
|
||||
// When using entity identifiers with 36 character strings (e.g. UUID.randomUUID).
|
||||
|
|
@ -832,8 +815,8 @@ private[akka] class DDataShard(
|
|||
private def sendUpdate(evt: StateChange, retryCount: Int) = {
|
||||
replicator ! Update(key(evt.entityId), ORSet.empty[EntityId], writeMajority, Some((evt, retryCount))) { existing =>
|
||||
evt match {
|
||||
case EntityStarted(id) => existing + id
|
||||
case EntityStopped(id) => existing - id
|
||||
case EntityStarted(id) => existing :+ id
|
||||
case EntityStopped(id) => existing.remove(id)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue