From 42de889b2eb4a797e694fbf4ca1ceec23da4ef9c Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Fri, 16 Jun 2023 13:39:48 +1000 Subject: [PATCH 1/2] dont pass default parameter values --- .../Akka.Benchmarks/Hocon/HoconBenchmarks.cs | 2 +- .../ClusterMetricsStrategy.cs | 6 +- .../Configuration/ClusterMetricsSettings.cs | 6 +- .../MemoryJournalShared.cs | 2 +- .../MemorySnapshotStoreShared.cs | 2 +- .../ShardRegionQueriesHashCodeSpecs.cs | 2 +- .../ShardRegionQueriesSpecs.cs | 2 +- .../ClusterShardingGuardian.cs | 2 +- .../ClusterShardingSettings.cs | 2 +- .../Singleton/ClusterSingletonConfigSpec.cs | 2 +- .../Client/ClusterClientReceptionist.cs | 4 +- .../Client/ClusterReceptionistSettings.cs | 2 +- .../PublishSubscribe/DistributedPubSub.cs | 2 +- .../DistributedPubSubSettings.cs | 2 +- .../Singleton/ClusterSingletonManager.cs | 4 +- .../ClusterSingletonProxySettings.cs | 6 +- .../ReplicatorChaosSpec.cs | 6 +- .../ReplicatorPruningSpec.cs | 2 +- .../ReplicatorSpec.cs | 6 +- .../DataEnvelopeSpecs.cs | 6 +- .../DeltaPropagationSelectorSpec.cs | 2 +- .../PNCounterDictionarySpec.cs | 12 ++-- .../ReplicatedDataSerializerSpec.cs | 12 ++-- .../ReplicatorMessageSerializerSpec.cs | 2 +- .../WriteAggregatorSpec.cs | 2 +- .../Akka.DistributedData/DistributedData.cs | 2 +- .../Akka.DistributedData/ReadAggregator.cs | 2 +- .../Akka.DistributedData/Replicator.cs | 6 +- .../ReplicatorSettings.cs | 6 +- .../InMemoryReadJournal.cs | 4 +- .../SqlReadJournal.cs | 6 +- .../Journal/BatchingSqlJournal.cs | 10 +-- .../Akka.Persistence.Sql.Common/Settings.cs | 6 +- .../DefaultConfigSpec.cs | 4 +- .../SqliteConfigSpec.cs | 6 +- .../Journal/BatchingSqliteJournal.cs | 10 +-- .../Journal/SqliteJournal.cs | 12 ++-- .../Snapshot/SqliteSnapshotStore.cs | 4 +- .../HyperionSerializer.cs | 2 +- .../Akka.Cluster.Tests/ClusterConfigSpec.cs | 14 ++-- .../Akka.Cluster.Tests/DowningProviderSpec.cs | 2 +- .../Routing/ClusterRouterAsk1343BugFixSpec.cs | 4 +- .../SBR/SplitBrainResolverSpec.cs | 54 ++++++++-------- src/core/Akka.Cluster/Cluster.cs | 2 +- .../Akka.Cluster/ClusterActorRefProvider.cs | 6 +- src/core/Akka.Cluster/ClusterSettings.cs | 48 +++++++------- .../Routing/ClusterRoutingConfig.cs | 12 ++-- src/core/Akka.Cluster/SplitBrainResolver.cs | 14 ++-- src/core/Akka.Cluster/Util.cs | 2 +- src/core/Akka.Coordination.Tests/TestLease.cs | 2 +- src/core/Akka.Coordination/LeaseProvider.cs | 2 +- .../Cluster.Metrics/RouterInCodeSample.cs | 2 +- .../PersistenceQuery.cs | 2 +- .../LocalSnapshotStoreSpec.cs | 2 +- .../AtLeastOnceDeliveryFailureSpec.cs | 4 +- .../Journal/ChaosJournal.cs | 8 +-- .../Journal/SteppingMemoryJournal.cs | 2 +- .../Akka.Persistence.Tests/LoadPluginSpec.cs | 2 +- .../PersistenceConfigAutoStartSpec.cs | 4 +- .../PersistenceConfigSpec.cs | 4 +- .../Akka.Persistence.Tests/PersistenceSpec.cs | 8 +-- .../ReceivePersistentActorTests.cs | 2 +- .../SnapshotFailureRobustnessSpec.cs | 2 +- .../Akka.Persistence/Fsm/PersistentFSM.cs | 2 +- .../Journal/AsyncWriteJournal.cs | 12 ++-- .../Journal/PersistencePluginProxy.cs | 12 ++-- src/core/Akka.Persistence/Persistence.cs | 30 ++++----- .../Snapshot/LocalSnapshotStore.cs | 8 +-- .../Akka.Remote.TestKit/BarrierCoordinator.cs | 4 +- src/core/Akka.Remote.TestKit/Extension.cs | 12 ++-- .../RemoteGatePiercingSpec.cs | 2 +- src/core/Akka.Remote.Tests/ActorsLeakSpec.cs | 2 +- .../SystemMessageSerializationSpec.cs | 2 +- src/core/Akka.Remote/AkkaProtocolSettings.cs | 8 +-- .../Akka.Remote/DeadlineFailureDetector.cs | 4 +- .../Akka.Remote/PhiAccrualFailureDetector.cs | 10 +-- src/core/Akka.Remote/RemoteDeployer.cs | 2 +- src/core/Akka.Remote/RemoteSettings.cs | 46 ++++++------- src/core/Akka.Remote/RemoteSystemDaemon.cs | 2 +- src/core/Akka.Remote/Remoting.cs | 12 ++-- .../DotNetty/DotNettyTransportSettings.cs | 42 ++++++------ .../FailureInjectorTransportAdapter.cs | 2 +- .../Akka.Remote/Transport/TestTransport.cs | 2 +- .../AkkaPublisherVerification.cs | 2 +- .../Akka.Streams.Tests/Dsl/FlowAskSpec.cs | 2 +- .../Akka.Streams.Tests/Dsl/FlowGroupBySpec.cs | 4 +- src/core/Akka.Streams/ActorMaterializer.cs | 4 +- src/core/Akka.Streams/Dsl/RestartFlow.cs | 2 +- src/core/Akka.Streams/Implementation/Sinks.cs | 2 +- .../TestActorRefTests/NestingActor.cs | 2 +- .../TestKit_Config_Tests.cs | 4 +- .../Akka.TestKit.Tests/TestSchedulerTests.cs | 2 +- .../EventFilter/Internal/ErrorFilter.cs | 2 +- src/core/Akka.TestKit/TestKitBase_ActorOf.cs | 6 +- src/core/Akka.TestKit/TestKitSettings.cs | 10 +-- .../Dispatch/GetMailboxTypeSpec.cs | 2 +- src/core/Akka.Tests/Actor/ActorBecomeTests.cs | 2 +- .../Akka.Tests/Actor/ActorRefIgnoreSpec.cs | 2 +- src/core/Akka.Tests/Actor/ActorRefSpec.cs | 2 +- .../Akka.Tests/Actor/ActorSelectionSpec.cs | 6 +- .../Actor/CoordinatedShutdownSpec.cs | 4 +- src/core/Akka.Tests/Actor/DeathWatchSpec.cs | 4 +- .../Actor/Dispatch/ActorModelSpec.cs | 10 +-- .../Akka.Tests/Actor/Dispatch/Bug2640Spec.cs | 4 +- src/core/Akka.Tests/Actor/FSMActorSpec.cs | 2 +- src/core/Akka.Tests/Actor/FSMTimingSpec.cs | 2 +- src/core/Akka.Tests/Actor/FunctionRefSpecs.cs | 2 +- .../Akka.Tests/Actor/PipeToSupportSpec.cs | 4 +- .../Akka.Tests/Actor/ReceiveActorTests.cs | 2 +- src/core/Akka.Tests/Actor/TimerSpec.cs | 6 +- .../IO/UdpConnectedIntegrationSpec.cs | 4 +- src/core/Akka.Tests/IO/UdpIntegrationSpec.cs | 6 +- .../Pattern/BackoffOnRestartSupervisorSpec.cs | 2 +- .../Routing/ConfiguredLocalRoutingSpec.cs | 2 +- .../Serialization/SerializationSpec.cs | 2 +- src/core/Akka.Tests/Util/SwitchTests.cs | 8 +-- .../Akka/Actor/ActorCell.FaultHandling.cs | 4 +- src/core/Akka/Actor/ActorCell.cs | 4 +- src/core/Akka/Actor/CoordinatedShutdown.cs | 12 ++-- src/core/Akka/Actor/Deployer.cs | 2 +- src/core/Akka/Actor/Inbox.cs | 4 +- .../Akka/Actor/Internal/ActorSystemImpl.cs | 2 +- src/core/Akka/Actor/RootGuardianSupervisor.cs | 2 +- .../Scheduler/HashedWheelTimerScheduler.cs | 6 +- src/core/Akka/Actor/Settings.cs | 64 +++++++++---------- src/core/Akka/Actor/SupervisorStrategy.cs | 8 +-- src/core/Akka/Dispatch/AbstractDispatcher.cs | 2 +- ...CurrentSynchronizationContextDispatcher.cs | 8 +-- src/core/Akka/Dispatch/Dispatchers.cs | 6 +- src/core/Akka/Dispatch/Mailbox.cs | 4 +- src/core/Akka/Dispatch/Mailboxes.cs | 10 +-- .../MessageQueues/BoundedMessageQueue.cs | 2 +- src/core/Akka/Dispatch/PinnedDispatcher.cs | 10 +-- src/core/Akka/Dispatch/ThreadPoolBuilder.cs | 6 +- src/core/Akka/IO/Dns.cs | 6 +- src/core/Akka/IO/InetAddressDnsResolver.cs | 6 +- src/core/Akka/IO/SimpleDnsManager.cs | 2 +- src/core/Akka/IO/Tcp.cs | 2 +- src/core/Akka/IO/TcpSettings.cs | 8 +-- src/core/Akka/IO/Udp.cs | 2 +- src/core/Akka/IO/UdpConnected.cs | 2 +- src/core/Akka/IO/UdpSettings.cs | 6 +- src/core/Akka/Routing/Broadcast.cs | 5 +- src/core/Akka/Routing/ConsistentHashRouter.cs | 9 ++- src/core/Akka/Routing/Random.cs | 2 +- src/core/Akka/Routing/Resizer.cs | 18 +++--- src/core/Akka/Routing/RoundRobin.cs | 2 +- .../Routing/ScatterGatherFirstCompleted.cs | 6 +- src/core/Akka/Routing/SmallestMailbox.cs | 2 +- src/core/Akka/Routing/TailChopping.cs | 8 +-- .../Akka.Persistence.Custom/Settings.cs | 2 +- 151 files changed, 479 insertions(+), 483 deletions(-) diff --git a/src/benchmark/Akka.Benchmarks/Hocon/HoconBenchmarks.cs b/src/benchmark/Akka.Benchmarks/Hocon/HoconBenchmarks.cs index b419989b4f0..fb9701a389a 100644 --- a/src/benchmark/Akka.Benchmarks/Hocon/HoconBenchmarks.cs +++ b/src/benchmark/Akka.Benchmarks/Hocon/HoconBenchmarks.cs @@ -74,7 +74,7 @@ public void Setup() [Benchmark] public string Hocon_parse_resolve_string_value() { - return fallback2.GetString("akka.actor.provider", null); + return fallback2.GetString("akka.actor.provider"); } [Benchmark] diff --git a/src/contrib/cluster/Akka.Cluster.Metrics/ClusterMetricsStrategy.cs b/src/contrib/cluster/Akka.Cluster.Metrics/ClusterMetricsStrategy.cs index ca3147369d5..55a2dea442a 100644 --- a/src/contrib/cluster/Akka.Cluster.Metrics/ClusterMetricsStrategy.cs +++ b/src/contrib/cluster/Akka.Cluster.Metrics/ClusterMetricsStrategy.cs @@ -18,9 +18,9 @@ public class ClusterMetricsStrategy : OneForOneStrategy { public ClusterMetricsStrategy(Config config) : base( - maxNrOfRetries: config.GetInt("maxNrOfRetries", 0), - withinTimeMilliseconds: (int)config.GetTimeSpan("withinTimeRange", null).TotalMilliseconds, - loggingEnabled: config.GetBoolean("loggingEnabled", false), + maxNrOfRetries: config.GetInt("maxNrOfRetries"), + withinTimeMilliseconds: (int)config.GetTimeSpan("withinTimeRange").TotalMilliseconds, + loggingEnabled: config.GetBoolean("loggingEnabled"), localOnlyDecider: MetricsDecider) { } diff --git a/src/contrib/cluster/Akka.Cluster.Metrics/Configuration/ClusterMetricsSettings.cs b/src/contrib/cluster/Akka.Cluster.Metrics/Configuration/ClusterMetricsSettings.cs index 4a6d44c69fa..25e17c13ed0 100644 --- a/src/contrib/cluster/Akka.Cluster.Metrics/Configuration/ClusterMetricsSettings.cs +++ b/src/contrib/cluster/Akka.Cluster.Metrics/Configuration/ClusterMetricsSettings.cs @@ -37,12 +37,12 @@ public ClusterMetricsSettings(Config config) CollectorProvider = _config.GetString("collector.provider"); CollectorFallback = _config.GetBoolean("collector.fallback"); CollectorSampleInterval = - Requiring(_config.GetTimeSpan("collector.sample-interval", null), t => t > TimeSpan.Zero, "collector.sample-interval must be > 0"); + Requiring(_config.GetTimeSpan("collector.sample-interval"), t => t > TimeSpan.Zero, "collector.sample-interval must be > 0"); CollectorGossipInterval = - Requiring(_config.GetTimeSpan("collector.gossip-interval", null), t => t > TimeSpan.Zero, "collector.gossip-interval must be > 0"); + Requiring(_config.GetTimeSpan("collector.gossip-interval"), t => t > TimeSpan.Zero, "collector.gossip-interval must be > 0"); CollectorMovingAverageHalfLife = - Requiring(_config.GetTimeSpan("collector.moving-average-half-life", null), t => t > TimeSpan.Zero, "collector.moving-average-half-life must be > 0"); + Requiring(_config.GetTimeSpan("collector.moving-average-half-life"), t => t > TimeSpan.Zero, "collector.moving-average-half-life must be > 0"); } /// diff --git a/src/contrib/cluster/Akka.Cluster.Sharding.Tests.MultiNode/MemoryJournalShared.cs b/src/contrib/cluster/Akka.Cluster.Sharding.Tests.MultiNode/MemoryJournalShared.cs index 323998ef959..ede2d09303e 100644 --- a/src/contrib/cluster/Akka.Cluster.Sharding.Tests.MultiNode/MemoryJournalShared.cs +++ b/src/contrib/cluster/Akka.Cluster.Sharding.Tests.MultiNode/MemoryJournalShared.cs @@ -16,7 +16,7 @@ public class MemoryJournalShared : AsyncWriteProxyEx public MemoryJournalShared() { - Timeout = Context.System.Settings.Config.GetTimeSpan("akka.persistence.journal.memory-journal-shared.timeout", null); + Timeout = Context.System.Settings.Config.GetTimeSpan("akka.persistence.journal.memory-journal-shared.timeout"); } public static void SetStore(IActorRef store, ActorSystem system) diff --git a/src/contrib/cluster/Akka.Cluster.Sharding.Tests.MultiNode/MemorySnapshotStoreShared.cs b/src/contrib/cluster/Akka.Cluster.Sharding.Tests.MultiNode/MemorySnapshotStoreShared.cs index fdf7ea32e3e..d8cee6b4daf 100644 --- a/src/contrib/cluster/Akka.Cluster.Sharding.Tests.MultiNode/MemorySnapshotStoreShared.cs +++ b/src/contrib/cluster/Akka.Cluster.Sharding.Tests.MultiNode/MemorySnapshotStoreShared.cs @@ -16,7 +16,7 @@ public class MemorySnapshotStoreShared : SnapshotStoreProxy public MemorySnapshotStoreShared() { - Timeout = Context.System.Settings.Config.GetTimeSpan("akka.persistence.memory-snapshot-store-shared.timeout", null); + Timeout = Context.System.Settings.Config.GetTimeSpan("akka.persistence.memory-snapshot-store-shared.timeout"); } public static void SetStore(IActorRef store, ActorSystem system) diff --git a/src/contrib/cluster/Akka.Cluster.Sharding.Tests/ShardRegionQueriesHashCodeSpecs.cs b/src/contrib/cluster/Akka.Cluster.Sharding.Tests/ShardRegionQueriesHashCodeSpecs.cs index a0fd1b197fd..e6cfd2a3c51 100644 --- a/src/contrib/cluster/Akka.Cluster.Sharding.Tests/ShardRegionQueriesHashCodeSpecs.cs +++ b/src/contrib/cluster/Akka.Cluster.Sharding.Tests/ShardRegionQueriesHashCodeSpecs.cs @@ -47,7 +47,7 @@ public ShardRegionQueriesHashCodeSpecs(ITestOutputHelper outputHelper) : base(Ge { _clusterSharding = ClusterSharding.Get(Sys); _cluster = Cluster.Get(Sys); - _shardRegion = _clusterSharding.Start("entity", _ => EchoActor.Props(this, true), + _shardRegion = _clusterSharding.Start("entity", _ => EchoActor.Props(this), ClusterShardingSettings.Create(Sys).WithRole("shard"), new MessageExtractor()); var proxySysConfig = ConfigurationFactory.ParseString("akka.cluster.roles = [proxy]") diff --git a/src/contrib/cluster/Akka.Cluster.Sharding.Tests/ShardRegionQueriesSpecs.cs b/src/contrib/cluster/Akka.Cluster.Sharding.Tests/ShardRegionQueriesSpecs.cs index 98fd317f166..629f8963c0a 100644 --- a/src/contrib/cluster/Akka.Cluster.Sharding.Tests/ShardRegionQueriesSpecs.cs +++ b/src/contrib/cluster/Akka.Cluster.Sharding.Tests/ShardRegionQueriesSpecs.cs @@ -31,7 +31,7 @@ public ShardRegionQueriesSpecs(ITestOutputHelper outputHelper) : base(GetConfig( { _clusterSharding = ClusterSharding.Get(Sys); _cluster = Cluster.Get(Sys); - _shardRegion = _clusterSharding.Start("entity", _ => EchoActor.Props(this, true), + _shardRegion = _clusterSharding.Start("entity", _ => EchoActor.Props(this), ClusterShardingSettings.Create(Sys).WithRole("shard"), ExtractEntityId, ExtractShardId); var proxySysConfig = ConfigurationFactory.ParseString("akka.cluster.roles = [proxy]") diff --git a/src/contrib/cluster/Akka.Cluster.Sharding/ClusterShardingGuardian.cs b/src/contrib/cluster/Akka.Cluster.Sharding/ClusterShardingGuardian.cs index 40b25cce83a..7d195db37f6 100644 --- a/src/contrib/cluster/Akka.Cluster.Sharding/ClusterShardingGuardian.cs +++ b/src/contrib/cluster/Akka.Cluster.Sharding/ClusterShardingGuardian.cs @@ -168,7 +168,7 @@ public StartProxy( private readonly Cluster _cluster = Cluster.Get(Context.System); private readonly ClusterSharding _sharding = ClusterSharding.Get(Context.System); - private readonly int _majorityMinCap = Context.System.Settings.Config.GetInt("akka.cluster.sharding.distributed-data.majority-min-cap", 0); + private readonly int _majorityMinCap = Context.System.Settings.Config.GetInt("akka.cluster.sharding.distributed-data.majority-min-cap"); private ImmutableDictionary _replicatorsByRole = ImmutableDictionary.Empty; private readonly ConcurrentDictionary _regions; diff --git a/src/contrib/cluster/Akka.Cluster.Sharding/ClusterShardingSettings.cs b/src/contrib/cluster/Akka.Cluster.Sharding/ClusterShardingSettings.cs index 0df6bd78470..17b7b9f1fda 100644 --- a/src/contrib/cluster/Akka.Cluster.Sharding/ClusterShardingSettings.cs +++ b/src/contrib/cluster/Akka.Cluster.Sharding/ClusterShardingSettings.cs @@ -398,7 +398,7 @@ int ConfigMajorityPlus(string p) leastShardAllocationRelativeLimit: config.GetDouble("least-shard-allocation-strategy.rebalance-relative-limit")); var coordinatorSingletonSettings = ClusterSingletonManagerSettings.Create(singletonConfig); - var role = config.GetString("role", null); + var role = config.GetString("role"); if (role == string.Empty) role = null; var usePassivateIdle = config.GetString("passivate-idle-entity-after").ToLowerInvariant(); diff --git a/src/contrib/cluster/Akka.Cluster.Tools.Tests/Singleton/ClusterSingletonConfigSpec.cs b/src/contrib/cluster/Akka.Cluster.Tools.Tests/Singleton/ClusterSingletonConfigSpec.cs index 22162fabef9..a0dc639a10d 100644 --- a/src/contrib/cluster/Akka.Cluster.Tools.Tests/Singleton/ClusterSingletonConfigSpec.cs +++ b/src/contrib/cluster/Akka.Cluster.Tools.Tests/Singleton/ClusterSingletonConfigSpec.cs @@ -41,7 +41,7 @@ public void ClusterSingletonManagerSettings_must_have_default_config() var config = Sys.Settings.Config.GetConfig("akka.cluster.singleton"); Assert.False(config.IsNullOrEmpty()); - config.GetInt("min-number-of-hand-over-retries", 0).ShouldBe(15); + config.GetInt("min-number-of-hand-over-retries").ShouldBe(15); } [Fact] diff --git a/src/contrib/cluster/Akka.Cluster.Tools/Client/ClusterClientReceptionist.cs b/src/contrib/cluster/Akka.Cluster.Tools/Client/ClusterClientReceptionist.cs index aa4e52f95b5..37990785a3f 100644 --- a/src/contrib/cluster/Akka.Cluster.Tools/Client/ClusterClientReceptionist.cs +++ b/src/contrib/cluster/Akka.Cluster.Tools/Client/ClusterClientReceptionist.cs @@ -53,7 +53,7 @@ public ClusterClientReceptionist(ExtendedActorSystem system) _system.Settings.InjectTopLevelFallback(DefaultConfig()); _config = system.Settings.Config.GetConfig("akka.cluster.client.receptionist"); - _role = _config.GetString("role", null); + _role = _config.GetString("role"); if (string.IsNullOrEmpty(_role)) _role = null; _receptionist = CreateReceptionist(); @@ -132,7 +132,7 @@ private IActorRef CreateReceptionist() else { var name = _config.GetString("name"); - var dispatcher = _config.GetString("use-dispatcher", null); + var dispatcher = _config.GetString("use-dispatcher"); if (string.IsNullOrEmpty(dispatcher)) dispatcher = Dispatchers.InternalDispatcherId; // important to use var mediator here to activate it outside of ClusterReceptionist constructor diff --git a/src/contrib/cluster/Akka.Cluster.Tools/Client/ClusterReceptionistSettings.cs b/src/contrib/cluster/Akka.Cluster.Tools/Client/ClusterReceptionistSettings.cs index f60b1ddafe0..c19dd46a94d 100644 --- a/src/contrib/cluster/Akka.Cluster.Tools/Client/ClusterReceptionistSettings.cs +++ b/src/contrib/cluster/Akka.Cluster.Tools/Client/ClusterReceptionistSettings.cs @@ -43,7 +43,7 @@ public static ClusterReceptionistSettings Create(Config config) if (config.IsNullOrEmpty()) throw ConfigurationException.NullOrEmptyConfig(); - var role = config.GetString("role", null); + var role = config.GetString("role"); if (string.IsNullOrEmpty(role)) role = null; return new ClusterReceptionistSettings( diff --git a/src/contrib/cluster/Akka.Cluster.Tools/PublishSubscribe/DistributedPubSub.cs b/src/contrib/cluster/Akka.Cluster.Tools/PublishSubscribe/DistributedPubSub.cs index 3e4573c6ee4..f46440d3ed2 100644 --- a/src/contrib/cluster/Akka.Cluster.Tools/PublishSubscribe/DistributedPubSub.cs +++ b/src/contrib/cluster/Akka.Cluster.Tools/PublishSubscribe/DistributedPubSub.cs @@ -100,7 +100,7 @@ public IActorRef Mediator private IActorRef CreateMediator() { var name = _system.Settings.Config.GetString("akka.cluster.pub-sub.name"); - var dispatcher = _system.Settings.Config.GetString("akka.cluster.pub-sub.use-dispatcher", null); + var dispatcher = _system.Settings.Config.GetString("akka.cluster.pub-sub.use-dispatcher"); if (string.IsNullOrEmpty(dispatcher)) dispatcher = Dispatchers.InternalDispatcherId; diff --git a/src/contrib/cluster/Akka.Cluster.Tools/PublishSubscribe/DistributedPubSubSettings.cs b/src/contrib/cluster/Akka.Cluster.Tools/PublishSubscribe/DistributedPubSubSettings.cs index 07621edeb12..b44e5201b55 100644 --- a/src/contrib/cluster/Akka.Cluster.Tools/PublishSubscribe/DistributedPubSubSettings.cs +++ b/src/contrib/cluster/Akka.Cluster.Tools/PublishSubscribe/DistributedPubSubSettings.cs @@ -70,7 +70,7 @@ public static DistributedPubSubSettings Create(Config config) // TODO: "removed-time-to-live" key depends on Config.GetTimeSpan() to return a TimeSpan.Zero default. // TODO: "max-delta-elements" key depends on Config.GetInt() to return a 0 default. return new DistributedPubSubSettings( - config.GetString("role", null), + config.GetString("role"), routingLogic, config.GetTimeSpan("gossip-interval"), config.GetTimeSpan("removed-time-to-live"), diff --git a/src/contrib/cluster/Akka.Cluster.Tools/Singleton/ClusterSingletonManager.cs b/src/contrib/cluster/Akka.Cluster.Tools/Singleton/ClusterSingletonManager.cs index b2d7326c043..752d18755fb 100644 --- a/src/contrib/cluster/Akka.Cluster.Tools/Singleton/ClusterSingletonManager.cs +++ b/src/contrib/cluster/Akka.Cluster.Tools/Singleton/ClusterSingletonManager.cs @@ -670,7 +670,7 @@ public ClusterSingletonManager(Props singletonProps, object terminationMessage, var n = (int)(_removalMargin.TotalMilliseconds / _settings.HandOverRetryInterval.TotalMilliseconds); - var minRetries = Context.System.Settings.Config.GetInt("akka.cluster.singleton.min-number-of-hand-over-retries", 0); + var minRetries = Context.System.Settings.Config.GetInt("akka.cluster.singleton.min-number-of-hand-over-retries"); if (minRetries < 1) throw new ConfigurationException("min-number-of-hand-over-retries must be >= 1"); @@ -1254,7 +1254,7 @@ private void InitializeFSM() if (wasOldestData.NewOldest != null) Peer(wasOldestData.NewOldest.Address).Tell(TakeOverFromMe.Instance); - SetTimer(TakeOverRetryTimer, new TakeOverRetry(takeOverRetry.Count + 1), _settings.HandOverRetryInterval, false); + SetTimer(TakeOverRetryTimer, new TakeOverRetry(takeOverRetry.Count + 1), _settings.HandOverRetryInterval); return Stay(); } else diff --git a/src/contrib/cluster/Akka.Cluster.Tools/Singleton/ClusterSingletonProxySettings.cs b/src/contrib/cluster/Akka.Cluster.Tools/Singleton/ClusterSingletonProxySettings.cs index 5e579de23f3..1394f53806b 100644 --- a/src/contrib/cluster/Akka.Cluster.Tools/Singleton/ClusterSingletonProxySettings.cs +++ b/src/contrib/cluster/Akka.Cluster.Tools/Singleton/ClusterSingletonProxySettings.cs @@ -33,7 +33,7 @@ public static ClusterSingletonProxySettings Create(ActorSystem system) throw ConfigurationException.NullOrEmptyConfig("akka.cluster.singleton-proxy"); var considerAppVersion = - system.Settings.Config.GetBoolean("akka.cluster.singleton.consider-app-version", false); + system.Settings.Config.GetBoolean("akka.cluster.singleton.consider-app-version"); return Create(config, considerAppVersion); } @@ -49,14 +49,14 @@ public static ClusterSingletonProxySettings Create(Config config, bool considerA if (config.IsNullOrEmpty()) throw ConfigurationException.NullOrEmptyConfig(); - var role = config.GetString("role", null); + var role = config.GetString("role"); if (role == string.Empty) role = null; return new ClusterSingletonProxySettings( singletonName: config.GetString("singleton-name"), role: role, singletonIdentificationInterval: config.GetTimeSpan("singleton-identification-interval"), - bufferSize: config.GetInt("buffer-size", 0), + bufferSize: config.GetInt("buffer-size"), considerAppVersion: considerAppVersion); } diff --git a/src/contrib/cluster/Akka.DistributedData.Tests.MultiNode/ReplicatorChaosSpec.cs b/src/contrib/cluster/Akka.DistributedData.Tests.MultiNode/ReplicatorChaosSpec.cs index eec55e7a2b7..eb839bbc41d 100644 --- a/src/contrib/cluster/Akka.DistributedData.Tests.MultiNode/ReplicatorChaosSpec.cs +++ b/src/contrib/cluster/Akka.DistributedData.Tests.MultiNode/ReplicatorChaosSpec.cs @@ -107,9 +107,9 @@ public void Replicator_in_chaotic_cluster_should_replicate_data_in_initial_phase { for (var i = 0; i < 5; i++) { - _replicator.Tell(Dsl.Update(KeyA, GCounter.Empty, WriteLocal.Instance, x => x.Increment(_cluster, 1))); - _replicator.Tell(Dsl.Update(KeyB, PNCounter.Empty, WriteLocal.Instance, x => x.Decrement(_cluster, 1))); - _replicator.Tell(Dsl.Update(KeyC, GCounter.Empty, new WriteAll(_timeout), x => x.Increment(_cluster, 1))); + _replicator.Tell(Dsl.Update(KeyA, GCounter.Empty, WriteLocal.Instance, x => x.Increment(_cluster))); + _replicator.Tell(Dsl.Update(KeyB, PNCounter.Empty, WriteLocal.Instance, x => x.Decrement(_cluster))); + _replicator.Tell(Dsl.Update(KeyC, GCounter.Empty, new WriteAll(_timeout), x => x.Increment(_cluster))); } ReceiveN(15).Select(x => x.GetType()).ToImmutableHashSet().ShouldBe(new[] { typeof(UpdateSuccess) }); }, First); diff --git a/src/contrib/cluster/Akka.DistributedData.Tests.MultiNode/ReplicatorPruningSpec.cs b/src/contrib/cluster/Akka.DistributedData.Tests.MultiNode/ReplicatorPruningSpec.cs index 7ffddaafa6e..5168afc74a3 100644 --- a/src/contrib/cluster/Akka.DistributedData.Tests.MultiNode/ReplicatorPruningSpec.cs +++ b/src/contrib/cluster/Akka.DistributedData.Tests.MultiNode/ReplicatorPruningSpec.cs @@ -190,7 +190,7 @@ void UpdateAfterPruning(ulong expectedValue) { // inject data from removed node to simulate bad data _replicator.Tell(Dsl.Update(_keyA, GCounter.Empty, - new WriteAll(_timeout), x => x.Merge(oldCounter).Increment(_cluster, 1))); + new WriteAll(_timeout), x => x.Merge(oldCounter).Increment(_cluster))); ExpectMsg(); AwaitAssert(() => diff --git a/src/contrib/cluster/Akka.DistributedData.Tests.MultiNode/ReplicatorSpec.cs b/src/contrib/cluster/Akka.DistributedData.Tests.MultiNode/ReplicatorSpec.cs index 31089fb4b0d..630c5186532 100644 --- a/src/contrib/cluster/Akka.DistributedData.Tests.MultiNode/ReplicatorSpec.cs +++ b/src/contrib/cluster/Akka.DistributedData.Tests.MultiNode/ReplicatorSpec.cs @@ -280,7 +280,7 @@ public void Cluster_CRDT_should_work_in_2_node_cluster() ExpectMsg(new UpdateSuccess(KeyB, null)); // add 1 on both nodes using WriteTwo - _replicator.Tell(Dsl.Update(KeyB, GCounter.Empty, _writeTwo, x => x.Increment(_cluster, 1))); + _replicator.Tell(Dsl.Update(KeyB, GCounter.Empty, _writeTwo, x => x.Increment(_cluster))); ExpectMsg(new UpdateSuccess(KeyB, null)); // the total, after replication should be 42 @@ -297,7 +297,7 @@ public void Cluster_CRDT_should_work_in_2_node_cluster() RunOn(() => { // add 1 on both nodes using WriteAll - _replicator.Tell(Dsl.Update(KeyB, GCounter.Empty, _writeAll, x => x.Increment(_cluster, 1))); + _replicator.Tell(Dsl.Update(KeyB, GCounter.Empty, _writeAll, x => x.Increment(_cluster))); ExpectMsg(new UpdateSuccess(KeyB, null)); // the total, after replication should be 44 @@ -314,7 +314,7 @@ public void Cluster_CRDT_should_work_in_2_node_cluster() RunOn(() => { // add 1 on both nodes using WriteMajority - _replicator.Tell(Dsl.Update(KeyB, GCounter.Empty, _writeMajority, x => x.Increment(_cluster, 1))); + _replicator.Tell(Dsl.Update(KeyB, GCounter.Empty, _writeMajority, x => x.Increment(_cluster))); ExpectMsg(new UpdateSuccess(KeyB, null)); // the total, after replication should be 46 diff --git a/src/contrib/cluster/Akka.DistributedData.Tests/DataEnvelopeSpecs.cs b/src/contrib/cluster/Akka.DistributedData.Tests/DataEnvelopeSpecs.cs index 05f3f3ff512..58cf1ba15ab 100644 --- a/src/contrib/cluster/Akka.DistributedData.Tests/DataEnvelopeSpecs.cs +++ b/src/contrib/cluster/Akka.DistributedData.Tests/DataEnvelopeSpecs.cs @@ -28,7 +28,7 @@ public class DataEnvelopeSpec [Fact] public void DataEnvelope_must_handle_pruning_transitions() { - var g1 = GCounter.Empty.Increment(node1, 1); + var g1 = GCounter.Empty.Increment(node1); var d1 = new DataEnvelope(g1); var d2 = d1.InitRemovedNodePruning(node1, node2); @@ -55,7 +55,7 @@ public void DataEnvelope_must_handle_pruning_transitions() [Fact] public void DataEnvelope_must_merge_correctly() { - var g1 = GCounter.Empty.Increment(node1, 1); + var g1 = GCounter.Empty.Increment(node1); var d1 = new DataEnvelope(g1); var g2 = GCounter.Empty.Increment(node2, 2); var d2 = new DataEnvelope(g2); @@ -89,7 +89,7 @@ public void DataEnvelope_must_merge_correctly() [Fact()] public void DataEnvelopes_with_identical_content_must_match() { - var g1 = GCounter.Empty.Increment(node1, 1); + var g1 = GCounter.Empty.Increment(node1); var d1 = new DataEnvelope(g1); var d1a = new DataEnvelope(g1); var g2 = GCounter.Empty.Increment(node2, 2); diff --git a/src/contrib/cluster/Akka.DistributedData.Tests/DeltaPropagationSelectorSpec.cs b/src/contrib/cluster/Akka.DistributedData.Tests/DeltaPropagationSelectorSpec.cs index aadfdac34a6..5eb279ca0cd 100644 --- a/src/contrib/cluster/Akka.DistributedData.Tests/DeltaPropagationSelectorSpec.cs +++ b/src/contrib/cluster/Akka.DistributedData.Tests/DeltaPropagationSelectorSpec.cs @@ -238,7 +238,7 @@ public void DeltaPropagationSelector_must_discard_too_large_deltas() var data = PNCounterDictionary.Empty; for (int i = 1; i <= 1000; i++) { - var d = data.ResetDelta().Increment(selfUniqueAddress, (i % 2).ToString(), 1); + var d = data.ResetDelta().Increment(selfUniqueAddress, (i % 2).ToString()); selector.Update("A", d.Delta); data = d; } diff --git a/src/contrib/cluster/Akka.DistributedData.Tests/PNCounterDictionarySpec.cs b/src/contrib/cluster/Akka.DistributedData.Tests/PNCounterDictionarySpec.cs index 0e6143a5164..9218b9aa5b7 100644 --- a/src/contrib/cluster/Akka.DistributedData.Tests/PNCounterDictionarySpec.cs +++ b/src/contrib/cluster/Akka.DistributedData.Tests/PNCounterDictionarySpec.cs @@ -36,7 +36,7 @@ public void PNCounterDictionary_must_be_able_to_increment_and_decrement_entries( var m = PNCounterDictionary.Empty .Increment(_node1, "a", 2) .Increment(_node1, "b", 3) - .Decrement(_node2, "a", 1); + .Decrement(_node2, "a"); Assert.Equal(ImmutableDictionary.CreateRange(new[] { @@ -49,7 +49,7 @@ public void PNCounterDictionary_must_be_able_to_increment_and_decrement_entries( public void PNCounterDictionary_must_be_able_to_have_its_entries_correctly_merged_with_another_ORDictionary_with_other_entries() { var m1 = PNCounterDictionary.Empty - .Increment(_node1, "a", 1) + .Increment(_node1, "a") .Increment(_node1, "b", 3) .Increment(_node1, "c", 2); @@ -71,7 +71,7 @@ public void PNCounterDictionary_must_be_able_to_have_its_entries_correctly_merge public void PNCounterDictionary_must_be_able_to_remove_entry() { var m1 = PNCounterDictionary.Empty - .Increment(_node1, "a", 1) + .Increment(_node1, "a") .Increment(_node1, "b", 3) .Increment(_node1, "c", 2); @@ -101,7 +101,7 @@ public void PNCounterDictionary_must_be_able_to_remove_entry() public void PNCounterDictionary_must_be_able_to_work_with_deltas() { var m1 = PNCounterDictionary.Empty - .Increment(_node1, "a", 1) + .Increment(_node1, "a") .Increment(_node1, "b", 3) .Increment(_node1, "c", 2); var m2 = PNCounterDictionary.Empty.Increment(_node2, "c", 5); @@ -141,7 +141,7 @@ public void PNCounterDictionary_must_be_able_to_work_with_deltas() public void Bugfix_4198_PNCounterMapDeltas_must_merge_other_PNCounterMaps() { var m1 = PNCounterDictionary.Empty - .Increment(_node1, "a", 1) + .Increment(_node1, "a") .Increment(_node1, "b", 3) .Increment(_node1, "c", 2); var m2 = PNCounterDictionary.Empty.Increment(_node2, "c", 5); @@ -176,7 +176,7 @@ public void Bugfix_4198_PNCounterMapDeltas_must_merge_other_PNCounterMaps() public void Bugfix_4199_PNCounterMaps_must_support_pruning() { var m1 = PNCounterDictionary.Empty - .Increment(_node1, "a", 1) + .Increment(_node1, "a") .Increment(_node1, "b", 3) .Increment(_node1, "c", 2) .Increment(_node2, "a", 2); diff --git a/src/contrib/cluster/Akka.DistributedData.Tests/Serialization/ReplicatedDataSerializerSpec.cs b/src/contrib/cluster/Akka.DistributedData.Tests/Serialization/ReplicatedDataSerializerSpec.cs index 1d68821fc4a..5b9a3e5a693 100644 --- a/src/contrib/cluster/Akka.DistributedData.Tests/Serialization/ReplicatedDataSerializerSpec.cs +++ b/src/contrib/cluster/Akka.DistributedData.Tests/Serialization/ReplicatedDataSerializerSpec.cs @@ -110,7 +110,7 @@ public void ReplicatedDataSerializer_should_serialize_GCounter() CheckSameContent( GCounter.Empty.Increment(_address1, 2).Increment(_address2, 5), - GCounter.Empty.Increment(_address2, 5).Increment(_address1, 1).Increment(_address1, 1)); + GCounter.Empty.Increment(_address2, 5).Increment(_address1).Increment(_address1)); CheckSameContent( GCounter.Empty.Increment(_address1, 2).Increment(_address3, 5), GCounter.Empty.Increment(_address3, 5).Increment(_address1, 2)); @@ -121,19 +121,19 @@ public void ReplicatedDataSerializer_should_serialize_PNCounter() { CheckSerialization(PNCounter.Empty); CheckSerialization(PNCounter.Empty.Increment(_address1, 3)); - CheckSerialization(PNCounter.Empty.Increment(_address1, 3).Decrement(_address1, 1)); + CheckSerialization(PNCounter.Empty.Increment(_address1, 3).Decrement(_address1)); CheckSerialization(PNCounter.Empty.Increment(_address1, 2).Increment(_address2, 5)); - CheckSerialization(PNCounter.Empty.Increment(_address1, 2).Increment(_address2, 5).Decrement(_address1, 1)); + CheckSerialization(PNCounter.Empty.Increment(_address1, 2).Increment(_address2, 5).Decrement(_address1)); CheckSameContent( PNCounter.Empty.Increment(_address1, 2).Increment(_address2, 5), - PNCounter.Empty.Increment(_address2, 5).Increment(_address1, 1).Increment(_address1, 1)); + PNCounter.Empty.Increment(_address2, 5).Increment(_address1).Increment(_address1)); CheckSameContent( PNCounter.Empty.Increment(_address1, 2).Increment(_address3, 5), PNCounter.Empty.Increment(_address3, 5).Increment(_address1, 2)); CheckSameContent( - PNCounter.Empty.Increment(_address1, 2).Decrement(_address1, 1).Increment(_address3, 5), - PNCounter.Empty.Increment(_address3, 5).Increment(_address1, 2).Decrement(_address1, 1)); + PNCounter.Empty.Increment(_address1, 2).Decrement(_address1).Increment(_address3, 5), + PNCounter.Empty.Increment(_address3, 5).Increment(_address1, 2).Decrement(_address1)); } [Fact()] diff --git a/src/contrib/cluster/Akka.DistributedData.Tests/Serialization/ReplicatorMessageSerializerSpec.cs b/src/contrib/cluster/Akka.DistributedData.Tests/Serialization/ReplicatorMessageSerializerSpec.cs index 1300a911e79..3d51b2214e0 100644 --- a/src/contrib/cluster/Akka.DistributedData.Tests/Serialization/ReplicatorMessageSerializerSpec.cs +++ b/src/contrib/cluster/Akka.DistributedData.Tests/Serialization/ReplicatorMessageSerializerSpec.cs @@ -63,7 +63,7 @@ public void ReplicatorMessageSerializer_should_serialize_Replicator_message() var ref1 = Sys.ActorOf(Props.Empty, "ref1"); var data1 = GSet.Create("a"); var delta1 = GCounter.Empty.Increment(_address1, 17).Increment(_address2, 2).Delta; - var delta2 = delta1.Increment(_address2, 1).Delta; + var delta2 = delta1.Increment(_address2).Delta; var delta3 = ORSet.Empty.Add(_address1, "a").Delta; var delta4 = ORMultiValueDictionary.Empty.AddItem(_address1, "a", "b").Delta; diff --git a/src/contrib/cluster/Akka.DistributedData.Tests/WriteAggregatorSpec.cs b/src/contrib/cluster/Akka.DistributedData.Tests/WriteAggregatorSpec.cs index 05a8850ac9b..f4c87608956 100644 --- a/src/contrib/cluster/Akka.DistributedData.Tests/WriteAggregatorSpec.cs +++ b/src/contrib/cluster/Akka.DistributedData.Tests/WriteAggregatorSpec.cs @@ -350,7 +350,7 @@ public void Durable_WriteAggregator_must_reply_with_StoreFailure_when_too_many_n probe.ExpectMsg(); probe.LastSender.Tell(WriteNack.Instance); - ExpectMsg(new StoreFailure(KeyA, null)); + ExpectMsg(new StoreFailure(KeyA)); ExpectTerminated(aggregator); } diff --git a/src/contrib/cluster/Akka.DistributedData/DistributedData.cs b/src/contrib/cluster/Akka.DistributedData/DistributedData.cs index 20f38f7557b..7132928fcad 100644 --- a/src/contrib/cluster/Akka.DistributedData/DistributedData.cs +++ b/src/contrib/cluster/Akka.DistributedData/DistributedData.cs @@ -84,7 +84,7 @@ public DistributedData(ExtendedActorSystem system) } else { - var name = config.GetString("name", null); + var name = config.GetString("name"); Replicator = _settings.RestartReplicatorOnFailure ? system.ActorOf(GetSupervisedReplicator(_settings, name), name+"Supervisor") : system.ActorOf(Akka.DistributedData.Replicator.Props(_settings), name); diff --git a/src/contrib/cluster/Akka.DistributedData/ReadAggregator.cs b/src/contrib/cluster/Akka.DistributedData/ReadAggregator.cs index a2bb7143d16..ad9766d701e 100644 --- a/src/contrib/cluster/Akka.DistributedData/ReadAggregator.cs +++ b/src/contrib/cluster/Akka.DistributedData/ReadAggregator.cs @@ -137,7 +137,7 @@ private Receive WaitRepairAck(DataEnvelope envelope) => msg => { case ReadRepairAck _: var reply = envelope.Data is DeletedData - ? (object)new DataDeleted(_key, null) + ? (object)new DataDeleted(_key) : new GetSuccess(_key, _req, envelope.Data); _replyTo.Tell(reply, Context.Parent); Context.Stop(Self); diff --git a/src/contrib/cluster/Akka.DistributedData/Replicator.cs b/src/contrib/cluster/Akka.DistributedData/Replicator.cs index e79a7e19ba0..09d5f7c8fdd 100644 --- a/src/contrib/cluster/Akka.DistributedData/Replicator.cs +++ b/src/contrib/cluster/Akka.DistributedData/Replicator.cs @@ -489,7 +489,7 @@ private bool Load(object message) var newEnvelope = Write(entry.Key, envelope); if (!ReferenceEquals(newEnvelope, envelope)) { - _durableStore.Tell(new Store(entry.Key, new DurableDataEnvelope(newEnvelope), null)); + _durableStore.Tell(new Store(entry.Key, new DurableDataEnvelope(newEnvelope))); } } return true; @@ -970,7 +970,7 @@ private void Notify(string keyId, HashSet subs) if (envelope != null) { var msg = envelope.Data is DeletedData - ? (object)new DataDeleted(key, null) + ? (object)new DataDeleted(key) : new Changed(key, envelope.Data); foreach (var sub in subs) sub.Tell(msg); @@ -1481,7 +1481,7 @@ private void PerformRemovedNodePruning() SetData(key, newEnvelope); if (!newEnvelope.Data.Equals(data) && isDurable) { - _durableStore.Tell(new Store(key, new DurableDataEnvelope(newEnvelope), null)); + _durableStore.Tell(new Store(key, new DurableDataEnvelope(newEnvelope))); } } } diff --git a/src/contrib/cluster/Akka.DistributedData/ReplicatorSettings.cs b/src/contrib/cluster/Akka.DistributedData/ReplicatorSettings.cs index 9da01886639..c38d25aa16c 100644 --- a/src/contrib/cluster/Akka.DistributedData/ReplicatorSettings.cs +++ b/src/contrib/cluster/Akka.DistributedData/ReplicatorSettings.cs @@ -43,13 +43,13 @@ public static ReplicatorSettings Create(Config config) if (config.IsNullOrEmpty()) throw ConfigurationException.NullOrEmptyConfig(); - var dispatcher = config.GetString("use-dispatcher", null); + var dispatcher = config.GetString("use-dispatcher"); if (string.IsNullOrEmpty(dispatcher)) dispatcher = Dispatchers.InternalDispatcherId; var durableConfig = config.GetConfig("durable"); var durableKeys = durableConfig.GetStringList("keys"); var durableStoreProps = Props.Empty; - var durableStoreTypeName = durableConfig.GetString("store-actor-class", null); + var durableStoreTypeName = durableConfig.GetString("store-actor-class"); if (durableKeys.Count != 0) { @@ -79,7 +79,7 @@ public static ReplicatorSettings Create(Config config) pruningMarkerTimeToLive: config.GetTimeSpan("pruning-marker-time-to-live", TimeSpan.FromHours(6)), durablePruningMarkerTimeToLive: durableConfig.GetTimeSpan("pruning-marker-time-to-live", TimeSpan.FromDays(10)), maxDeltaSize: config.GetInt("delta-crdt.max-delta-size", 50), - restartReplicatorOnFailure: config.GetBoolean("recreate-on-failure", false), + restartReplicatorOnFailure: config.GetBoolean("recreate-on-failure"), preferOldest: config.GetBoolean("prefer-oldest"), verboseDebugLogging: config.GetBoolean("verbose-debug-logging")); } diff --git a/src/contrib/persistence/Akka.Persistence.Query.InMemory/InMemoryReadJournal.cs b/src/contrib/persistence/Akka.Persistence.Query.InMemory/InMemoryReadJournal.cs index 6ecac0ceb51..b59f137ef52 100644 --- a/src/contrib/persistence/Akka.Persistence.Query.InMemory/InMemoryReadJournal.cs +++ b/src/contrib/persistence/Akka.Persistence.Query.InMemory/InMemoryReadJournal.cs @@ -34,8 +34,8 @@ public static Config DefaultConfiguration() public InMemoryReadJournal(Config config) { - _writeJournalPluginId = config.GetString("write-plugin", null); - _maxBufferSize = config.GetInt("max-buffer-size", 0); + _writeJournalPluginId = config.GetString("write-plugin"); + _maxBufferSize = config.GetInt("max-buffer-size"); _refreshInterval = config.GetTimeSpan("refresh-interval", TimeSpan.FromSeconds(1)); } diff --git a/src/contrib/persistence/Akka.Persistence.Query.Sql/SqlReadJournal.cs b/src/contrib/persistence/Akka.Persistence.Query.Sql/SqlReadJournal.cs index 2ca067570fe..3ff7e67df4c 100644 --- a/src/contrib/persistence/Akka.Persistence.Query.Sql/SqlReadJournal.cs +++ b/src/contrib/persistence/Akka.Persistence.Query.Sql/SqlReadJournal.cs @@ -53,9 +53,9 @@ public static Config DefaultConfiguration() public SqlReadJournal(ExtendedActorSystem system, Config config) { - _refreshInterval = config.GetTimeSpan("refresh-interval", null); - var writeJournalPluginId = config.GetString("write-plugin", null); - _maxBufferSize = config.GetInt("max-buffer-size", 0); + _refreshInterval = config.GetTimeSpan("refresh-interval"); + var writeJournalPluginId = config.GetString("write-plugin"); + _maxBufferSize = config.GetInt("max-buffer-size"); _maxConcurrentQueries = config.GetInt("max-concurrent-queries", 50); _system = system; diff --git a/src/contrib/persistence/Akka.Persistence.Sql.Common/Journal/BatchingSqlJournal.cs b/src/contrib/persistence/Akka.Persistence.Sql.Common/Journal/BatchingSqlJournal.cs index 993ea79cc45..908d600c6ad 100644 --- a/src/contrib/persistence/Akka.Persistence.Sql.Common/Journal/BatchingSqlJournal.cs +++ b/src/contrib/persistence/Akka.Persistence.Sql.Common/Journal/BatchingSqlJournal.cs @@ -90,7 +90,7 @@ public ReplayFilterSettings(Config config) Mode = mode; WindowSize = config.GetInt("window-size", 100); MaxOldWriters = config.GetInt("max-old-writers", 10); - IsDebug = config.GetBoolean("debug", false); + IsDebug = config.GetBoolean("debug"); } /// @@ -277,7 +277,7 @@ protected BatchingSqlJournalSetup(Config config, QueryConfiguration namingConven if (config.IsNullOrEmpty()) throw ConfigurationException.NullOrEmptyConfig(); - var connectionString = config.GetString("connection-string", null); + var connectionString = config.GetString("connection-string"); if (string.IsNullOrWhiteSpace(connectionString)) { connectionString = System.Configuration.ConfigurationManager @@ -300,15 +300,15 @@ protected BatchingSqlJournalSetup(Config config, QueryConfiguration namingConven MaxConcurrentOperations = config.GetInt("max-concurrent-operations", 64); MaxBatchSize = config.GetInt("max-batch-size", 100); MaxBufferSize = config.GetInt("max-buffer-size", 500000); - AutoInitialize = config.GetBoolean("auto-initialize", false); + AutoInitialize = config.GetBoolean("auto-initialize"); ConnectionTimeout = config.GetTimeSpan("connection-timeout", TimeSpan.FromSeconds(30)); CircuitBreakerSettings = new CircuitBreakerSettings(config.GetConfig("circuit-breaker")); ReplayFilterSettings = new ReplayFilterSettings(config.GetConfig("replay-filter")); NamingConventions = namingConventions; #pragma warning disable CS0618 - DefaultSerializer = config.GetString("serializer", null); + DefaultSerializer = config.GetString("serializer"); #pragma warning restore CS0618 - TimestampProviderTypeName = config.GetString("timestamp-provider", null); + TimestampProviderTypeName = config.GetString("timestamp-provider"); } /// diff --git a/src/contrib/persistence/Akka.Persistence.Sql.Common/Settings.cs b/src/contrib/persistence/Akka.Persistence.Sql.Common/Settings.cs index 14a577e0efe..edd0c8ab686 100644 --- a/src/contrib/persistence/Akka.Persistence.Sql.Common/Settings.cs +++ b/src/contrib/persistence/Akka.Persistence.Sql.Common/Settings.cs @@ -83,7 +83,7 @@ public JournalSettings(Config config) ConnectionString = config.GetString("connection-string"); ConnectionStringName = config.GetString("connection-string-name"); ConnectionTimeout = config.GetTimeSpan("connection-timeout"); - SchemaName = config.GetString("schema-name", null); + SchemaName = config.GetString("schema-name"); JournalTableName = config.GetString("table-name"); MetaTableName = config.GetString("metadata-table-name"); TimestampProvider = config.GetString("timestamp-provider"); @@ -160,11 +160,11 @@ public SnapshotStoreSettings(Config config) ConnectionString = config.GetString("connection-string"); ConnectionStringName = config.GetString("connection-string-name"); ConnectionTimeout = config.GetTimeSpan("connection-timeout"); - SchemaName = config.GetString("schema-name", null); + SchemaName = config.GetString("schema-name"); TableName = config.GetString("table-name"); AutoInitialize = config.GetBoolean("auto-initialize"); #pragma warning disable CS0618 - DefaultSerializer = config.GetString("serializer", null); + DefaultSerializer = config.GetString("serializer"); #pragma warning restore CS0618 ReadIsolationLevel = config.GetIsolationLevel("read-isolation-level"); diff --git a/src/contrib/persistence/Akka.Persistence.Sql.TestKit/DefaultConfigSpec.cs b/src/contrib/persistence/Akka.Persistence.Sql.TestKit/DefaultConfigSpec.cs index 3325d73605a..97ef113eace 100644 --- a/src/contrib/persistence/Akka.Persistence.Sql.TestKit/DefaultConfigSpec.cs +++ b/src/contrib/persistence/Akka.Persistence.Sql.TestKit/DefaultConfigSpec.cs @@ -28,9 +28,9 @@ public void SqlReadJournal_applies_default_config() var config = Sys.Settings.Config.GetConfig("akka.persistence.query.journal.sql"); config.IsNullOrEmpty().Should().BeFalse(); - config.GetString("class", null).Should().Be("Akka.Persistence.Query.Sql.SqlReadJournalProvider, Akka.Persistence.Query.Sql"); + config.GetString("class").Should().Be("Akka.Persistence.Query.Sql.SqlReadJournalProvider, Akka.Persistence.Query.Sql"); config.GetTimeSpan("refresh-interval", TimeSpan.MinValue).Should().Be(TimeSpan.FromSeconds(3)); - config.GetInt("max-buffer-size", 0).Should().Be(100); + config.GetInt("max-buffer-size").Should().Be(100); } } } diff --git a/src/contrib/persistence/Akka.Persistence.Sqlite.Tests/SqliteConfigSpec.cs b/src/contrib/persistence/Akka.Persistence.Sqlite.Tests/SqliteConfigSpec.cs index 68f403e82ff..b085256de58 100644 --- a/src/contrib/persistence/Akka.Persistence.Sqlite.Tests/SqliteConfigSpec.cs +++ b/src/contrib/persistence/Akka.Persistence.Sqlite.Tests/SqliteConfigSpec.cs @@ -71,7 +71,7 @@ public void Sqlite_JournalSettings_default_should_contain_default_config() settings.ConnectionStringName.Should().Be(config.GetString("connection-string-name")); settings.ConnectionTimeout.Should().Be(config.GetTimeSpan("connection-timeout")); settings.JournalTableName.Should().Be(config.GetString("table-name")); - settings.SchemaName.Should().Be(config.GetString("schema-name", null)); + settings.SchemaName.Should().Be(config.GetString("schema-name")); settings.MetaTableName.Should().Be(config.GetString("metadata-table-name")); settings.TimestampProvider.Should().Be(config.GetString("timestamp-provider")); settings.ReadIsolationLevel.Should().Be(config.GetIsolationLevel("read-isolation-level")); @@ -123,13 +123,13 @@ public void Sqlite_SnapshotStoreSettings_default_should_contain_default_config() settings.ConnectionString.Should().Be(config.GetString("connection-string")); settings.ConnectionStringName.Should().Be(config.GetString("connection-string-name")); settings.ConnectionTimeout.Should().Be(config.GetTimeSpan("connection-timeout")); - settings.SchemaName.Should().Be(config.GetString("schema-name", null)); + settings.SchemaName.Should().Be(config.GetString("schema-name")); settings.TableName.Should().Be(config.GetString("table-name")); settings.ReadIsolationLevel.Should().Be(config.GetIsolationLevel("read-isolation-level")); settings.WriteIsolationLevel.Should().Be(config.GetIsolationLevel("write-isolation-level")); settings.AutoInitialize.Should().Be(config.GetBoolean("auto-initialize")); #pragma warning disable CS0618 - settings.DefaultSerializer.Should().Be(config.GetString("serializer", null)); + settings.DefaultSerializer.Should().Be(config.GetString("serializer")); #pragma warning restore CS0618 } diff --git a/src/contrib/persistence/Akka.Persistence.Sqlite/Journal/BatchingSqliteJournal.cs b/src/contrib/persistence/Akka.Persistence.Sqlite/Journal/BatchingSqliteJournal.cs index 300b71efe3f..8a7ac02dd44 100644 --- a/src/contrib/persistence/Akka.Persistence.Sqlite/Journal/BatchingSqliteJournal.cs +++ b/src/contrib/persistence/Akka.Persistence.Sqlite/Journal/BatchingSqliteJournal.cs @@ -29,8 +29,8 @@ public sealed class BatchingSqliteJournalSetup : BatchingSqlJournalSetup /// Config object used to obtain Journal settings public BatchingSqliteJournalSetup(Config config) : base(config, new QueryConfiguration( schemaName: null, - journalEventsTableName: config.GetString("table-name", null), - metaTableName: config.GetString("metadata-table-name", null), + journalEventsTableName: config.GetString("table-name"), + metaTableName: config.GetString("metadata-table-name"), persistenceIdColumnName: "persistence_id", sequenceNrColumnName: "sequence_nr", payloadColumnName: "payload", @@ -40,9 +40,9 @@ public sealed class BatchingSqliteJournalSetup : BatchingSqlJournalSetup tagsColumnName: "tags", orderingColumnName: "ordering", serializerIdColumnName: "serializer_id", - timeout: config.GetTimeSpan("connection-timeout", null), - defaultSerializer: config.GetString("serializer", null), - useSequentialAccess: config.GetBoolean("use-sequential-access", false), + timeout: config.GetTimeSpan("connection-timeout"), + defaultSerializer: config.GetString("serializer"), + useSequentialAccess: config.GetBoolean("use-sequential-access"), readIsolationLevel: config.GetIsolationLevel("read-isolation-level"), writeIsolationLevel: config.GetIsolationLevel("write-isolation-level"))) { diff --git a/src/contrib/persistence/Akka.Persistence.Sqlite/Journal/SqliteJournal.cs b/src/contrib/persistence/Akka.Persistence.Sqlite/Journal/SqliteJournal.cs index 5194f022459..6148908404d 100644 --- a/src/contrib/persistence/Akka.Persistence.Sqlite/Journal/SqliteJournal.cs +++ b/src/contrib/persistence/Akka.Persistence.Sqlite/Journal/SqliteJournal.cs @@ -32,8 +32,8 @@ public SqliteJournal(Config journalConfig) : base(journalConfig.WithFallback(Ext var config = journalConfig.WithFallback(Extension.DefaultJournalConfig); QueryExecutor = new SqliteQueryExecutor(new QueryConfiguration( schemaName: null, - journalEventsTableName: config.GetString("table-name", null), - metaTableName: config.GetString("metadata-table-name", null), + journalEventsTableName: config.GetString("table-name"), + metaTableName: config.GetString("metadata-table-name"), persistenceIdColumnName: "persistence_id", sequenceNrColumnName: "sequence_nr", payloadColumnName: "payload", @@ -43,13 +43,13 @@ public SqliteJournal(Config journalConfig) : base(journalConfig.WithFallback(Ext tagsColumnName: "tags", orderingColumnName: "ordering", serializerIdColumnName: "serializer_id", - timeout: config.GetTimeSpan("connection-timeout", null), - defaultSerializer: config.GetString("serializer", null), - useSequentialAccess: config.GetBoolean("use-sequential-access", false), + timeout: config.GetTimeSpan("connection-timeout"), + defaultSerializer: config.GetString("serializer"), + useSequentialAccess: config.GetBoolean("use-sequential-access"), readIsolationLevel: Settings.ReadIsolationLevel, writeIsolationLevel: Settings.WriteIsolationLevel), Context.System.Serialization, - GetTimestampProvider(config.GetString("timestamp-provider", null))); + GetTimestampProvider(config.GetString("timestamp-provider"))); } /// diff --git a/src/contrib/persistence/Akka.Persistence.Sqlite/Snapshot/SqliteSnapshotStore.cs b/src/contrib/persistence/Akka.Persistence.Sqlite/Snapshot/SqliteSnapshotStore.cs index 2a9b698d50e..444a04ac319 100644 --- a/src/contrib/persistence/Akka.Persistence.Sqlite/Snapshot/SqliteSnapshotStore.cs +++ b/src/contrib/persistence/Akka.Persistence.Sqlite/Snapshot/SqliteSnapshotStore.cs @@ -122,8 +122,8 @@ public SqliteSnapshotStore(Config snapshotConfig) : timestampColumnName: "created_at", serializerIdColumnName: "serializer_id", timeout: config.GetTimeSpan("connection-timeout"), - defaultSerializer: config.GetString("serializer", null), - useSequentialAccess: config.GetBoolean("use-sequential-access", false), + defaultSerializer: config.GetString("serializer"), + useSequentialAccess: config.GetBoolean("use-sequential-access"), readIsolationLevel: Settings.ReadIsolationLevel, writeIsolationLevel: Settings.WriteIsolationLevel), Context.System.Serialization); diff --git a/src/contrib/serializers/Akka.Serialization.Hyperion/HyperionSerializer.cs b/src/contrib/serializers/Akka.Serialization.Hyperion/HyperionSerializer.cs index cac7b920717..7ae03d8a0b0 100644 --- a/src/contrib/serializers/Akka.Serialization.Hyperion/HyperionSerializer.cs +++ b/src/contrib/serializers/Akka.Serialization.Hyperion/HyperionSerializer.cs @@ -190,7 +190,7 @@ public static HyperionSerializerSettings Create(Config config) if (config.IsNullOrEmpty()) throw ConfigurationException.NullOrEmptyConfig("akka.actor.serialization-settings.hyperion"); - var typeName = config.GetString("known-types-provider", null); + var typeName = config.GetString("known-types-provider"); var type = !string.IsNullOrWhiteSpace(typeName) ? Type.GetType(typeName, true) : null; var framework = RuntimeInformation.FrameworkDescription; diff --git a/src/core/Akka.Cluster.Tests/ClusterConfigSpec.cs b/src/core/Akka.Cluster.Tests/ClusterConfigSpec.cs index 563dffdf260..65b43e59b1a 100644 --- a/src/core/Akka.Cluster.Tests/ClusterConfigSpec.cs +++ b/src/core/Akka.Cluster.Tests/ClusterConfigSpec.cs @@ -60,13 +60,13 @@ public void Clustering_must_be_able_to_parse_generic_cluster_config_elements() settings.ReduceGossipDifferentViewProbability.Should().Be(400); Type.GetType(settings.FailureDetectorImplementationClass).Should().Be(typeof(PhiAccrualFailureDetector)); - settings.FailureDetectorConfig.GetTimeSpan("heartbeat-interval", null).Should().Be(1.Seconds()); - settings.FailureDetectorConfig.GetDouble("threshold", 0).Should().Be(8.0d); - settings.FailureDetectorConfig.GetInt("max-sample-size", 0).Should().Be(1000); - settings.FailureDetectorConfig.GetTimeSpan("min-std-deviation", null).Should().Be(100.Milliseconds()); - settings.FailureDetectorConfig.GetTimeSpan("acceptable-heartbeat-pause", null).Should().Be(3.Seconds()); - settings.FailureDetectorConfig.GetInt("monitored-by-nr-of-members", 0).Should().Be(9); - settings.FailureDetectorConfig.GetTimeSpan("expected-response-after", null).Should().Be(1.Seconds()); + settings.FailureDetectorConfig.GetTimeSpan("heartbeat-interval").Should().Be(1.Seconds()); + settings.FailureDetectorConfig.GetDouble("threshold").Should().Be(8.0d); + settings.FailureDetectorConfig.GetInt("max-sample-size").Should().Be(1000); + settings.FailureDetectorConfig.GetTimeSpan("min-std-deviation").Should().Be(100.Milliseconds()); + settings.FailureDetectorConfig.GetTimeSpan("acceptable-heartbeat-pause").Should().Be(3.Seconds()); + settings.FailureDetectorConfig.GetInt("monitored-by-nr-of-members").Should().Be(9); + settings.FailureDetectorConfig.GetTimeSpan("expected-response-after").Should().Be(1.Seconds()); settings.SchedulerTickDuration.Should().Be(33.Milliseconds()); settings.SchedulerTicksPerWheel.Should().Be(512); diff --git a/src/core/Akka.Cluster.Tests/DowningProviderSpec.cs b/src/core/Akka.Cluster.Tests/DowningProviderSpec.cs index c9831428734..e2fd21e81f0 100644 --- a/src/core/Akka.Cluster.Tests/DowningProviderSpec.cs +++ b/src/core/Akka.Cluster.Tests/DowningProviderSpec.cs @@ -36,7 +36,7 @@ public Props DowningActorProps internal class DummyDowningProvider : IDowningProvider { - public readonly AtomicBoolean ActorPropsAccessed = new AtomicBoolean(false); + public readonly AtomicBoolean ActorPropsAccessed = new AtomicBoolean(); public DummyDowningProvider(ActorSystem system, Cluster cluster) { } diff --git a/src/core/Akka.Cluster.Tests/Routing/ClusterRouterAsk1343BugFixSpec.cs b/src/core/Akka.Cluster.Tests/Routing/ClusterRouterAsk1343BugFixSpec.cs index 90e5ac1f9c9..69f3acd137d 100644 --- a/src/core/Akka.Cluster.Tests/Routing/ClusterRouterAsk1343BugFixSpec.cs +++ b/src/core/Akka.Cluster.Tests/Routing/ClusterRouterAsk1343BugFixSpec.cs @@ -72,7 +72,7 @@ public ClusterRouterAsk1343BugFixSpec() [Fact] public async Task Should_Ask_Clustered_Pool_Router_and_forward_ask_to_routee() { - var router = Sys.ActorOf(EchoActor.Props(this, true).WithRouter(FromConfig.Instance), "router1"); + var router = Sys.ActorOf(EchoActor.Props(this).WithRouter(FromConfig.Instance), "router1"); Assert.IsType(router); var result = await router.Ask("foo"); @@ -82,7 +82,7 @@ public async Task Should_Ask_Clustered_Pool_Router_and_forward_ask_to_routee() [Fact] public async Task Should_Ask_Clustered_Group_Router_and_forward_ask_to_routee() { - var echo = Sys.ActorOf(EchoActor.Props(this, true), "echo"); + var echo = Sys.ActorOf(EchoActor.Props(this), "echo"); var router = Sys.ActorOf(Props.Empty.WithRouter(FromConfig.Instance), "router2"); Assert.IsType(router); diff --git a/src/core/Akka.Cluster.Tests/SBR/SplitBrainResolverSpec.cs b/src/core/Akka.Cluster.Tests/SBR/SplitBrainResolverSpec.cs index aed61eb05b5..9f41327f2e6 100644 --- a/src/core/Akka.Cluster.Tests/SBR/SplitBrainResolverSpec.cs +++ b/src/core/Akka.Cluster.Tests/SBR/SplitBrainResolverSpec.cs @@ -368,7 +368,7 @@ public override DowningStrategy CreateStrategy() [Fact] public void KeepMajority_must_down_minority_partition_A_C_E__B_D___A_C_E() { - var setup = new KeepMajoritySetup(this, null); + var setup = new KeepMajoritySetup(this); setup.Side1 = ImmutableHashSet.Create(MemberA, MemberC, MemberE); setup.Side2 = ImmutableHashSet.Create(MemberB, MemberD); setup.AssertDowning(setup.Side2); @@ -377,7 +377,7 @@ public void KeepMajority_must_down_minority_partition_A_C_E__B_D___A_C_E() [Fact] public void KeepMajority_must_down_minority_partition_A_B__C_D_E___C_D_E() { - var setup = new KeepMajoritySetup(this, null); + var setup = new KeepMajoritySetup(this); setup.Side1 = ImmutableHashSet.Create(MemberA, MemberB); setup.Side2 = ImmutableHashSet.Create(MemberC, MemberD, MemberE); setup.AssertDowning(setup.Side1); @@ -386,7 +386,7 @@ public void KeepMajority_must_down_minority_partition_A_B__C_D_E___C_D_E() [Fact] public void KeepMajority_must_down_self_when_alone_B__A_C___A_C() { - var setup = new KeepMajoritySetup(this, null); + var setup = new KeepMajoritySetup(this); setup.Side1 = ImmutableHashSet.Create(MemberB); setup.Side2 = ImmutableHashSet.Create(MemberA, MemberC); setup.AssertDowning(setup.Side1); @@ -395,7 +395,7 @@ public void KeepMajority_must_down_self_when_alone_B__A_C___A_C() [Fact] public void KeepMajority_must_keep_half_with_lowest_address_when_equal_size_partition_A_B__C_D___A_B() { - var setup = new KeepMajoritySetup(this, null); + var setup = new KeepMajoritySetup(this); setup.Side1 = ImmutableHashSet.Create(MemberA, MemberB); setup.Side2 = ImmutableHashSet.Create(MemberC, MemberD); setup.AssertDowning(setup.Side2); @@ -404,7 +404,7 @@ public void KeepMajority_must_keep_half_with_lowest_address_when_equal_size_part [Fact] public void KeepMajority_must_keep_node_with_lowest_address_in_two_node_cluster_A__B___A() { - var setup = new KeepMajoritySetup(this, null); + var setup = new KeepMajoritySetup(this); setup.Side1 = ImmutableHashSet.Create(MemberA); setup.Side2 = ImmutableHashSet.Create(MemberB); setup.AssertDowning(setup.Side2); @@ -441,7 +441,7 @@ public void KeepMajority_must_down_all_when_no_node_with_role_C__E___() [Fact] public void KeepMajority_must_not_count_joining_node_but_down_it_B_D__Aj_C___B_D() { - var setup = new KeepMajoritySetup(this, null); + var setup = new KeepMajoritySetup(this); setup.Side1 = ImmutableHashSet.Create(MemberB, MemberD); setup.Side2 = ImmutableHashSet.Create(Joining(MemberA), MemberC); setup.AssertDowning(setup.Side2); @@ -450,7 +450,7 @@ public void KeepMajority_must_not_count_joining_node_but_down_it_B_D__Aj_C___B_D [Fact] public void KeepMajority_must_down_minority_partition_and_joining_node_A_Bj__C_D_E___C_D_E() { - var setup = new KeepMajoritySetup(this, null); + var setup = new KeepMajoritySetup(this); setup.Side1 = ImmutableHashSet.Create(MemberA, Joining(MemberB)); setup.Side2 = ImmutableHashSet.Create(MemberC, MemberD, MemberE); setup.AssertDowning(setup.Side1); @@ -459,7 +459,7 @@ public void KeepMajority_must_down_minority_partition_and_joining_node_A_Bj__C_D [Fact] public void KeepMajority_must_down_each_part_when_split_in_3_too_small_parts_A_B__C_D__E___() { - var setup = new KeepMajoritySetup(this, null); + var setup = new KeepMajoritySetup(this); setup.Side1 = ImmutableHashSet.Create(MemberA, MemberB); setup.Side2 = ImmutableHashSet.Create(MemberC, MemberD); setup.Side3 = ImmutableHashSet.Create(MemberE); @@ -471,7 +471,7 @@ public void KeepMajority_must_down_each_part_when_split_in_3_too_small_parts_A_B [Fact] public void KeepMajority_must_detect_edge_case_of_membership_change_A_B_F_G__C_D_E___A_B_F_G() { - var setup = new KeepMajoritySetup(this, null); + var setup = new KeepMajoritySetup(this); setup.Side1 = ImmutableHashSet.Create(MemberA, MemberB, MemberF, MemberG); setup.Side2 = ImmutableHashSet.Create(MemberC, MemberD, MemberE); @@ -492,7 +492,7 @@ public void KeepMajority_must_detect_edge_case_of_membership_change_A_B_F_G__C_D [Fact] public void KeepMajority_must_detect_edge_case_of_membership_change_when_equal_size_A_B_F__C_D_E___A_B_F() { - var setup = new KeepMajoritySetup(this, null); + var setup = new KeepMajoritySetup(this); setup.Side1 = ImmutableHashSet.Create(MemberA, MemberB, MemberF); setup.Side2 = ImmutableHashSet.Create(MemberC, MemberD, MemberE); @@ -515,7 +515,7 @@ public void KeepMajority_must_detect_edge_case_of_membership_change_when_equal_s [Fact] public void KeepMajority_must_detect_safe_edge_case_of_membership_change_A_B__C_D_E_F___C_D_E_F() { - var setup = new KeepMajoritySetup(this, null); + var setup = new KeepMajoritySetup(this); setup.Side1 = ImmutableHashSet.Create(MemberA, MemberB); setup.Side2 = ImmutableHashSet.Create(MemberC, MemberD, MemberE, Joining(MemberF)); @@ -535,7 +535,7 @@ public void KeepMajority_must_detect_safe_edge_case_of_membership_change_A_B__C_ [Fact] public void KeepMajority_must_detect_edge_case_of_leaving_exiting_membership_change_A_B__C_D___C_D() { - var setup = new KeepMajoritySetup(this, null); + var setup = new KeepMajoritySetup(this); setup.Side1 = ImmutableHashSet.Create(Leaving(MemberA), MemberB, Joining(MemberE)); setup.Side2 = ImmutableHashSet.Create(MemberC, MemberD); @@ -557,7 +557,7 @@ public void KeepMajority_must_detect_edge_case_of_leaving_exiting_membership_cha [Fact] public void KeepMajority_must_down_indirectly_connected_A_B___() { - var setup = new KeepMajoritySetup(this, null); + var setup = new KeepMajoritySetup(this); setup.Side1 = ImmutableHashSet.Create(MemberA, MemberB); setup.IndirectlyConnected = ImmutableHashSet.Create( (MemberA, MemberB), @@ -568,7 +568,7 @@ public void KeepMajority_must_down_indirectly_connected_A_B___() [Fact] public void KeepMajority_must_down_indirectly_connected_A_B__C___C() { - var setup = new KeepMajoritySetup(this, null); + var setup = new KeepMajoritySetup(this); setup.Side1 = ImmutableHashSet.Create(MemberA, MemberB, MemberC); setup.IndirectlyConnected = ImmutableHashSet.Create( (MemberA, MemberB), @@ -580,7 +580,7 @@ public void KeepMajority_must_down_indirectly_connected_A_B__C___C() [Fact] public void KeepMajority_must_down_indirectly_connected_A_B__C___() { - var setup = new KeepMajoritySetup(this, null); + var setup = new KeepMajoritySetup(this); setup.Side1 = ImmutableHashSet.Create(MemberA, MemberB, MemberC); setup.IndirectlyConnected = ImmutableHashSet.Create( (MemberA, MemberB), @@ -592,7 +592,7 @@ public void KeepMajority_must_down_indirectly_connected_A_B__C___() [Fact] public void KeepMajority_must_down_indirectly_connected_A_B_C_D___() { - var setup = new KeepMajoritySetup(this, null); + var setup = new KeepMajoritySetup(this); setup.Side1 = ImmutableHashSet.Create(MemberA, MemberB, MemberC, MemberD); setup.IndirectlyConnected = ImmutableHashSet.Create( (MemberA, MemberD), @@ -605,7 +605,7 @@ public void KeepMajority_must_down_indirectly_connected_A_B_C_D___() [Fact] public void KeepMajority_must_down_indirectly_connected_A_B_C__D_E___D_E() { - var setup = new KeepMajoritySetup(this, null); + var setup = new KeepMajoritySetup(this); setup.Side1 = ImmutableHashSet.Create(MemberA, MemberB, MemberC, MemberD, MemberE); setup.IndirectlyConnected = ImmutableHashSet.Create( (MemberA, MemberB), @@ -618,7 +618,7 @@ public void KeepMajority_must_down_indirectly_connected_A_B_C__D_E___D_E() [Fact] public void KeepMajority_must_down_indirectly_connected_A__B_C__D__E_F__G___A_D_G() { - var setup = new KeepMajoritySetup(this, null); + var setup = new KeepMajoritySetup(this); setup.Side1 = ImmutableHashSet.Create(MemberA, MemberB, MemberC, MemberD, MemberE, MemberF, MemberG); // two groups of indirectly connected, 4 in total setup.IndirectlyConnected = ImmutableHashSet.Create( @@ -633,7 +633,7 @@ public void KeepMajority_must_down_indirectly_connected_A__B_C__D__E_F__G___A_D_ [Fact] public void KeepMajority_must_down_indirectly_connected_detected_via_seen_A_B_C___() { - var setup = new KeepMajoritySetup(this, null); + var setup = new KeepMajoritySetup(this); setup.Side1 = ImmutableHashSet.Create(MemberA, MemberB, MemberC); setup.IndirectlyConnected = ImmutableHashSet.Create( (MemberA, MemberB), @@ -644,7 +644,7 @@ public void KeepMajority_must_down_indirectly_connected_detected_via_seen_A_B_C_ [Fact] public void KeepMajority_must_down_indirectly_connected_detected_via_seen_A_B_C_D__E___E() { - var setup = new KeepMajoritySetup(this, null); + var setup = new KeepMajoritySetup(this); setup.Side1 = ImmutableHashSet.Create(MemberA, MemberB, MemberC, MemberD, MemberE); setup.IndirectlyConnected = ImmutableHashSet.Create( (MemberB, MemberC), @@ -657,7 +657,7 @@ public void KeepMajority_must_down_indirectly_connected_detected_via_seen_A_B_C_ [Fact] public void KeepMajority_must_down_indirectly_connected_when_combined_with_crashed_A_B__D_E__C___D_E() { - var setup = new KeepMajoritySetup(this, null); + var setup = new KeepMajoritySetup(this); setup.Side1 = ImmutableHashSet.Create(MemberA, MemberB, MemberD, MemberE); setup.Side2 = ImmutableHashSet.Create(MemberC); setup.IndirectlyConnected = ImmutableHashSet.Create( @@ -671,7 +671,7 @@ public void KeepMajority_must_down_indirectly_connected_when_combined_with_crash [Fact] public void KeepMajority_must_down_indirectly_connected_when_combined_with_clean_partition_A__B_C__D_E___A() { - var setup = new KeepMajoritySetup(this, null); + var setup = new KeepMajoritySetup(this); setup.Side1 = ImmutableHashSet.Create(MemberA, MemberB, MemberC); setup.Side2 = ImmutableHashSet.Create(MemberD, MemberE); setup.IndirectlyConnected = ImmutableHashSet.Create( @@ -701,7 +701,7 @@ public void KeepMajority_must_down_indirectly_connected_when_combined_with_clean [Fact] public void KeepMajority_must_down_indirectly_connected_on_minority_side_when_combined_with_clean_partition_A__B_C__D_E_F_G___D_E_F_G() { - var setup = new KeepMajoritySetup(this, null); + var setup = new KeepMajoritySetup(this); setup.Side1 = ImmutableHashSet.Create(MemberA, MemberB, MemberC); setup.Side2 = ImmutableHashSet.Create(MemberD, MemberE, MemberF, MemberG); setup.IndirectlyConnected = ImmutableHashSet.Create( @@ -726,7 +726,7 @@ public void KeepMajority_must_down_indirectly_connected_on_minority_side_when_co [Fact] public void KeepMajority_must_down_indirectly_connected_on_majority_side_when_combined_with_clean_partition_A_B_C__D_E__F_G___F_G() { - var setup = new KeepMajoritySetup(this, null); + var setup = new KeepMajoritySetup(this); setup.Side1 = ImmutableHashSet.Create(MemberA, MemberB, MemberC); setup.Side2 = ImmutableHashSet.Create(MemberD, MemberE, MemberF, MemberG); @@ -753,7 +753,7 @@ public void KeepMajority_must_down_indirectly_connected_on_majority_side_when_co [Fact] public void KeepMajority_must_down_indirectly_connected_spanning_across_a_clean_partition_A__B__C__D__E_F__G___D_G() { - var setup = new KeepMajoritySetup(this, null); + var setup = new KeepMajoritySetup(this); setup.Side1 = ImmutableHashSet.Create(MemberA, MemberB, MemberC); setup.Side2 = ImmutableHashSet.Create(MemberD, MemberE, MemberF, MemberG); setup.IndirectlyConnected = ImmutableHashSet.Create( @@ -771,7 +771,7 @@ public void KeepMajority_must_down_indirectly_connected_spanning_across_a_clean_ [Fact] public void KeepMajority_must_down_indirectly_connected_detected_via_seen_combined_with_clean_partition_A_B_C__D_E__F_G___() { - var setup = new KeepMajoritySetup(this, null); + var setup = new KeepMajoritySetup(this); setup.Side1 = ImmutableHashSet.Create(MemberA, MemberB, MemberC); setup.Side2 = ImmutableHashSet.Create(MemberD, MemberE, MemberF, MemberG); @@ -788,7 +788,7 @@ public void KeepMajority_must_down_indirectly_connected_detected_via_seen_combin [Fact] public void KeepMajority_must_double_DownIndirectlyConnected_when_indirectly_connected_happens_before_clean_partition_A_B_C__D_E__F_G___() { - var setup = new KeepMajoritySetup(this, null); + var setup = new KeepMajoritySetup(this); setup.Side1 = ImmutableHashSet.Create(MemberA, MemberB, MemberC); setup.Side2 = ImmutableHashSet.Create(MemberD, MemberE, MemberF, MemberG); // trouble when indirectly connected happens before clean partition diff --git a/src/core/Akka.Cluster/Cluster.cs b/src/core/Akka.Cluster/Cluster.cs index e331901c0b8..fd3019a49ef 100644 --- a/src/core/Akka.Cluster/Cluster.cs +++ b/src/core/Akka.Cluster/Cluster.cs @@ -543,7 +543,7 @@ public ImmutableHashSet SelfRoles /// public Member SelfMember => _readView.Self; - private readonly AtomicBoolean _isTerminated = new AtomicBoolean(false); + private readonly AtomicBoolean _isTerminated = new AtomicBoolean(); /// /// Determine whether or not this cluster instance has been shutdown. diff --git a/src/core/Akka.Cluster/ClusterActorRefProvider.cs b/src/core/Akka.Cluster/ClusterActorRefProvider.cs index e789fb94cd0..303efff8f33 100644 --- a/src/core/Akka.Cluster/ClusterActorRefProvider.cs +++ b/src/core/Akka.Cluster/ClusterActorRefProvider.cs @@ -158,12 +158,12 @@ public override Deploy ParseConfig(string key, Config config) { Config config2 = config; if (config.HasPath("cluster.enabled") - && config.GetBoolean("cluster.enabled", false) + && config.GetBoolean("cluster.enabled") && !config.HasPath("nr-of-instances")) { var maxTotalNrOfInstances = config .WithFallback(Default) - .GetInt("cluster.max-total-nr-of-instances", 0); + .GetInt("cluster.max-total-nr-of-instances"); config2 = ConfigurationFactory.ParseString("nr-of-instances=" + maxTotalNrOfInstances) .WithFallback(config); } @@ -171,7 +171,7 @@ public override Deploy ParseConfig(string key, Config config) var deploy = base.ParseConfig(key, config2); if (deploy != null) { - if (deploy.Config.GetBoolean("cluster.enabled", false)) + if (deploy.Config.GetBoolean("cluster.enabled")) { if (deploy.Scope != Deploy.NoScopeGiven) throw new ConfigurationException($"Cluster deployment can't be combined with scope [{deploy.Scope}]"); diff --git a/src/core/Akka.Cluster/ClusterSettings.cs b/src/core/Akka.Cluster/ClusterSettings.cs index 5feabb6cca1..069fed56c3f 100644 --- a/src/core/Akka.Cluster/ClusterSettings.cs +++ b/src/core/Akka.Cluster/ClusterSettings.cs @@ -37,23 +37,23 @@ public ClusterSettings(Config config, string systemName) if (clusterConfig?.GetConfig("failure-detector") == null) throw new ConfigurationException($"Failed to instantiate {nameof(ClusterSettings)}: Configuration does not contain `akka.cluster` node. Did you forgot to set the 'akka.cluster.provider' HOCON property to 'cluster'?"); - LogInfoVerbose = clusterConfig.GetBoolean("log-info-verbose", false); - LogInfo = LogInfoVerbose || clusterConfig.GetBoolean("log-info", false); + LogInfoVerbose = clusterConfig.GetBoolean("log-info-verbose"); + LogInfo = LogInfoVerbose || clusterConfig.GetBoolean("log-info"); _failureDetectorConfig = clusterConfig.GetConfig("failure-detector"); - FailureDetectorImplementationClass = _failureDetectorConfig.GetString("implementation-class", null); - HeartbeatInterval = _failureDetectorConfig.GetTimeSpan("heartbeat-interval", null); - HeartbeatExpectedResponseAfter = _failureDetectorConfig.GetTimeSpan("expected-response-after", null); - MonitoredByNrOfMembers = _failureDetectorConfig.GetInt("monitored-by-nr-of-members", 0); + FailureDetectorImplementationClass = _failureDetectorConfig.GetString("implementation-class"); + HeartbeatInterval = _failureDetectorConfig.GetTimeSpan("heartbeat-interval"); + HeartbeatExpectedResponseAfter = _failureDetectorConfig.GetTimeSpan("expected-response-after"); + MonitoredByNrOfMembers = _failureDetectorConfig.GetInt("monitored-by-nr-of-members"); SeedNodes = clusterConfig.GetStringList("seed-nodes", new string[] { }).Select(Address.Parse).ToImmutableList(); - SeedNodeTimeout = clusterConfig.GetTimeSpan("seed-node-timeout", null); + SeedNodeTimeout = clusterConfig.GetTimeSpan("seed-node-timeout"); RetryUnsuccessfulJoinAfter = clusterConfig.GetTimeSpanWithOffSwitch("retry-unsuccessful-join-after"); ShutdownAfterUnsuccessfulJoinSeedNodes = clusterConfig.GetTimeSpanWithOffSwitch("shutdown-after-unsuccessful-join-seed-nodes"); - PeriodicTasksInitialDelay = clusterConfig.GetTimeSpan("periodic-tasks-initial-delay", null); - GossipInterval = clusterConfig.GetTimeSpan("gossip-interval", null); - GossipTimeToLive = clusterConfig.GetTimeSpan("gossip-time-to-live", null); - LeaderActionsInterval = clusterConfig.GetTimeSpan("leader-actions-interval", null); - UnreachableNodesReaperInterval = clusterConfig.GetTimeSpan("unreachable-nodes-reaper-interval", null); + PeriodicTasksInitialDelay = clusterConfig.GetTimeSpan("periodic-tasks-initial-delay"); + GossipInterval = clusterConfig.GetTimeSpan("gossip-interval"); + GossipTimeToLive = clusterConfig.GetTimeSpan("gossip-time-to-live"); + LeaderActionsInterval = clusterConfig.GetTimeSpan("leader-actions-interval"); + UnreachableNodesReaperInterval = clusterConfig.GetTimeSpan("unreachable-nodes-reaper-interval"); PublishStatsInterval = clusterConfig.GetTimeSpanWithOffSwitch("publish-stats-interval"); var key = "down-removal-margin"; @@ -64,7 +64,7 @@ public ClusterSettings(Config config, string systemName) useDownRemoval.ToLowerInvariant().Equals("false") || useDownRemoval.ToLowerInvariant().Equals("no") ) ? TimeSpan.Zero : - clusterConfig.GetTimeSpan("down-removal-margin", null); + clusterConfig.GetTimeSpan("down-removal-margin"); #pragma warning disable CS0618 AutoDownUnreachableAfter = clusterConfig.GetTimeSpanWithOffSwitch("auto-down-unreachable-after"); @@ -73,22 +73,22 @@ public ClusterSettings(Config config, string systemName) Roles = clusterConfig.GetStringList("roles", new string[] { }).ToImmutableHashSet(); AppVersion = Util.AppVersion.Create(clusterConfig.GetString("app-version")); - MinNrOfMembers = clusterConfig.GetInt("min-nr-of-members", 0); + MinNrOfMembers = clusterConfig.GetInt("min-nr-of-members"); - _useDispatcher = clusterConfig.GetString("use-dispatcher", null); + _useDispatcher = clusterConfig.GetString("use-dispatcher"); if (string.IsNullOrEmpty(_useDispatcher)) _useDispatcher = Dispatchers.InternalDispatcherId; - GossipDifferentViewProbability = clusterConfig.GetDouble("gossip-different-view-probability", 0); - ReduceGossipDifferentViewProbability = clusterConfig.GetInt("reduce-gossip-different-view-probability", 0); - SchedulerTickDuration = clusterConfig.GetTimeSpan("scheduler.tick-duration", null); - SchedulerTicksPerWheel = clusterConfig.GetInt("scheduler.ticks-per-wheel", 0); + GossipDifferentViewProbability = clusterConfig.GetDouble("gossip-different-view-probability"); + ReduceGossipDifferentViewProbability = clusterConfig.GetInt("reduce-gossip-different-view-probability"); + SchedulerTickDuration = clusterConfig.GetTimeSpan("scheduler.tick-duration"); + SchedulerTicksPerWheel = clusterConfig.GetInt("scheduler.ticks-per-wheel"); MinNrOfMembersOfRole = clusterConfig.GetConfig("role").Root.GetObject().Items .ToImmutableDictionary(kv => kv.Key, kv => kv.Value.GetObject().GetKey("min-nr-of-members").GetInt()); - VerboseHeartbeatLogging = clusterConfig.GetBoolean("debug.verbose-heartbeat-logging", false); - VerboseGossipReceivedLogging = clusterConfig.GetBoolean("debug.verbose-receive-gossip-logging", false); + VerboseHeartbeatLogging = clusterConfig.GetBoolean("debug.verbose-heartbeat-logging"); + VerboseGossipReceivedLogging = clusterConfig.GetBoolean("debug.verbose-receive-gossip-logging"); - var downingProviderClassName = clusterConfig.GetString("downing-provider-class", null); + var downingProviderClassName = clusterConfig.GetString("downing-provider-class"); if (!string.IsNullOrEmpty(downingProviderClassName)) DowningProviderType = Type.GetType(downingProviderClassName, true); #pragma warning disable CS0618 @@ -98,7 +98,7 @@ public ClusterSettings(Config config, string systemName) else DowningProviderType = typeof(NoDowning); - RunCoordinatedShutdownWhenDown = clusterConfig.GetBoolean("run-coordinated-shutdown-when-down", false); + RunCoordinatedShutdownWhenDown = clusterConfig.GetBoolean("run-coordinated-shutdown-when-down"); TimeSpan GetWeaklyUpDuration() { @@ -121,7 +121,7 @@ TimeSpan GetWeaklyUpDuration() WeaklyUpAfter = GetWeaklyUpDuration(); - UseLegacyHeartbeatMessage = clusterConfig.GetBoolean("use-legacy-heartbeat-message", false); + UseLegacyHeartbeatMessage = clusterConfig.GetBoolean("use-legacy-heartbeat-message"); } /// diff --git a/src/core/Akka.Cluster/Routing/ClusterRoutingConfig.cs b/src/core/Akka.Cluster/Routing/ClusterRoutingConfig.cs index 3e6220b6fc2..8dfee6b54b6 100644 --- a/src/core/Akka.Cluster/Routing/ClusterRoutingConfig.cs +++ b/src/core/Akka.Cluster/Routing/ClusterRoutingConfig.cs @@ -69,8 +69,8 @@ public static ClusterRouterGroupSettings FromConfig(Config config) return new ClusterRouterGroupSettings( GetMaxTotalNrOfInstances(config), ImmutableHashSet.CreateRange(config.GetStringList("routees.paths")), - config.GetBoolean("cluster.allow-local-routees", false), - UseRoleOption(config.GetString("cluster.use-role", null))); + config.GetBoolean("cluster.allow-local-routees"), + UseRoleOption(config.GetString("cluster.use-role"))); } } @@ -117,9 +117,9 @@ public static ClusterRouterPoolSettings FromConfig(Config config) return new ClusterRouterPoolSettings( GetMaxTotalNrOfInstances(config), - config.GetInt("cluster.max-nr-of-instances-per-node", 0), - config.GetBoolean("cluster.allow-local-routees", false), - UseRoleOption(config.GetString("cluster.use-role", null))); + config.GetInt("cluster.max-nr-of-instances-per-node"), + config.GetBoolean("cluster.allow-local-routees"), + UseRoleOption(config.GetString("cluster.use-role"))); } private bool Equals(ClusterRouterPoolSettings other) @@ -206,7 +206,7 @@ protected ClusterRouterSettingsBase(int totalInstances, bool allowLocalRoutees, /// internal static int GetMaxTotalNrOfInstances(Config config) { - int number = config.GetInt("nr-of-instances", 0); + int number = config.GetInt("nr-of-instances"); if (number is 0 or 1) { return config.GetInt("cluster.max-nr-of-instances-per-node"); diff --git a/src/core/Akka.Cluster/SplitBrainResolver.cs b/src/core/Akka.Cluster/SplitBrainResolver.cs index 146535b2e5b..628ccc032a1 100644 --- a/src/core/Akka.Cluster/SplitBrainResolver.cs +++ b/src/core/Akka.Cluster/SplitBrainResolver.cs @@ -27,7 +27,7 @@ public SplitBrainResolver(ActorSystem system, Cluster cluster) if (config.IsNullOrEmpty()) throw ConfigurationException.NullOrEmptyConfig("akka.cluster.split-brain-resolver"); - StableAfter = config.GetTimeSpan("stable-after", null); + StableAfter = config.GetTimeSpan("stable-after"); Strategy = ResolveSplitBrainStrategy(config); _cluster = cluster; } @@ -40,7 +40,7 @@ public SplitBrainResolver(ActorSystem system, Cluster cluster) private ISplitBrainStrategy ResolveSplitBrainStrategy(Config config) { - var activeStrategy = config.GetString("active-strategy", null); + var activeStrategy = config.GetString("active-strategy"); switch (activeStrategy) { case "static-quorum": return new StaticQuorum(config.GetConfig("static-quorum")); @@ -93,8 +93,8 @@ internal interface ISplitBrainStrategy internal sealed class StaticQuorum : ISplitBrainStrategy { public StaticQuorum(Config config) : this( - quorumSize: config.GetInt("quorum-size", 0), - role: config.GetString("role", null)) + quorumSize: config.GetInt("quorum-size"), + role: config.GetString("role")) { } public StaticQuorum(int quorumSize, string role) @@ -122,7 +122,7 @@ public IEnumerable Apply(NetworkPartitionContext context) internal sealed class KeepMajority : ISplitBrainStrategy { public KeepMajority(Config config) : this( - role: config.GetString("role", null)) + role: config.GetString("role")) { } public KeepMajority(string role = null) @@ -159,7 +159,7 @@ internal sealed class KeepOldest : ISplitBrainStrategy { public KeepOldest(Config config) : this( downIfAlone: config.GetBoolean("down-if-alone", true), - role: config.GetString("role", null)) + role: config.GetString("role")) { } public KeepOldest(bool downIfAlone, string role = null) @@ -205,7 +205,7 @@ private ImmutableSortedSet MembersWithRole(ImmutableSortedSet me internal sealed class KeepReferee : ISplitBrainStrategy { public KeepReferee(Config config) : this( - address: Address.Parse(config.GetString("address", null)), + address: Address.Parse(config.GetString("address")), downAllIfLessThanNodes: config.GetInt("down-all-if-less-than-nodes", 1)) { } diff --git a/src/core/Akka.Cluster/Util.cs b/src/core/Akka.Cluster/Util.cs index c32870d8532..b48d4fb509c 100644 --- a/src/core/Akka.Cluster/Util.cs +++ b/src/core/Akka.Cluster/Util.cs @@ -113,7 +113,7 @@ public static TSource MaxBy(this IEnumerable source, if (useTimeSpanOffSwitch.ToLower() != "off" && useTimeSpanOffSwitch.ToLower() != "false" && useTimeSpanOffSwitch.ToLower() != "no") - ret = @this.GetTimeSpan(key, null); + ret = @this.GetTimeSpan(key); return ret; } diff --git a/src/core/Akka.Coordination.Tests/TestLease.cs b/src/core/Akka.Coordination.Tests/TestLease.cs index f417492f576..9ded5f4cc2b 100644 --- a/src/core/Akka.Coordination.Tests/TestLease.cs +++ b/src/core/Akka.Coordination.Tests/TestLease.cs @@ -118,7 +118,7 @@ public static Config Configuration public TestProbe Probe { get; } private AtomicReference> nextAcquireResult; - private AtomicBoolean nextCheckLeaseResult = new AtomicBoolean(false); + private AtomicBoolean nextCheckLeaseResult = new AtomicBoolean(); private AtomicReference> currentCallBack = new AtomicReference>(_ => { }); private ILoggingAdapter _log; public TaskCompletionSource InitialPromise { get; } = new TaskCompletionSource(); diff --git a/src/core/Akka.Coordination/LeaseProvider.cs b/src/core/Akka.Coordination/LeaseProvider.cs index fbdd0e3d8cb..115b0ed9e56 100644 --- a/src/core/Akka.Coordination/LeaseProvider.cs +++ b/src/core/Akka.Coordination/LeaseProvider.cs @@ -130,7 +130,7 @@ public Lease GetLease(string leaseName, string configPath, string ownerName) var settings = LeaseSettings.Create(leaseConfig, leaseName, ownerName); - var leaseClassName = settings.LeaseConfig.GetString("lease-class", null); + var leaseClassName = settings.LeaseConfig.GetString("lease-class"); if (string.IsNullOrEmpty(leaseClassName)) throw new ArgumentException("lease-class must not be empty"); var leaseType = Type.GetType(leaseClassName, true); diff --git a/src/core/Akka.Docs.Tests/Cluster.Metrics/RouterInCodeSample.cs b/src/core/Akka.Docs.Tests/Cluster.Metrics/RouterInCodeSample.cs index 8fd287834a3..5f84dd7a09d 100644 --- a/src/core/Akka.Docs.Tests/Cluster.Metrics/RouterInCodeSample.cs +++ b/src/core/Akka.Docs.Tests/Cluster.Metrics/RouterInCodeSample.cs @@ -37,7 +37,7 @@ public void Sample2() var useRoles = "backend"; IActorRef backend = Context.ActorOf( new ClusterRouterPool( - new AdaptiveLoadBalancingPool(CpuMetricsSelector.Instance, 0), + new AdaptiveLoadBalancingPool(CpuMetricsSelector.Instance), new ClusterRouterPoolSettings(totalInstances, maxInstancesPerNode, allowLocalRoutees, useRoles)) .Props(Props.Create()), "factorialBackendRouter3"); diff --git a/src/core/Akka.Persistence.Query/PersistenceQuery.cs b/src/core/Akka.Persistence.Query/PersistenceQuery.cs index d0e5bc1ab39..cbf94e07dd4 100644 --- a/src/core/Akka.Persistence.Query/PersistenceQuery.cs +++ b/src/core/Akka.Persistence.Query/PersistenceQuery.cs @@ -47,7 +47,7 @@ private IReadJournalProvider CreatePlugin(string configPath, Config config) throw new ArgumentException("HOCON config is missing persistence read journal plugin config path: " + configPath); var pluginConfig = _system.Settings.Config.GetConfig(configPath); - var pluginTypeName = pluginConfig.GetString("class", null); + var pluginTypeName = pluginConfig.GetString("class"); var pluginType = Type.GetType(pluginTypeName, true); return CreateType(pluginType, new object[] { _system, pluginConfig }); diff --git a/src/core/Akka.Persistence.TCK.Tests/LocalSnapshotStoreSpec.cs b/src/core/Akka.Persistence.TCK.Tests/LocalSnapshotStoreSpec.cs index b728d354816..1dd7f78e1bc 100644 --- a/src/core/Akka.Persistence.TCK.Tests/LocalSnapshotStoreSpec.cs +++ b/src/core/Akka.Persistence.TCK.Tests/LocalSnapshotStoreSpec.cs @@ -24,7 +24,7 @@ public LocalSnapshotStoreSpec(ITestOutputHelper output) akka.persistence.snapshot-store.local.dir = ""target/snapshots-" + Guid.NewGuid() + @""""), "LocalSnapshotStoreSpec", output) { - _path = Sys.Settings.Config.GetString("akka.persistence.snapshot-store.local.dir", null); + _path = Sys.Settings.Config.GetString("akka.persistence.snapshot-store.local.dir"); Sys.CreateStorageLocations(_path); Initialize(); diff --git a/src/core/Akka.Persistence.Tests/AtLeastOnceDeliveryFailureSpec.cs b/src/core/Akka.Persistence.Tests/AtLeastOnceDeliveryFailureSpec.cs index dce7c471cfe..71d12b78ab7 100644 --- a/src/core/Akka.Persistence.Tests/AtLeastOnceDeliveryFailureSpec.cs +++ b/src/core/Akka.Persistence.Tests/AtLeastOnceDeliveryFailureSpec.cs @@ -147,8 +147,8 @@ public ChaosSender(IActorRef destination, IActorRef probe) if (_config.IsNullOrEmpty()) throw ConfigurationException.NullOrEmptyConfig("akka.persistence.sender.chaos"); - _liveProcessingFailureRate = _config.GetDouble("live-processing-failure-rate", 0); - _replayProcessingFailureRate = _config.GetDouble("replay-processing-failure-rate", 0); + _liveProcessingFailureRate = _config.GetDouble("live-processing-failure-rate"); + _replayProcessingFailureRate = _config.GetDouble("replay-processing-failure-rate"); } public override string PersistenceId { get { return "chaosSender"; } } diff --git a/src/core/Akka.Persistence.Tests/Journal/ChaosJournal.cs b/src/core/Akka.Persistence.Tests/Journal/ChaosJournal.cs index 348638483fc..1ae6887496a 100644 --- a/src/core/Akka.Persistence.Tests/Journal/ChaosJournal.cs +++ b/src/core/Akka.Persistence.Tests/Journal/ChaosJournal.cs @@ -53,10 +53,10 @@ public ChaosJournal() if (config.IsNullOrEmpty()) throw ConfigurationException.NullOrEmptyConfig("akka.persistence.journal.chaos"); - _writeFailureRate = config.GetDouble("write-failure-rate", 0); - _deleteFailureRate = config.GetDouble("delete-failure-rate", 0); - _replayFailureRate = config.GetDouble("replay-failure-rate", 0); - _readHighestFailureRate = config.GetDouble("read-highest-failure-rate", 0); + _writeFailureRate = config.GetDouble("write-failure-rate"); + _deleteFailureRate = config.GetDouble("delete-failure-rate"); + _replayFailureRate = config.GetDouble("replay-failure-rate"); + _readHighestFailureRate = config.GetDouble("read-highest-failure-rate"); } public override Task ReplayMessagesAsync(IActorContext context, string persistenceId, long fromSequenceNr, long toSequenceNr, long max, Action recoveryCallback) diff --git a/src/core/Akka.Persistence.Tests/Journal/SteppingMemoryJournal.cs b/src/core/Akka.Persistence.Tests/Journal/SteppingMemoryJournal.cs index af5467af439..fdfa8af6d87 100644 --- a/src/core/Akka.Persistence.Tests/Journal/SteppingMemoryJournal.cs +++ b/src/core/Akka.Persistence.Tests/Journal/SteppingMemoryJournal.cs @@ -53,7 +53,7 @@ private TokenConsumed() { } public SteppingMemoryJournal() { - _instanceId = Context.System.Settings.Config.GetString("akka.persistence.journal.stepping-inmem.instance-id", null); + _instanceId = Context.System.Settings.Config.GetString("akka.persistence.journal.stepping-inmem.instance-id"); } public static void Step(IActorRef journal) diff --git a/src/core/Akka.Persistence.Tests/LoadPluginSpec.cs b/src/core/Akka.Persistence.Tests/LoadPluginSpec.cs index 0c8b6392a76..9f8d33a019a 100644 --- a/src/core/Akka.Persistence.Tests/LoadPluginSpec.cs +++ b/src/core/Akka.Persistence.Tests/LoadPluginSpec.cs @@ -52,7 +52,7 @@ public void Plugin_with_config_parameter_should_be_created_with_plugin_config() { var pluginRef = Persistence.Instance.Apply(Sys).JournalFor("akka.persistence.journal.inmem"); pluginRef.Tell(GetConfig.Instance); - ExpectMsg(c => c.GetInt("extra-property", 0) == 17); + ExpectMsg(c => c.GetInt("extra-property") == 17); } } } diff --git a/src/core/Akka.Persistence.Tests/PersistenceConfigAutoStartSpec.cs b/src/core/Akka.Persistence.Tests/PersistenceConfigAutoStartSpec.cs index 61787685de0..f281936ec92 100644 --- a/src/core/Akka.Persistence.Tests/PersistenceConfigAutoStartSpec.cs +++ b/src/core/Akka.Persistence.Tests/PersistenceConfigAutoStartSpec.cs @@ -34,7 +34,7 @@ public class TestJournal : MemoryJournal public TestJournal(Config config) { - _testValue = config.GetString("test-value", null); + _testValue = config.GetString("test-value"); } protected internal override bool AroundReceive(Receive receive, object message) @@ -54,7 +54,7 @@ public class TestSnapshotStore : LocalSnapshotStore public TestSnapshotStore(Config config) { - _testValue = config.GetString("test-value", null); + _testValue = config.GetString("test-value"); } protected internal override bool AroundReceive(Receive receive, object message) diff --git a/src/core/Akka.Persistence.Tests/PersistenceConfigSpec.cs b/src/core/Akka.Persistence.Tests/PersistenceConfigSpec.cs index be00057d0bf..159ad2e5429 100644 --- a/src/core/Akka.Persistence.Tests/PersistenceConfigSpec.cs +++ b/src/core/Akka.Persistence.Tests/PersistenceConfigSpec.cs @@ -34,7 +34,7 @@ public class TestJournal : MemoryJournal public TestJournal(Config config) { - _testValue = config.GetString("test-value", null); + _testValue = config.GetString("test-value"); } protected internal override bool AroundReceive(Receive receive, object message) @@ -54,7 +54,7 @@ public class TestSnapshotStore : LocalSnapshotStore public TestSnapshotStore(Config config) { - _testValue = config.GetString("test-value", null); + _testValue = config.GetString("test-value"); } protected internal override bool AroundReceive(Receive receive, object message) diff --git a/src/core/Akka.Persistence.Tests/PersistenceSpec.cs b/src/core/Akka.Persistence.Tests/PersistenceSpec.cs index 1daa6bff605..69f8943aef7 100644 --- a/src/core/Akka.Persistence.Tests/PersistenceSpec.cs +++ b/src/core/Akka.Persistence.Tests/PersistenceSpec.cs @@ -37,7 +37,7 @@ public static Config Configuration(string test, string serialization = null, internal readonly Cleanup Clean; - private readonly AtomicCounter _counter = new AtomicCounter(0); + private readonly AtomicCounter _counter = new(0); private readonly string _name; @@ -93,14 +93,14 @@ protected void ExpectAnyMsgInOrder(params IEnumerable[] expected) internal class Cleanup : IDisposable { internal List StorageLocations; - private static readonly object _syncRoot = new object(); + private static readonly object _syncRoot = new(); public Cleanup(AkkaSpec spec) { StorageLocations = new[] { "akka.persistence.snapshot-store.local.dir" - }.Select(s => new DirectoryInfo(spec.Sys.Settings.Config.GetString(s, null))).ToList(); + }.Select(s => new DirectoryInfo(spec.Sys.Settings.Config.GetString(s))).ToList(); } public void Initialize() @@ -146,7 +146,7 @@ public override string PersistenceId internal sealed class GetState { - public static readonly GetState Instance = new GetState(); + public static readonly GetState Instance = new(); private GetState() { } } diff --git a/src/core/Akka.Persistence.Tests/ReceivePersistentActorTests.cs b/src/core/Akka.Persistence.Tests/ReceivePersistentActorTests.cs index 14e8326852b..5febb37fe3e 100644 --- a/src/core/Akka.Persistence.Tests/ReceivePersistentActorTests.cs +++ b/src/core/Akka.Persistence.Tests/ReceivePersistentActorTests.cs @@ -220,7 +220,7 @@ public IntPredicatesActor(string pid) : base(pid) } return false; }); //Func, when 10 <= i < 15 - Command(i => Sender.Tell("int:" + i, Self), null); //Null predicate, when i >= 15 + Command(i => Sender.Tell("int:" + i, Self)); //Null predicate, when i >= 15 Command(i => Sender.Tell("ShouldNeverMatch:" + i, Self)); //The handler above should never be invoked } } diff --git a/src/core/Akka.Persistence.Tests/SnapshotFailureRobustnessSpec.cs b/src/core/Akka.Persistence.Tests/SnapshotFailureRobustnessSpec.cs index 96a489bd5ae..597095da1d9 100644 --- a/src/core/Akka.Persistence.Tests/SnapshotFailureRobustnessSpec.cs +++ b/src/core/Akka.Persistence.Tests/SnapshotFailureRobustnessSpec.cs @@ -160,7 +160,7 @@ protected override void Save(SnapshotMetadata metadata, object payload) { var bytes = Encoding.UTF8.GetBytes("b0rk"); var tempFile = WithOutputStream(metadata, stream => stream.Write(bytes, 0, bytes.Length)); - tempFile.MoveTo(GetSnapshotFileForWrite(metadata, "").FullName); + tempFile.MoveTo(GetSnapshotFileForWrite(metadata).FullName); } else base.Save(metadata, payload); } diff --git a/src/core/Akka.Persistence/Fsm/PersistentFSM.cs b/src/core/Akka.Persistence/Fsm/PersistentFSM.cs index 3db41b4b3a8..eb01a200bf4 100644 --- a/src/core/Akka.Persistence/Fsm/PersistentFSM.cs +++ b/src/core/Akka.Persistence/Fsm/PersistentFSM.cs @@ -468,7 +468,7 @@ public SnapshotAfterExtension(Config config) } else { - SnapshotAfterValue = config.GetInt(Key, 0); + SnapshotAfterValue = config.GetInt(Key); } } diff --git a/src/core/Akka.Persistence/Journal/AsyncWriteJournal.cs b/src/core/Akka.Persistence/Journal/AsyncWriteJournal.cs index a30590147b5..9a494332310 100644 --- a/src/core/Akka.Persistence/Journal/AsyncWriteJournal.cs +++ b/src/core/Akka.Persistence/Journal/AsyncWriteJournal.cs @@ -54,9 +54,9 @@ protected AsyncWriteJournal() var config = extension.ConfigFor(Self); _breaker = new CircuitBreaker( Context.System.Scheduler, - config.GetInt("circuit-breaker.max-failures", 0), - config.GetTimeSpan("circuit-breaker.call-timeout", null), - config.GetTimeSpan("circuit-breaker.reset-timeout", null)); + config.GetInt("circuit-breaker.max-failures"), + config.GetTimeSpan("circuit-breaker.call-timeout"), + config.GetTimeSpan("circuit-breaker.reset-timeout")); var replayFilterMode = config.GetString("replay-filter.mode", "").ToLowerInvariant(); switch (replayFilterMode) @@ -77,9 +77,9 @@ protected AsyncWriteJournal() throw new ConfigurationException($"Invalid replay-filter.mode [{replayFilterMode}], supported values [off, repair-by-discard-old, fail, warn]"); } _isReplayFilterEnabled = _replayFilterMode != ReplayFilterMode.Disabled; - _replayFilterWindowSize = config.GetInt("replay-filter.window-size", 0); - _replayFilterMaxOldWriters = config.GetInt("replay-filter.max-old-writers", 0); - _replayDebugEnabled = config.GetBoolean("replay-filter.debug", false); + _replayFilterWindowSize = config.GetInt("replay-filter.window-size"); + _replayFilterMaxOldWriters = config.GetInt("replay-filter.max-old-writers"); + _replayDebugEnabled = config.GetBoolean("replay-filter.debug"); _resequencer = Context.System.ActorOf(Props.Create(() => new Resequencer())); } diff --git a/src/core/Akka.Persistence/Journal/PersistencePluginProxy.cs b/src/core/Akka.Persistence/Journal/PersistencePluginProxy.cs index 9585f803a41..8388f2e0850 100644 --- a/src/core/Akka.Persistence/Journal/PersistencePluginProxy.cs +++ b/src/core/Akka.Persistence/Journal/PersistencePluginProxy.cs @@ -55,7 +55,7 @@ public static void SetTargetLocation(ActorSystem system, Address address) { var persistence = Persistence.Instance.Apply(system); persistence.JournalFor(null).Tell(new TargetLocation(address)); - if (string.IsNullOrEmpty(system.Settings.Config.GetString("akka.persistence.snapshot-store.plugin", null))) + if (string.IsNullOrEmpty(system.Settings.Config.GetString("akka.persistence.snapshot-store.plugin"))) persistence.SnapshotStoreFor(null).Tell(new TargetLocation(address)); } @@ -67,7 +67,7 @@ public static void Start(ActorSystem system) { var persistence = Persistence.Instance.Apply(system); persistence.JournalFor(null); - if (string.IsNullOrEmpty(system.Settings.Config.GetString("akka.persistence.snapshot-store.plugin", null))) + if (string.IsNullOrEmpty(system.Settings.Config.GetString("akka.persistence.snapshot-store.plugin"))) persistence.SnapshotStoreFor(null); } @@ -112,12 +112,12 @@ public PersistencePluginProxy(Config config) _pluginType = new SnapshotStore(); else throw new ArgumentException($"Unknown plugin type: {pluginId}."); - _initTimeout = config.GetTimeSpan("init-timeout", null); + _initTimeout = config.GetTimeSpan("init-timeout"); var key = "target-" + _pluginType.Qualifier + "-plugin"; - _targetPluginId = config.GetString(key, null); + _targetPluginId = config.GetString(key); if (string.IsNullOrEmpty(_targetPluginId)) throw new ArgumentException($"{pluginId}.{key} must be defined."); - _startTarget = config.GetBoolean("start-target-" + _pluginType.Qualifier, false); + _startTarget = config.GetBoolean("start-target-" + _pluginType.Qualifier); _selfAddress = ((ExtendedActorSystem)Context.System).Provider.DefaultAddress; } @@ -152,7 +152,7 @@ protected override void PreStart() else { var targetAddressKey = "target-" + _pluginType.Qualifier + "-address"; - var targetAddress = _config.GetString(targetAddressKey, null); + var targetAddress = _config.GetString(targetAddressKey); if (!string.IsNullOrEmpty(targetAddress)) { try diff --git a/src/core/Akka.Persistence/Persistence.cs b/src/core/Akka.Persistence/Persistence.cs index a0c7b3ceb12..ecd8d8a556a 100644 --- a/src/core/Akka.Persistence/Persistence.cs +++ b/src/core/Akka.Persistence/Persistence.cs @@ -78,14 +78,14 @@ public PersistenceExtension(ExtendedActorSystem system) _defaultJournalPluginId = new Lazy(() => { - var configPath = _config.GetString("journal.plugin", null); + var configPath = _config.GetString("journal.plugin"); if (string.IsNullOrEmpty(configPath)) throw new NullReferenceException("Default journal plugin is not configured"); return configPath; }, LazyThreadSafetyMode.ExecutionAndPublication); _defaultSnapshotPluginId = new Lazy(() => { - var configPath = _config.GetString("snapshot-store.plugin", null); + var configPath = _config.GetString("snapshot-store.plugin"); if (string.IsNullOrEmpty(configPath)) { if (_log.IsWarningEnabled) @@ -99,7 +99,7 @@ public PersistenceExtension(ExtendedActorSystem system) _defaultInternalStashOverflowStrategy = new Lazy(() => { - var configuratorTypeName = _config.GetString("internal-stash-overflow-strategy", null); + var configuratorTypeName = _config.GetString("internal-stash-overflow-strategy"); var configuratorType = Type.GetType(configuratorTypeName); return ((IStashOverflowStrategyConfigurator)Activator.CreateInstance(configuratorType)).Create(_system.Settings.Config); }); @@ -122,7 +122,7 @@ public PersistenceExtension(ExtendedActorSystem system) _recoveryPermitter = new Lazy(() => { - var maxPermits = _config.GetInt("max-concurrent-recoveries", 0); + var maxPermits = _config.GetInt("max-concurrent-recoveries"); return _system.SystemActorOf(Akka.Persistence.RecoveryPermitter.Props(maxPermits), "recoveryPermitter"); }); } @@ -270,11 +270,11 @@ private PluginHolder PluginHolderFor(string configPath, string fallbackPath) private static IActorRef CreatePlugin(ExtendedActorSystem system, string configPath, Config pluginConfig) { var pluginActorName = configPath; - var pluginTypeName = pluginConfig.GetString("class", null); + var pluginTypeName = pluginConfig.GetString("class"); if (string.IsNullOrEmpty(pluginTypeName)) throw new ArgumentException($"Plugin class name must be defined in config property [{configPath}.class]"); var pluginType = Type.GetType(pluginTypeName, true); - var pluginDispatcherId = pluginConfig.GetString("plugin-dispatcher", null); + var pluginDispatcherId = pluginConfig.GetString("plugin-dispatcher"); object[] pluginActorArgs = pluginType.GetConstructor(new[] { typeof(Config) }) != null ? new object[] { pluginConfig } : null; var pluginActorProps = new Props(pluginType, pluginActorArgs).WithDispatcher(pluginDispatcherId); @@ -356,9 +356,9 @@ public sealed class ViewSettings /// TBD public ViewSettings(Config config) { - AutoUpdate = config.GetBoolean("view.auto-update", false); - AutoUpdateInterval = config.GetTimeSpan("view.auto-update-interval", null); - var repMax = config.GetLong("view.auto-update-replay-max", 0); + AutoUpdate = config.GetBoolean("view.auto-update"); + AutoUpdateInterval = config.GetTimeSpan("view.auto-update-interval"); + var repMax = config.GetLong("view.auto-update-replay-max"); AutoUpdateReplayMax = repMax < 0 ? long.MaxValue : repMax; } @@ -410,10 +410,10 @@ public AtLeastOnceDeliverySettings(TimeSpan redeliverInterval, int redeliveryBur /// TBD public AtLeastOnceDeliverySettings(Config config) { - RedeliverInterval = config.GetTimeSpan("at-least-once-delivery.redeliver-interval", null); - MaxUnconfirmedMessages = config.GetInt("at-least-once-delivery.max-unconfirmed-messages", 0); - WarnAfterNumberOfUnconfirmedAttempts = config.GetInt("at-least-once-delivery.warn-after-number-of-unconfirmed-attempts", 0); - RedeliveryBurstLimit = config.GetInt("at-least-once-delivery.redelivery-burst-limit", 0); + RedeliverInterval = config.GetTimeSpan("at-least-once-delivery.redeliver-interval"); + MaxUnconfirmedMessages = config.GetInt("at-least-once-delivery.max-unconfirmed-messages"); + WarnAfterNumberOfUnconfirmedAttempts = config.GetInt("at-least-once-delivery.warn-after-number-of-unconfirmed-attempts"); + RedeliveryBurstLimit = config.GetInt("at-least-once-delivery.redelivery-burst-limit"); } /// @@ -499,8 +499,8 @@ public sealed class InternalSettings { public InternalSettings(Config config) { - PublishPluginCommands = config.HasPath("publish-plugin-commands") && config.GetBoolean("publish-plugin-commands", false); - PublishConfirmations = config.HasPath("publish-confirmations") && config.GetBoolean("publish-confirmations", false); + PublishPluginCommands = config.HasPath("publish-plugin-commands") && config.GetBoolean("publish-plugin-commands"); + PublishConfirmations = config.HasPath("publish-confirmations") && config.GetBoolean("publish-confirmations"); } public bool PublishPluginCommands { get; } diff --git a/src/core/Akka.Persistence/Snapshot/LocalSnapshotStore.cs b/src/core/Akka.Persistence/Snapshot/LocalSnapshotStore.cs index 0b05f36baf7..aa413a82ff0 100644 --- a/src/core/Akka.Persistence/Snapshot/LocalSnapshotStore.cs +++ b/src/core/Akka.Persistence/Snapshot/LocalSnapshotStore.cs @@ -51,12 +51,12 @@ public LocalSnapshotStore() throw new ConfigurationException($"Cannot create {typeof(LocalSnapshotStore)}: akka.persistence.snapshot-store.local configuration node not found"); */ - _maxLoadAttempts = config.GetInt("max-load-attempts", 0); + _maxLoadAttempts = config.GetInt("max-load-attempts"); - _streamDispatcher = Context.System.Dispatchers.Lookup(config.GetString("stream-dispatcher", null)); - _dir = new DirectoryInfo(config.GetString("dir", null)); + _streamDispatcher = Context.System.Dispatchers.Lookup(config.GetString("stream-dispatcher")); + _dir = new DirectoryInfo(config.GetString("dir")); - _defaultSerializer = config.GetString("serializer", null); + _defaultSerializer = config.GetString("serializer"); _serialization = Context.System.Serialization; _wrapperSerializer = _serialization.FindSerializerForType(WrapperType); diff --git a/src/core/Akka.Remote.TestKit/BarrierCoordinator.cs b/src/core/Akka.Remote.TestKit/BarrierCoordinator.cs index a0ae256eb2d..6a9e15577cd 100644 --- a/src/core/Akka.Remote.TestKit/BarrierCoordinator.cs +++ b/src/core/Akka.Remote.TestKit/BarrierCoordinator.cs @@ -572,7 +572,7 @@ protected void InitFSM() //we only allow the deadlines to get shorter if (enterDeadline.TimeLeft < @event.StateData.Deadline.TimeLeft) { - SetTimer("Timeout", StateTimeout.Instance, enterDeadline.TimeLeft, false); + SetTimer("Timeout", StateTimeout.Instance, enterDeadline.TimeLeft); return HandleBarrier(@event.StateData.Copy(arrived: together, deadline: enterDeadline)); } @@ -601,7 +601,7 @@ protected void InitFSM() OnTransition((state, nextState) => { - if (state == State.Idle && nextState == State.Waiting) SetTimer("Timeout", StateTimeout.Instance, NextStateData.Deadline.TimeLeft, false); + if (state == State.Idle && nextState == State.Waiting) SetTimer("Timeout", StateTimeout.Instance, NextStateData.Deadline.TimeLeft); else if(state == State.Waiting && nextState == State.Idle) CancelTimer("Timeout"); }); diff --git a/src/core/Akka.Remote.TestKit/Extension.cs b/src/core/Akka.Remote.TestKit/Extension.cs index b6329f97093..ad960704b91 100644 --- a/src/core/Akka.Remote.TestKit/Extension.cs +++ b/src/core/Akka.Remote.TestKit/Extension.cs @@ -116,12 +116,12 @@ public TestConductorSettings(Config config) if (config.IsNullOrEmpty()) throw ConfigurationException.NullOrEmptyConfig(); - _connectTimeout = config.GetTimeSpan("connect-timeout", null); - _clientReconnects = config.GetInt("client-reconnects", 0); - _reconnectBackoff = config.GetTimeSpan("reconnect-backoff", null); - _barrierTimeout = config.GetTimeSpan("barrier-timeout", null); - _queryTimeout = config.GetTimeSpan("query-timeout", null); - _packetSplitThreshold = config.GetTimeSpan("packet-split-threshold", null); + _connectTimeout = config.GetTimeSpan("connect-timeout"); + _clientReconnects = config.GetInt("client-reconnects"); + _reconnectBackoff = config.GetTimeSpan("reconnect-backoff"); + _barrierTimeout = config.GetTimeSpan("barrier-timeout"); + _queryTimeout = config.GetTimeSpan("query-timeout"); + _packetSplitThreshold = config.GetTimeSpan("packet-split-threshold"); _serverSocketWorkerPoolSize = ComputeWps(config.GetConfig("helios.server-socket-worker-pool")); _clientSocketWorkerPoolSize = ComputeWps(config.GetConfig("helios.client-socket-worker-pool")); } diff --git a/src/core/Akka.Remote.Tests.MultiNode/RemoteGatePiercingSpec.cs b/src/core/Akka.Remote.Tests.MultiNode/RemoteGatePiercingSpec.cs index 44710281f2c..0caf35fcfd1 100644 --- a/src/core/Akka.Remote.Tests.MultiNode/RemoteGatePiercingSpec.cs +++ b/src/core/Akka.Remote.Tests.MultiNode/RemoteGatePiercingSpec.cs @@ -84,7 +84,7 @@ public void RemoteGatePiercing_must_allow_restarted_node_to_pass_through_gate() _identify(_config.Second, "subject"); EnterBarrier("actors-communicate"); - EventFilter.Warning(null, null, contains: "address is now gated").ExpectOne(() => + EventFilter.Warning(null, contains: "address is now gated").ExpectOne(() => { var cmd = RARP.For(Sys) diff --git a/src/core/Akka.Remote.Tests/ActorsLeakSpec.cs b/src/core/Akka.Remote.Tests/ActorsLeakSpec.cs index 4061b099c23..3944ec434a9 100644 --- a/src/core/Akka.Remote.Tests/ActorsLeakSpec.cs +++ b/src/core/Akka.Remote.Tests/ActorsLeakSpec.cs @@ -90,7 +90,7 @@ private void AssertActors(ImmutableHashSet expected, ImmutableHashSet [Fact] public async Task Remoting_must_not_leak_actors() { - var actorRef = Sys.ActorOf(EchoActor.Props(this, true), "echo"); + var actorRef = Sys.ActorOf(EchoActor.Props(this), "echo"); var echoPath = new RootActorPath(RARP.For(Sys).Provider.DefaultAddress)/"user"/"echo"; var targets = await Task.WhenAll(new[] { "/system/endpointManager", "/system/transports" }.Select( diff --git a/src/core/Akka.Remote.Tests/Serialization/SystemMessageSerializationSpec.cs b/src/core/Akka.Remote.Tests/Serialization/SystemMessageSerializationSpec.cs index 8b43b10d36e..1ba5ef99c47 100644 --- a/src/core/Akka.Remote.Tests/Serialization/SystemMessageSerializationSpec.cs +++ b/src/core/Akka.Remote.Tests/Serialization/SystemMessageSerializationSpec.cs @@ -47,7 +47,7 @@ public SystemMessageSerializationSpec(ITestOutputHelper output) : base(output, R [Fact] public void Can_serialize_Create() { - var message = new Create(null); + var message = new Create(); AssertEqual(message); } diff --git a/src/core/Akka.Remote/AkkaProtocolSettings.cs b/src/core/Akka.Remote/AkkaProtocolSettings.cs index 397f4d2d8b6..9dfe1c66745 100644 --- a/src/core/Akka.Remote/AkkaProtocolSettings.cs +++ b/src/core/Akka.Remote/AkkaProtocolSettings.cs @@ -45,15 +45,15 @@ public AkkaProtocolSettings(Config config) throw ConfigurationException.NullOrEmptyConfig(); TransportFailureDetectorConfig = config.GetConfig("akka.remote.transport-failure-detector"); - TransportFailureDetectorImplementationClass = TransportFailureDetectorConfig.GetString("implementation-class", null); - TransportHeartBeatInterval = TransportFailureDetectorConfig.GetTimeSpan("heartbeat-interval", null); + TransportFailureDetectorImplementationClass = TransportFailureDetectorConfig.GetString("implementation-class"); + TransportHeartBeatInterval = TransportFailureDetectorConfig.GetTimeSpan("heartbeat-interval"); // backwards compatibility with the existing dot-netty.tcp.connection-timeout var enabledTransports = config.GetStringList("akka.remote.enabled-transports", new string[] { }); if (enabledTransports.Contains("akka.remote.dot-netty.tcp")) - HandshakeTimeout = config.GetTimeSpan("akka.remote.dot-netty.tcp.connection-timeout", null); + HandshakeTimeout = config.GetTimeSpan("akka.remote.dot-netty.tcp.connection-timeout"); else if (enabledTransports.Contains("akka.remote.dot-netty.ssl")) - HandshakeTimeout = config.GetTimeSpan("akka.remote.dot-netty.ssl.connection-timeout", null); + HandshakeTimeout = config.GetTimeSpan("akka.remote.dot-netty.ssl.connection-timeout"); else HandshakeTimeout = config.GetTimeSpan("akka.remote.handshake-timeout", TimeSpan.FromSeconds(20), allowInfinite:false); } diff --git a/src/core/Akka.Remote/DeadlineFailureDetector.cs b/src/core/Akka.Remote/DeadlineFailureDetector.cs index ec92590a2ca..d7bb1ea41ec 100644 --- a/src/core/Akka.Remote/DeadlineFailureDetector.cs +++ b/src/core/Akka.Remote/DeadlineFailureDetector.cs @@ -80,8 +80,8 @@ public DeadlineFailureDetector( /// N/A. This parameter is not used. public DeadlineFailureDetector(Config config, EventStream eventStream) : this( - config.GetTimeSpan("acceptable-heartbeat-pause", null), - config.GetTimeSpan("heartbeat-interval", null)) { } + config.GetTimeSpan("acceptable-heartbeat-pause"), + config.GetTimeSpan("heartbeat-interval")) { } /// /// Determines whether the resource is considered to be up and healthy. diff --git a/src/core/Akka.Remote/PhiAccrualFailureDetector.cs b/src/core/Akka.Remote/PhiAccrualFailureDetector.cs index 49e54c4c109..4dcc7120785 100644 --- a/src/core/Akka.Remote/PhiAccrualFailureDetector.cs +++ b/src/core/Akka.Remote/PhiAccrualFailureDetector.cs @@ -85,11 +85,11 @@ public PhiAccrualFailureDetector(Config config, EventStream ev) if (config.IsNullOrEmpty()) throw ConfigurationException.NullOrEmptyConfig(); - _threshold = config.GetDouble("threshold", 0); - _maxSampleSize = config.GetInt("max-sample-size", 0); - _minStdDeviation = config.GetTimeSpan("min-std-deviation", null); - _acceptableHeartbeatPause = config.GetTimeSpan("acceptable-heartbeat-pause", null); - _firstHeartbeatEstimate = config.GetTimeSpan("heartbeat-interval", null); + _threshold = config.GetDouble("threshold"); + _maxSampleSize = config.GetInt("max-sample-size"); + _minStdDeviation = config.GetTimeSpan("min-std-deviation"); + _acceptableHeartbeatPause = config.GetTimeSpan("acceptable-heartbeat-pause"); + _firstHeartbeatEstimate = config.GetTimeSpan("heartbeat-interval"); _state = new AtomicReference(new AccrualState(FirstHeartBeat, null)); EventStream = ev ?? Option.None; } diff --git a/src/core/Akka.Remote/RemoteDeployer.cs b/src/core/Akka.Remote/RemoteDeployer.cs index 3b4f1945923..1018f0b1f8b 100644 --- a/src/core/Akka.Remote/RemoteDeployer.cs +++ b/src/core/Akka.Remote/RemoteDeployer.cs @@ -44,7 +44,7 @@ public override Deploy ParseConfig(string key, Config config) var deploy = base.ParseConfig(key, config); if (deploy == null) return null; - var remote = deploy.Config.GetString("remote", null); + var remote = deploy.Config.GetString("remote"); if(ActorPath.TryParse(remote, out var actorPath)) { diff --git a/src/core/Akka.Remote/RemoteSettings.cs b/src/core/Akka.Remote/RemoteSettings.cs index a2c86b0f96b..b0718dd8509 100644 --- a/src/core/Akka.Remote/RemoteSettings.cs +++ b/src/core/Akka.Remote/RemoteSettings.cs @@ -29,8 +29,8 @@ public RemoteSettings(Config config) throw ConfigurationException.NullOrEmptyConfig(); Config = config; - LogReceive = config.GetBoolean("akka.remote.log-received-messages", false); - LogSend = config.GetBoolean("akka.remote.log-sent-messages", false); + LogReceive = config.GetBoolean("akka.remote.log-received-messages"); + LogSend = config.GetBoolean("akka.remote.log-sent-messages"); // TODO: what is the default value if the key wasn't found? var bufferSizeLogKey = "akka.remote.log-buffer-size-exceeding"; @@ -43,43 +43,43 @@ public RemoteSettings(Config config) } else { - LogBufferSizeExceeding = config.GetInt(bufferSizeLogKey, 0); + LogBufferSizeExceeding = config.GetInt(bufferSizeLogKey); } - UntrustedMode = config.GetBoolean("akka.remote.untrusted-mode", false); + UntrustedMode = config.GetBoolean("akka.remote.untrusted-mode"); TrustedSelectionPaths = new HashSet(config.GetStringList("akka.remote.trusted-selection-paths", new string[] { })); RemoteLifecycleEventsLogLevel = config.GetString("akka.remote.log-remote-lifecycle-events", "DEBUG"); if (RemoteLifecycleEventsLogLevel.Equals("on", StringComparison.OrdinalIgnoreCase) || RemoteLifecycleEventsLogLevel.Equals("yes", StringComparison.OrdinalIgnoreCase) || RemoteLifecycleEventsLogLevel.Equals("true", StringComparison.OrdinalIgnoreCase) ) RemoteLifecycleEventsLogLevel = "DEBUG"; - Dispatcher = config.GetString("akka.remote.use-dispatcher", null); - FlushWait = config.GetTimeSpan("akka.remote.flush-wait-on-shutdown", null); - ShutdownTimeout = config.GetTimeSpan("akka.remote.shutdown-timeout", null); + Dispatcher = config.GetString("akka.remote.use-dispatcher"); + FlushWait = config.GetTimeSpan("akka.remote.flush-wait-on-shutdown"); + ShutdownTimeout = config.GetTimeSpan("akka.remote.shutdown-timeout"); TransportNames = config.GetStringList("akka.remote.enabled-transports", new string[] { }); Transports = (from transportName in TransportNames let transportConfig = TransportConfigFor(transportName) select new TransportSettings(transportConfig)).ToArray(); Adapters = ConfigToMap(config.GetConfig("akka.remote.adapters")); - BackoffPeriod = config.GetTimeSpan("akka.remote.backoff-interval", null); + BackoffPeriod = config.GetTimeSpan("akka.remote.backoff-interval"); RetryGateClosedFor = config.GetTimeSpan("akka.remote.retry-gate-closed-for", TimeSpan.Zero); - UsePassiveConnections = config.GetBoolean("akka.remote.use-passive-connections", false); - SysMsgBufferSize = config.GetInt("akka.remote.system-message-buffer-size", 0); - SysResendTimeout = config.GetTimeSpan("akka.remote.resend-interval", null); - SysResendLimit = config.GetInt("akka.remote.resend-limit", 0); - InitialSysMsgDeliveryTimeout = config.GetTimeSpan("akka.remote.initial-system-message-delivery-timeout", null); - QuarantineSilentSystemTimeout = config.GetTimeSpan("akka.remote.quarantine-after-silence", null); - SysMsgAckTimeout = config.GetTimeSpan("akka.remote.system-message-ack-piggyback-timeout", null); - QuarantineDuration = config.GetTimeSpan("akka.remote.prune-quarantine-marker-after", null); + UsePassiveConnections = config.GetBoolean("akka.remote.use-passive-connections"); + SysMsgBufferSize = config.GetInt("akka.remote.system-message-buffer-size"); + SysResendTimeout = config.GetTimeSpan("akka.remote.resend-interval"); + SysResendLimit = config.GetInt("akka.remote.resend-limit"); + InitialSysMsgDeliveryTimeout = config.GetTimeSpan("akka.remote.initial-system-message-delivery-timeout"); + QuarantineSilentSystemTimeout = config.GetTimeSpan("akka.remote.quarantine-after-silence"); + SysMsgAckTimeout = config.GetTimeSpan("akka.remote.system-message-ack-piggyback-timeout"); + QuarantineDuration = config.GetTimeSpan("akka.remote.prune-quarantine-marker-after"); - StartupTimeout = config.GetTimeSpan("akka.remote.startup-timeout", null); - CommandAckTimeout = config.GetTimeSpan("akka.remote.command-ack-timeout", null); + StartupTimeout = config.GetTimeSpan("akka.remote.startup-timeout"); + CommandAckTimeout = config.GetTimeSpan("akka.remote.command-ack-timeout"); WatchFailureDetectorConfig = config.GetConfig("akka.remote.watch-failure-detector"); - WatchFailureDetectorImplementationClass = WatchFailureDetectorConfig.GetString("implementation-class", null); - WatchHeartBeatInterval = WatchFailureDetectorConfig.GetTimeSpan("heartbeat-interval", null); - WatchUnreachableReaperInterval = WatchFailureDetectorConfig.GetTimeSpan("unreachable-nodes-reaper-interval", null); - WatchHeartbeatExpectedResponseAfter = WatchFailureDetectorConfig.GetTimeSpan("expected-response-after", null); + WatchFailureDetectorImplementationClass = WatchFailureDetectorConfig.GetString("implementation-class"); + WatchHeartBeatInterval = WatchFailureDetectorConfig.GetTimeSpan("heartbeat-interval"); + WatchUnreachableReaperInterval = WatchFailureDetectorConfig.GetTimeSpan("unreachable-nodes-reaper-interval"); + WatchHeartbeatExpectedResponseAfter = WatchFailureDetectorConfig.GetTimeSpan("expected-response-after"); } /// @@ -252,7 +252,7 @@ public TransportSettings(Config config) if (config.IsNullOrEmpty()) throw ConfigurationException.NullOrEmptyConfig(); - TransportClass = config.GetString("transport-class", null); + TransportClass = config.GetString("transport-class"); Adapters = config.GetStringList("applied-adapters", new string[] { }).Reverse().ToList(); Config = config; } diff --git a/src/core/Akka.Remote/RemoteSystemDaemon.cs b/src/core/Akka.Remote/RemoteSystemDaemon.cs index fad1ab7a78c..977f4a058e5 100644 --- a/src/core/Akka.Remote/RemoteSystemDaemon.cs +++ b/src/core/Akka.Remote/RemoteSystemDaemon.cs @@ -80,7 +80,7 @@ public DaemonMsgCreate(Props props, Deploy deploy, string path, IActorRef superv internal sealed class RemoteSystemDaemon : VirtualPathContainer { private readonly ActorSystemImpl _system; - private readonly Switch _terminating = new Switch(false); + private readonly Switch _terminating = new Switch(); private readonly ConcurrentDictionary> _parent2Children = new ConcurrentDictionary>(); private readonly IActorRef _terminator; diff --git a/src/core/Akka.Remote/Remoting.cs b/src/core/Akka.Remote/Remoting.cs index 4c684c5b3fe..6884637c467 100644 --- a/src/core/Akka.Remote/Remoting.cs +++ b/src/core/Akka.Remote/Remoting.cs @@ -290,7 +290,7 @@ public override void Send(object message, IActorRef sender, RemoteActorRef recip { if (_endpointManager == null) { - throw new RemoteTransportException("Attempted to send remote message but Remoting is not running.", null); + throw new RemoteTransportException("Attempted to send remote message but Remoting is not running."); } _endpointManager.Tell(new EndpointManager.Send(message, recipient, sender), sender ?? ActorRefs.NoSender); @@ -308,7 +308,7 @@ public override async Task ManagementCommand(object cmd) public override async Task ManagementCommand(object cmd, CancellationToken cancellationToken) { if (_endpointManager == null) - throw new RemoteTransportException("Attempted to send management command but Remoting is not running.", null); + throw new RemoteTransportException("Attempted to send management command but Remoting is not running."); var result = await _endpointManager.Ask( message: new EndpointManager.ManagementCommand(cmd), @@ -383,8 +383,7 @@ internal static Address LocalAddressForRemote( throw new RemoteTransportException( "No transport is responsible for address:[" + remote + "] although protocol [" + remote.Protocol + "] is available." + - " Make sure at least one transport is configured to be responsible for the address.", - null); + " Make sure at least one transport is configured to be responsible for the address."); if (responsibleTransports.Length == 1) return responsibleTransports.First().Address; @@ -393,13 +392,12 @@ internal static Address LocalAddressForRemote( "Multiple transports are available for [" + remote + ": " + string.Join(",", responsibleTransports.Select(t => t.ToString())) + "] " + "Remoting cannot decide which transport to use to reach the remote system. Change your configuration " + - "so that only one transport is responsible for the address.", - null); + "so that only one transport is responsible for the address."); } throw new RemoteTransportException( "No transport is loaded for protocol: [" + remote.Protocol + "], available protocols: [" + - string.Join(",", transportMapping.Keys.Select(t => t.ToString())) + "]", null); + string.Join(",", transportMapping.Keys.Select(t => t.ToString())) + "]"); } #endregion diff --git a/src/core/Akka.Remote/Transport/DotNetty/DotNettyTransportSettings.cs b/src/core/Akka.Remote/Transport/DotNetty/DotNettyTransportSettings.cs index bec3fccd1b7..93ab069d6e1 100644 --- a/src/core/Akka.Remote/Transport/DotNetty/DotNettyTransportSettings.cs +++ b/src/core/Akka.Remote/Transport/DotNetty/DotNettyTransportSettings.cs @@ -60,10 +60,10 @@ public static DotNettyTransportSettings Create(Config config) throw ConfigurationException.NullOrEmptyConfig(); var transportMode = config.GetString("transport-protocol", "tcp").ToLower(); - var host = config.GetString("hostname", null); + var host = config.GetString("hostname"); if (string.IsNullOrEmpty(host)) host = IPAddress.Any.ToString(); - var publicHost = config.GetString("public-hostname", null); - var publicPort = config.GetInt("public-port", 0); + var publicHost = config.GetString("public-hostname"); + var publicPort = config.GetInt("public-port"); var order = ByteOrder.LittleEndian; var byteOrderString = config.GetString("byte-order", "little-endian").ToLowerInvariant(); @@ -76,7 +76,7 @@ public static DotNettyTransportSettings Create(Config config) var batchWriterSettings = new BatchWriterSettings(config.GetConfig("batching")); - var enableSsl = config.GetBoolean("enable-ssl", false); + var enableSsl = config.GetBoolean("enable-ssl"); return new DotNettyTransportSettings( transportMode: transportMode == "tcp" ? TransportMode.Tcp : TransportMode.Udp, @@ -90,18 +90,18 @@ public static DotNettyTransportSettings Create(Config config) clientSocketWorkerPoolSize: ComputeWorkerPoolSize(config.GetConfig("client-socket-worker-pool")), maxFrameSize: ToNullableInt(config.GetByteSize("maximum-frame-size", null)) ?? 128000, ssl: config.HasPath("ssl") && enableSsl ? SslSettings.Create(config.GetConfig("ssl")) : SslSettings.Empty, - dnsUseIpv6: config.GetBoolean("dns-use-ipv6", false), + dnsUseIpv6: config.GetBoolean("dns-use-ipv6"), tcpReuseAddr: ResolveTcpReuseAddrOption(config.GetString("tcp-reuse-addr", "off-for-windows")), tcpKeepAlive: config.GetBoolean("tcp-keepalive", true), tcpNoDelay: config.GetBoolean("tcp-nodelay", true), backlog: config.GetInt("backlog", 4096), - enforceIpFamily: RuntimeDetector.IsMono || config.GetBoolean("enforce-ip-family", false), + enforceIpFamily: RuntimeDetector.IsMono || config.GetBoolean("enforce-ip-family"), receiveBufferSize: ToNullableInt(config.GetByteSize("receive-buffer-size", null) ?? 256000), sendBufferSize: ToNullableInt(config.GetByteSize("send-buffer-size", null) ?? 256000), writeBufferHighWaterMark: ToNullableInt(config.GetByteSize("write-buffer-high-water-mark", null)), writeBufferLowWaterMark: ToNullableInt(config.GetByteSize("write-buffer-low-water-mark", null)), - backwardsCompatibilityModeEnabled: config.GetBoolean("enable-backwards-compatibility", false), - logTransport: config.HasPath("log-transport") && config.GetBoolean("log-transport", false), + backwardsCompatibilityModeEnabled: config.GetBoolean("enable-backwards-compatibility"), + logTransport: config.HasPath("log-transport") && config.GetBoolean("log-transport"), byteOrder: order, enableBufferPooling: config.GetBoolean("enable-pooling", true), batchWriterSettings: batchWriterSettings); @@ -115,9 +115,9 @@ private static int ComputeWorkerPoolSize(Config config) return ThreadPoolConfig.ScaledPoolSize(2, 1.0, 2); return ThreadPoolConfig.ScaledPoolSize( - floor: config.GetInt("pool-size-min", 0), - scalar: config.GetDouble("pool-size-factor", 0), - ceiling: config.GetInt("pool-size-max", 0)); + floor: config.GetInt("pool-size-min"), + scalar: config.GetDouble("pool-size-factor"), + ceiling: config.GetInt("pool-size-max")); } /// @@ -296,18 +296,18 @@ public static SslSettings Create(Config config) if (config.IsNullOrEmpty()) throw new ConfigurationException($"Failed to create {typeof(DotNettyTransportSettings)}: DotNetty SSL HOCON config was not found (default path: `akka.remote.dot-netty.ssl`)"); - if (config.GetBoolean("certificate.use-thumprint-over-file", false) - || config.GetBoolean("certificate.use-thumbprint-over-file", false)) + if (config.GetBoolean("certificate.use-thumprint-over-file") + || config.GetBoolean("certificate.use-thumbprint-over-file")) { - var thumbprint = config.GetString("certificate.thumbprint", null) - ?? config.GetString("certificate.thumpbrint", null); + var thumbprint = config.GetString("certificate.thumbprint") + ?? config.GetString("certificate.thumpbrint"); if (string.IsNullOrWhiteSpace(thumbprint)) throw new Exception("`akka.remote.dot-netty.ssl.certificate.use-thumbprint-over-file` is set to true but `akka.remote.dot-netty.ssl.certificate.thumbprint` is null or empty"); return new SslSettings(thumbprint, - config.GetString("certificate.store-name", null), - ParseStoreLocationName(config.GetString("certificate.store-location", null)), - config.GetBoolean("suppress-validation", false)); + config.GetString("certificate.store-name"), + ParseStoreLocationName(config.GetString("certificate.store-location")), + config.GetBoolean("suppress-validation")); } else @@ -316,10 +316,10 @@ public static SslSettings Create(Config config) var flags = flagsRaw.Aggregate(X509KeyStorageFlags.DefaultKeySet, (flag, str) => flag | ParseKeyStorageFlag(str)); return new SslSettings( - certificatePath: config.GetString("certificate.path", null), - certificatePassword: config.GetString("certificate.password", null), + certificatePath: config.GetString("certificate.path"), + certificatePassword: config.GetString("certificate.password"), flags: flags, - suppressValidation: config.GetBoolean("suppress-validation", false)); + suppressValidation: config.GetBoolean("suppress-validation")); } } diff --git a/src/core/Akka.Remote/Transport/FailureInjectorTransportAdapter.cs b/src/core/Akka.Remote/Transport/FailureInjectorTransportAdapter.cs index 13a390f69bf..f29b6d65878 100644 --- a/src/core/Akka.Remote/Transport/FailureInjectorTransportAdapter.cs +++ b/src/core/Akka.Remote/Transport/FailureInjectorTransportAdapter.cs @@ -194,7 +194,7 @@ public FailureInjectorTransportAdapter(Transport wrappedTransport, ExtendedActor { ExtendedActorSystem = extendedActorSystem; _log = Logging.GetLogger(ExtendedActorSystem, this); - _shouldDebugLog = ExtendedActorSystem.Settings.Config.GetBoolean("akka.remote.gremlin.debug", false); + _shouldDebugLog = ExtendedActorSystem.Settings.Config.GetBoolean("akka.remote.gremlin.debug"); } private ILoggingAdapter _log; diff --git a/src/core/Akka.Remote/Transport/TestTransport.cs b/src/core/Akka.Remote/Transport/TestTransport.cs index 51048ffcdac..7a60eaec7f2 100644 --- a/src/core/Akka.Remote/Transport/TestTransport.cs +++ b/src/core/Akka.Remote/Transport/TestTransport.cs @@ -107,7 +107,7 @@ public TestTransport(Address localAddress, AssociationRegistry registry, long ma private static string GetConfigString(Config conf, string name) { - var value = conf.GetString(name, null); + var value = conf.GetString(name); if (value == null) throw new ConfigurationException("Please specify a value for config setting \"" + name + "\""); return value; diff --git a/src/core/Akka.Streams.Tests.TCK/AkkaPublisherVerification.cs b/src/core/Akka.Streams.Tests.TCK/AkkaPublisherVerification.cs index 6e2115ef7c1..ff7a390cbaa 100644 --- a/src/core/Akka.Streams.Tests.TCK/AkkaPublisherVerification.cs +++ b/src/core/Akka.Streams.Tests.TCK/AkkaPublisherVerification.cs @@ -42,7 +42,7 @@ protected AkkaPublisherVerification(bool writeLineDebug) protected AkkaPublisherVerification(Config config) : this( new TestEnvironment(Timeouts.DefaultTimeoutMillis, - TestEnvironment.EnvironmentDefaultNoSignalsTimeoutMilliseconds(), false), + TestEnvironment.EnvironmentDefaultNoSignalsTimeoutMilliseconds()), Timeouts.PublisherShutdownTimeoutMillis, config) { } diff --git a/src/core/Akka.Streams.Tests/Dsl/FlowAskSpec.cs b/src/core/Akka.Streams.Tests/Dsl/FlowAskSpec.cs index 3db6cd56abb..8ec7851f1e4 100644 --- a/src/core/Akka.Streams.Tests/Dsl/FlowAskSpec.cs +++ b/src/core/Akka.Streams.Tests/Dsl/FlowAskSpec.cs @@ -330,7 +330,7 @@ public async Task Flow_with_ask_must_resume_after_ask_failure() => await this.As public async Task Flow_with_ask_must_resume_after_multiple_failures() => await this.AssertAllStagesStoppedAsync(() => { var aref = ReplierFailAllExceptOn(6); var t = Source.From(Enumerable.Range(1, 6)) - .Ask(aref, _timeout, 2) + .Ask(aref, _timeout) .WithAttributes(ActorAttributes.CreateSupervisionStrategy(Supervision.Deciders.ResumingDecider)) .RunWith(Sink.First(), _materializer); diff --git a/src/core/Akka.Streams.Tests/Dsl/FlowGroupBySpec.cs b/src/core/Akka.Streams.Tests/Dsl/FlowGroupBySpec.cs index 1422d3f8dff..411b55fc67a 100644 --- a/src/core/Akka.Streams.Tests/Dsl/FlowGroupBySpec.cs +++ b/src/core/Akka.Streams.Tests/Dsl/FlowGroupBySpec.cs @@ -46,7 +46,7 @@ public async Task GroupBy_must_work_in_the_happy_case() { await this.AssertAllStagesStoppedAsync(async () => { - await WithSubStreamsSupport(2, run: async (masterSubscriber, masterSubscription, getSubFlow) => + await WithSubStreamsSupport(run: async (masterSubscriber, masterSubscription, getSubFlow) => { var (sub1, probe1) = await StreamPuppet((await getSubFlow(1)) .RunWith(Sink.AsPublisher(false), Materializer), this); @@ -129,7 +129,7 @@ public async Task GroupBy_must_accept_cancelling_subStreams() { await this.AssertAllStagesStoppedAsync(async () => { - await WithSubStreamsSupport(2, maxSubStream: 3, run: async (masterSubscriber, masterSubscription, getSubFlow) => + await WithSubStreamsSupport(maxSubStream: 3, run: async (masterSubscriber, masterSubscription, getSubFlow) => { var (s1, _) = await StreamPuppet((await getSubFlow(1)).RunWith(Sink.AsPublisher(false), Materializer), this); s1.Cancel(); diff --git a/src/core/Akka.Streams/ActorMaterializer.cs b/src/core/Akka.Streams/ActorMaterializer.cs index 20b77c9ed66..a01177fa461 100644 --- a/src/core/Akka.Streams/ActorMaterializer.cs +++ b/src/core/Akka.Streams/ActorMaterializer.cs @@ -388,9 +388,9 @@ private static ActorMaterializerSettings Create(Config config) dispatcher: config.GetString("dispatcher", string.Empty), supervisionDecider: Deciders.StoppingDecider, subscriptionTimeoutSettings: StreamSubscriptionTimeoutSettings.Create(config), - isDebugLogging: config.GetBoolean("debug-logging", false), + isDebugLogging: config.GetBoolean("debug-logging"), outputBurstLimit: config.GetInt("output-burst-limit", 1000), - isFuzzingMode: config.GetBoolean("debug.fuzzing-mode", false), + isFuzzingMode: config.GetBoolean("debug.fuzzing-mode"), isAutoFusing: config.GetBoolean("auto-fusing", true), maxFixedBufferSize: config.GetInt("max-fixed-buffer-size", 1000000000), syncProcessingLimit: config.GetInt("sync-processing-limit", 1000), diff --git a/src/core/Akka.Streams/Dsl/RestartFlow.cs b/src/core/Akka.Streams/Dsl/RestartFlow.cs index 86e2ca9c0e5..4c2243ba778 100644 --- a/src/core/Akka.Streams/Dsl/RestartFlow.cs +++ b/src/core/Akka.Streams/Dsl/RestartFlow.cs @@ -253,7 +253,7 @@ protected override void Backoff() } } - private Flow DelayCancellation(TimeSpan duration) => Flow.FromGraph(new DelayCancellationStage(duration, null)); + private Flow DelayCancellation(TimeSpan duration) => Flow.FromGraph(new DelayCancellationStage(duration)); } } diff --git a/src/core/Akka.Streams/Implementation/Sinks.cs b/src/core/Akka.Streams/Implementation/Sinks.cs index ffb513c0bbf..d632e9964e0 100644 --- a/src/core/Akka.Streams/Implementation/Sinks.cs +++ b/src/core/Akka.Streams/Implementation/Sinks.cs @@ -1071,7 +1071,7 @@ private sealed class ObserverDisposable : IDisposable { private readonly ObservableLogic _logic; private readonly IObserver _observer; - private readonly AtomicBoolean _disposed = new AtomicBoolean(false); + private readonly AtomicBoolean _disposed = new AtomicBoolean(); public ObserverDisposable(ObservableLogic logic, IObserver observer) { diff --git a/src/core/Akka.TestKit.Tests/TestActorRefTests/NestingActor.cs b/src/core/Akka.TestKit.Tests/TestActorRefTests/NestingActor.cs index e7a71224d07..cdaee4c3543 100644 --- a/src/core/Akka.TestKit.Tests/TestActorRefTests/NestingActor.cs +++ b/src/core/Akka.TestKit.Tests/TestActorRefTests/NestingActor.cs @@ -15,7 +15,7 @@ public class NestingActor : ActorBase public NestingActor(bool createTestActorRef) { - _nested = createTestActorRef ? Context.System.ActorOf() : new TestActorRef(Context.System, Props.Create(), null, null); + _nested = createTestActorRef ? Context.System.ActorOf() : new TestActorRef(Context.System, Props.Create()); } protected override bool Receive(object message) diff --git a/src/core/Akka.TestKit.Tests/TestKit_Config_Tests.cs b/src/core/Akka.TestKit.Tests/TestKit_Config_Tests.cs index 0ac5a404dce..91a02a2b9f5 100644 --- a/src/core/Akka.TestKit.Tests/TestKit_Config_Tests.cs +++ b/src/core/Akka.TestKit.Tests/TestKit_Config_Tests.cs @@ -23,8 +23,8 @@ public void DefaultValues_should_be_correct() TestKitSettings.TestTimeFactor.ShouldBe(1); var callingThreadDispatcherTypeName = typeof(CallingThreadDispatcherConfigurator).FullName + ", " + typeof(CallingThreadDispatcher).Assembly.GetName().Name; Assert.False(Sys.Settings.Config.IsEmpty); - Sys.Settings.Config.GetString("akka.test.calling-thread-dispatcher.type", null).ShouldBe(callingThreadDispatcherTypeName); - Sys.Settings.Config.GetString("akka.test.test-actor.dispatcher.type", null).ShouldBe(callingThreadDispatcherTypeName); + Sys.Settings.Config.GetString("akka.test.calling-thread-dispatcher.type").ShouldBe(callingThreadDispatcherTypeName); + Sys.Settings.Config.GetString("akka.test.test-actor.dispatcher.type").ShouldBe(callingThreadDispatcherTypeName); CallingThreadDispatcher.Id.ShouldBe("akka.test.calling-thread-dispatcher"); } } diff --git a/src/core/Akka.TestKit.Tests/TestSchedulerTests.cs b/src/core/Akka.TestKit.Tests/TestSchedulerTests.cs index 334ee5c4a50..bf400601346 100644 --- a/src/core/Akka.TestKit.Tests/TestSchedulerTests.cs +++ b/src/core/Akka.TestKit.Tests/TestSchedulerTests.cs @@ -47,7 +47,7 @@ public async Task Does_not_deliver_message_prematurely() [Fact] public async Task Delivers_messages_scheduled_for_same_time_in_order_they_were_added() { - _testReceiveActor.Tell(new ScheduleOnceMessage(TimeSpan.FromSeconds(1), 1)); + _testReceiveActor.Tell(new ScheduleOnceMessage(TimeSpan.FromSeconds(1))); _testReceiveActor.Tell(new ScheduleOnceMessage(TimeSpan.FromSeconds(1), 2)); await _testReceiveActor.Ask(new Identify(null), RemainingOrDefault); // verify that the ActorCell has started diff --git a/src/core/Akka.TestKit/EventFilter/Internal/ErrorFilter.cs b/src/core/Akka.TestKit/EventFilter/Internal/ErrorFilter.cs index 8484b30773b..23017d677c4 100644 --- a/src/core/Akka.TestKit/EventFilter/Internal/ErrorFilter.cs +++ b/src/core/Akka.TestKit/EventFilter/Internal/ErrorFilter.cs @@ -26,7 +26,7 @@ public class ErrorFilter : EventFilterBase /// TBD /// TBD public ErrorFilter(IStringMatcher messageMatcher = null, IStringMatcher sourceMatcher = null) - : this(null,messageMatcher,sourceMatcher, false) + : this(null,messageMatcher,sourceMatcher) { } diff --git a/src/core/Akka.TestKit/TestKitBase_ActorOf.cs b/src/core/Akka.TestKit/TestKitBase_ActorOf.cs index 0bd7e3f430a..a4dcb778a8a 100644 --- a/src/core/Akka.TestKit/TestKitBase_ActorOf.cs +++ b/src/core/Akka.TestKit/TestKitBase_ActorOf.cs @@ -26,7 +26,7 @@ public partial class TestKitBase /// TBD public IActorRef ActorOf(Props props) { - return Sys.ActorOf(props, null); + return Sys.ActorOf(props); } /// @@ -47,7 +47,7 @@ public IActorRef ActorOf(Props props, string name) /// TBD public IActorRef ActorOf() where TActor : ActorBase, new() { - return Sys.ActorOf(Props.Create(), null); + return Sys.ActorOf(Props.Create()); } /// @@ -73,7 +73,7 @@ public IActorRef ActorOf(Props props, string name) /// TBD public IActorRef ActorOf(Expression> factory) where TActor : ActorBase { - return Sys.ActorOf(Props.Create(factory), null); + return Sys.ActorOf(Props.Create(factory)); } /// diff --git a/src/core/Akka.TestKit/TestKitSettings.cs b/src/core/Akka.TestKit/TestKitSettings.cs index b7dd269fd1d..f03b32fa208 100644 --- a/src/core/Akka.TestKit/TestKitSettings.cs +++ b/src/core/Akka.TestKit/TestKitSettings.cs @@ -34,11 +34,11 @@ public TestKitSettings(Config config) if (config.IsNullOrEmpty()) throw ConfigurationException.NullOrEmptyConfig(); - _defaultTimeout = config.GetTimeSpan("akka.test.default-timeout", null, allowInfinite:false); - _singleExpectDefault = config.GetTimeSpan("akka.test.single-expect-default", null, allowInfinite: false); - _testEventFilterLeeway = config.GetTimeSpan("akka.test.filter-leeway", null, allowInfinite: false); - _timefactor = config.GetDouble("akka.test.timefactor", 0); - _logTestKitCalls = config.GetBoolean("akka.test.testkit.debug", false); + _defaultTimeout = config.GetTimeSpan("akka.test.default-timeout", allowInfinite:false); + _singleExpectDefault = config.GetTimeSpan("akka.test.single-expect-default", allowInfinite: false); + _testEventFilterLeeway = config.GetTimeSpan("akka.test.filter-leeway", allowInfinite: false); + _timefactor = config.GetDouble("akka.test.timefactor"); + _logTestKitCalls = config.GetBoolean("akka.test.testkit.debug"); if(_timefactor <= 0) throw new ConfigurationException($@"Expected a positive value for ""akka.test.timefactor"" but found {_timefactor}"); diff --git a/src/core/Akka.Tests.Performance/Dispatch/GetMailboxTypeSpec.cs b/src/core/Akka.Tests.Performance/Dispatch/GetMailboxTypeSpec.cs index 63e89b750b7..42c421a5624 100644 --- a/src/core/Akka.Tests.Performance/Dispatch/GetMailboxTypeSpec.cs +++ b/src/core/Akka.Tests.Performance/Dispatch/GetMailboxTypeSpec.cs @@ -25,7 +25,7 @@ protected override void OnReceive(object message) public static Props Props { get; } = Props.Create(() => new EchoActor()); } - private static readonly AtomicCounter Counter = new AtomicCounter(0); + private static readonly AtomicCounter Counter = new AtomicCounter(); private Counter _createActorThroughput; private const string CreateThroughputCounter = "GetMailboxTypeFootprint"; private const int GetMailboxTypeNumber = 1000000; diff --git a/src/core/Akka.Tests/Actor/ActorBecomeTests.cs b/src/core/Akka.Tests/Actor/ActorBecomeTests.cs index 6c90b1f0491..189939d24bb 100644 --- a/src/core/Akka.Tests/Actor/ActorBecomeTests.cs +++ b/src/core/Akka.Tests/Actor/ActorBecomeTests.cs @@ -101,7 +101,7 @@ public async Task Given_actor_that_calls_become_in_the_become_handler_only_first await ExpectMsgAsync("A says: hi"); await ExpectMsgAsync("A says: True"); //we dont expect any further messages - await ExpectNoMsgAsync(default); + await ExpectNoMsgAsync(); } private class BecomeActor : UntypedActor diff --git a/src/core/Akka.Tests/Actor/ActorRefIgnoreSpec.cs b/src/core/Akka.Tests/Actor/ActorRefIgnoreSpec.cs index ff92dcb844e..a31654c39d4 100644 --- a/src/core/Akka.Tests/Actor/ActorRefIgnoreSpec.cs +++ b/src/core/Akka.Tests/Actor/ActorRefIgnoreSpec.cs @@ -34,7 +34,7 @@ public async Task IgnoreActorRef_should_ignore_all_incoming_messages() // since the reply is ignored, we can't check that a message was sent to it askMeRef.Tell(new Request(Sys.IgnoreRef)); - await probe.ExpectNoMsgAsync(default); + await probe.ExpectNoMsgAsync(); // but we do check that the counter has increased when we used the ActorRef.ignore askMeRef.Tell(new Request(probe.Ref)); diff --git a/src/core/Akka.Tests/Actor/ActorRefSpec.cs b/src/core/Akka.Tests/Actor/ActorRefSpec.cs index 5de3d99e377..8b103489525 100644 --- a/src/core/Akka.Tests/Actor/ActorRefSpec.cs +++ b/src/core/Akka.Tests/Actor/ActorRefSpec.cs @@ -307,7 +307,7 @@ public async Task An_ActorRef_should_never_have_a_null_Sender_Bug_1212() await EventFilter.DeadLetter().ExpectOneAsync(() => { actor.Tell(new object(), null); return Task.CompletedTask; }); // will throw an exception if there's a bug - await ExpectNoMsgAsync(default); + await ExpectNoMsgAsync(); } [Fact] diff --git a/src/core/Akka.Tests/Actor/ActorSelectionSpec.cs b/src/core/Akka.Tests/Actor/ActorSelectionSpec.cs index a4eb89b9ac0..510ced1a07a 100644 --- a/src/core/Akka.Tests/Actor/ActorSelectionSpec.cs +++ b/src/core/Akka.Tests/Actor/ActorSelectionSpec.cs @@ -533,7 +533,7 @@ public async Task An_ActorSelection_must_identify_actors_with_wildcard_selection var probe = CreateTestProbe(); Sys.ActorSelection("/user/a/*").Tell(new Identify(1), probe.Ref); - var received = await probe.ReceiveNAsync(2, default) + var received = await probe.ReceiveNAsync(2) .Cast() .Select(i => i.Subject) .ToListAsync(); @@ -589,7 +589,7 @@ public async Task An_ActorSelection_must_identify_actors_with_double_wildcard_se // grab everything below /user/a Sys.ActorSelection("/user/a/**").Tell(new Identify(1), probe.Ref); - var received = await probe.ReceiveNAsync(6, default) + var received = await probe.ReceiveNAsync(6) .Cast() .Select(i => i.Subject) .ToListAsync(); @@ -598,7 +598,7 @@ public async Task An_ActorSelection_must_identify_actors_with_double_wildcard_se // grab everything below /user/a/b2 Sys.ActorSelection("/user/a/b2/**").Tell(new Identify(2), probe.Ref); - received = await probe.ReceiveNAsync(3, default) + received = await probe.ReceiveNAsync(3) .Cast() .Select(i => i.Subject) .ToListAsync(); diff --git a/src/core/Akka.Tests/Actor/CoordinatedShutdownSpec.cs b/src/core/Akka.Tests/Actor/CoordinatedShutdownSpec.cs index 95d06b20a74..3edc5aab352 100644 --- a/src/core/Akka.Tests/Actor/CoordinatedShutdownSpec.cs +++ b/src/core/Akka.Tests/Actor/CoordinatedShutdownSpec.cs @@ -209,7 +209,7 @@ public async Task CoordinatedShutdown_must_run_ordered_phases() }); await co.Run(CoordinatedShutdown.UnknownReason.Instance).AwaitWithTimeout(RemainingOrDefault); - (await ReceiveNAsync(4, default).ToListAsync()).Should().Equal(new object[] { "A", "B", "B", "C" }); + (await ReceiveNAsync(4).ToListAsync()).Should().Equal(new object[] { "A", "B", "B", "C" }); } [Fact] @@ -242,7 +242,7 @@ public async Task CoordinatedShutdown_must_run_from_given_phase() }); await co.Run(customReason, "b").AwaitWithTimeout(RemainingOrDefault); - (await ReceiveNAsync(2, default).ToListAsync()).Should().Equal(new object[] { "B", "C" }); + (await ReceiveNAsync(2).ToListAsync()).Should().Equal(new object[] { "B", "C" }); co.ShutdownReason.Should().BeEquivalentTo(customReason); } diff --git a/src/core/Akka.Tests/Actor/DeathWatchSpec.cs b/src/core/Akka.Tests/Actor/DeathWatchSpec.cs index 02f33e78ec7..d9dac0dcf69 100644 --- a/src/core/Akka.Tests/Actor/DeathWatchSpec.cs +++ b/src/core/Akka.Tests/Actor/DeathWatchSpec.cs @@ -233,8 +233,8 @@ public async Task DeathWatch_must_notify_only_when_watching() [Fact] public async Task DeathWatch_must_discard_Terminated_when_unwatched_between_sysmsg_and_processing() { - var t1 = CreateTestLatch(1); - var t2 = CreateTestLatch(1); + var t1 = CreateTestLatch(); + var t2 = CreateTestLatch(); var p = CreateTestProbe(); var w = Sys.ActorOf(Props.Create(() => new Watcher()).WithDeploy(Deploy.Local), "testWatcher"); diff --git a/src/core/Akka.Tests/Actor/Dispatch/ActorModelSpec.cs b/src/core/Akka.Tests/Actor/Dispatch/ActorModelSpec.cs index a2ad55493ab..1256e294042 100644 --- a/src/core/Akka.Tests/Actor/Dispatch/ActorModelSpec.cs +++ b/src/core/Akka.Tests/Actor/Dispatch/ActorModelSpec.cs @@ -195,7 +195,7 @@ public ThrowException(Exception e) class DispatcherActor : ReceiveActor { - private Switch _busy = new Switch(false); + private Switch _busy = new Switch(); private readonly ILoggingAdapter _log = Context.GetLogger(); private MessageDispatcherInterceptor _interceptor = Context.Dispatcher.AsInstanceOf(); @@ -321,11 +321,11 @@ public MessageDispatcherInterceptorConfigurator(Config config, IDispatcherPrereq throw ConfigurationException.NullOrEmptyConfig(); _instance = new MessageDispatcherInterceptor(this, - config.GetString("id", null), - config.GetInt("throughput", 0), - config.GetTimeSpan("throughput-deadline-time", null).Ticks, + config.GetString("id"), + config.GetInt("throughput"), + config.GetTimeSpan("throughput-deadline-time").Ticks, ConfigureExecutor(), - Config.GetTimeSpan("shutdown-timeout", null)); + Config.GetTimeSpan("shutdown-timeout")); } public override MessageDispatcher Dispatcher() diff --git a/src/core/Akka.Tests/Actor/Dispatch/Bug2640Spec.cs b/src/core/Akka.Tests/Actor/Dispatch/Bug2640Spec.cs index 03573fd7151..36e4bd6c89e 100644 --- a/src/core/Akka.Tests/Actor/Dispatch/Bug2640Spec.cs +++ b/src/core/Akka.Tests/Actor/Dispatch/Bug2640Spec.cs @@ -80,7 +80,7 @@ public async Task ForkJoinExecutorShouldShutdownUponActorSystemTermination() for (var i = 0; i < 100; i++) actor.Tell(GetThread.Instance); - var objs = await ReceiveNAsync(100, default).ToListAsync(); + var objs = await ReceiveNAsync(100).ToListAsync(); threads = objs.Cast().GroupBy(x => x.ManagedThreadId) .ToDictionary(x => x.Key, grouping => grouping.First()); @@ -100,7 +100,7 @@ public async Task ForkJoinExecutorShouldShutdownUponAllActorsTerminating() for (var i = 0; i < 100; i++) actor.Tell(GetThread.Instance); - var objs = await ReceiveNAsync(100, default).ToListAsync(); + var objs = await ReceiveNAsync(100).ToListAsync(); threads = objs.Cast().GroupBy(x => x.ManagedThreadId) .ToDictionary(x => x.Key, grouping => grouping.First()); diff --git a/src/core/Akka.Tests/Actor/FSMActorSpec.cs b/src/core/Akka.Tests/Actor/FSMActorSpec.cs index ffce0025835..fd00b90626b 100644 --- a/src/core/Akka.Tests/Actor/FSMActorSpec.cs +++ b/src/core/Akka.Tests/Actor/FSMActorSpec.cs @@ -317,7 +317,7 @@ public StopTimersFSM(IActorRef testActor, List timerNames) { foreach (var timerName in timerNames) { - SetTimer(timerName, new object(), 10.Seconds(), false); + SetTimer(timerName, new object(), 10.Seconds()); } } }); diff --git a/src/core/Akka.Tests/Actor/FSMTimingSpec.cs b/src/core/Akka.Tests/Actor/FSMTimingSpec.cs index a7e87f1a8af..6867a4c64d8 100644 --- a/src/core/Akka.Tests/Actor/FSMTimingSpec.cs +++ b/src/core/Akka.Tests/Actor/FSMTimingSpec.cs @@ -283,7 +283,7 @@ public StateMachine(IActorRef tester) switch (name) { case FsmState.TestSingleTimer: - SetTimer("tester", Tick.Instance, 500.Milliseconds(), false); + SetTimer("tester", Tick.Instance, 500.Milliseconds()); return GoTo(FsmState.TestSingleTimer); case FsmState.TestRepeatedTimer: SetTimer("tester", Tick.Instance, 100.Milliseconds(), true); diff --git a/src/core/Akka.Tests/Actor/FunctionRefSpecs.cs b/src/core/Akka.Tests/Actor/FunctionRefSpecs.cs index 26255b741ea..33fd0f7ce64 100644 --- a/src/core/Akka.Tests/Actor/FunctionRefSpecs.cs +++ b/src/core/Akka.Tests/Actor/FunctionRefSpecs.cs @@ -121,7 +121,7 @@ public SupSuper() #endregion - public FunctionRefSpec(ITestOutputHelper output) : base(output, null) + public FunctionRefSpec(ITestOutputHelper output) : base(output) { } diff --git a/src/core/Akka.Tests/Actor/PipeToSupportSpec.cs b/src/core/Akka.Tests/Actor/PipeToSupportSpec.cs index 93f1af9556c..da0165a00b3 100644 --- a/src/core/Akka.Tests/Actor/PipeToSupportSpec.cs +++ b/src/core/Akka.Tests/Actor/PipeToSupportSpec.cs @@ -136,7 +136,7 @@ public async Task Should_use_success_handling_to_transform_task_result() _taskWithoutResult.PipeTo(TestActor, success: () => "Hello"); #pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed _taskCompletionSource.SetResult("World"); - var pipeTo = await ReceiveNAsync(2, default).Cast().ToListAsync(); + var pipeTo = await ReceiveNAsync(2).Cast().ToListAsync(); pipeTo.Should().Contain("Hello"); pipeTo.Should().Contain("Hello World"); } @@ -151,7 +151,7 @@ public async Task ValueTask_Should_use_success_handling_to_transform_task_result _valueTaskWithoutResult.PipeTo(TestActor, success: () => "Hello"); #pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed _taskCompletionSource.SetResult("World"); - var pipeTo = await ReceiveNAsync(2, default).Cast().ToListAsync(); + var pipeTo = await ReceiveNAsync(2).Cast().ToListAsync(); pipeTo.Should().Contain("Hello"); pipeTo.Should().Contain("Hello World"); } diff --git a/src/core/Akka.Tests/Actor/ReceiveActorTests.cs b/src/core/Akka.Tests/Actor/ReceiveActorTests.cs index d822f3dd256..4b266af83c8 100644 --- a/src/core/Akka.Tests/Actor/ReceiveActorTests.cs +++ b/src/core/Akka.Tests/Actor/ReceiveActorTests.cs @@ -198,7 +198,7 @@ public IntPredicatesActor() } return false; }); //Func, when 10 <= i < 15 - Receive(i => Sender.Tell("int:" + i, Self), null); //Null predicate, when i >= 15 + Receive(i => Sender.Tell("int:" + i, Self)); //Null predicate, when i >= 15 Receive(i => Sender.Tell("ShouldNeverMatch:" + i, Self)); //The handler above should never be invoked } } diff --git a/src/core/Akka.Tests/Actor/TimerSpec.cs b/src/core/Akka.Tests/Actor/TimerSpec.cs index dc0f8285132..6e5c89de291 100644 --- a/src/core/Akka.Tests/Actor/TimerSpec.cs +++ b/src/core/Akka.Tests/Actor/TimerSpec.cs @@ -80,7 +80,7 @@ public async Task Must_replace_timer() await probe.ExpectMsgAsync(new Tock(1)); - var latch = CreateTestLatch(1); + var latch = CreateTestLatch(); // next Tock(1) enqueued in mailboxed, but should be discarded because of new timer actor.Tell(new SlowThenBump(latch)); await probe.ExpectNoMsgAsync(TimeSpan.FromSeconds(interval) + TimeSpan.FromMilliseconds(100)); @@ -128,7 +128,7 @@ public async Task Must_discard_timers_from_old_incarnation_after_restart_alt_1() await probe.ExpectMsgAsync(new Tock(1)); - var latch = CreateTestLatch(1); + var latch = CreateTestLatch(); // next Tock(1) is enqueued in mailbox, but should be discarded by new incarnation actor.Tell(new SlowThenThrow(latch, new Exc())); await probe.ExpectNoMsgAsync(TimeSpan.FromSeconds(interval) + TimeSpan.FromMilliseconds(100)); @@ -153,7 +153,7 @@ public async Task Must_discard_timers_from_old_incarnation_after_restart_alt_2() await probe.ExpectMsgAsync(new Tock(2)); - var latch = CreateTestLatch(1); + var latch = CreateTestLatch(); // next Tock(2) is enqueued in mailbox, but should be discarded by new incarnation actor.Tell(new SlowThenThrow(latch, new Exc())); await probe.ExpectNoMsgAsync(TimeSpan.FromSeconds(interval) + TimeSpan.FromMilliseconds(100)); diff --git a/src/core/Akka.Tests/IO/UdpConnectedIntegrationSpec.cs b/src/core/Akka.Tests/IO/UdpConnectedIntegrationSpec.cs index 6b95f157af4..29599aa5c84 100644 --- a/src/core/Akka.Tests/IO/UdpConnectedIntegrationSpec.cs +++ b/src/core/Akka.Tests/IO/UdpConnectedIntegrationSpec.cs @@ -151,7 +151,7 @@ public async Task The_UDP_connection_oriented_implementation_must_to_send_batch_ client.Tell(UdpConnected.Send.Create(data)); client.Tell(UdpConnected.Send.Create(data)); - var raw = await serverProbe.ReceiveNAsync(3, default).ToListAsync(); + var raw = await serverProbe.ReceiveNAsync(3).ToListAsync(); var serverMsgs = raw.Cast(); serverMsgs.Sum(x => x.Data.Count).Should().Be(data.Count * 3); await serverProbe.ExpectNoMsgAsync(100.Milliseconds()); @@ -161,7 +161,7 @@ public async Task The_UDP_connection_oriented_implementation_must_to_send_batch_ server.Tell(Udp.Send.Create(data, clientEndPoint)); server.Tell(Udp.Send.Create(data, clientEndPoint)); - raw = await clientProbe.ReceiveNAsync(3, default).ToListAsync(); + raw = await clientProbe.ReceiveNAsync(3).ToListAsync(); var clientMsgs = raw.Cast(); clientMsgs.Sum(x => x.Data.Count).Should().Be(data.Count * 3); } diff --git a/src/core/Akka.Tests/IO/UdpIntegrationSpec.cs b/src/core/Akka.Tests/IO/UdpIntegrationSpec.cs index 1dc0bee8a79..19bad9750b9 100644 --- a/src/core/Akka.Tests/IO/UdpIntegrationSpec.cs +++ b/src/core/Akka.Tests/IO/UdpIntegrationSpec.cs @@ -94,7 +94,7 @@ public async Task BugFix_UDP_fire_and_forget_must_handle_batch_writes_when_bound client.Tell(Udp.Send.Create(data, serverLocalEndpoint)); client.Tell(Udp.Send.Create(data, serverLocalEndpoint)); - var raw = await ReceiveNAsync(3, default).ToListAsync(); + var raw = await ReceiveNAsync(3).ToListAsync(); var msgs = raw.Cast(); msgs.Sum(x => x.Data.Count).Should().Be(data.Count*3); await ExpectNoMsgAsync(100.Milliseconds()); @@ -104,7 +104,7 @@ public async Task BugFix_UDP_fire_and_forget_must_handle_batch_writes_when_bound server.Tell(Udp.Send.Create(data, clientLocalEndpoint)); server.Tell(Udp.Send.Create(data, clientLocalEndpoint)); - raw = await ReceiveNAsync(3, default).ToListAsync(); + raw = await ReceiveNAsync(3).ToListAsync(); msgs = raw.Cast(); msgs.Sum(x => x.Data.Count).Should().Be(data.Count * 3); } @@ -218,7 +218,7 @@ public async Task The_UDP_Fire_and_Forget_implementation_must_not_leak_memory() for (var i = 0; i < batchSize; i++) server.Tell(Udp.Send.Create(data, clientLocalEndpoint)); - var msgs = await clientProbe.ReceiveNAsync(batchSize, default).ToListAsync(); + var msgs = await clientProbe.ReceiveNAsync(batchSize).ToListAsync(); var receives = msgs.Cast(); receives.Sum(r => r.Data.Count).Should().Be(data.Count * batchSize); } diff --git a/src/core/Akka.Tests/Pattern/BackoffOnRestartSupervisorSpec.cs b/src/core/Akka.Tests/Pattern/BackoffOnRestartSupervisorSpec.cs index 7c37329139a..35521db04aa 100644 --- a/src/core/Akka.Tests/Pattern/BackoffOnRestartSupervisorSpec.cs +++ b/src/core/Akka.Tests/Pattern/BackoffOnRestartSupervisorSpec.cs @@ -225,7 +225,7 @@ public async Task BackoffOnRestartSupervisor_must_forward_messages_from_the_chil [Fact] public async Task BackoffOnRestartSupervisor_must_accept_commands_while_child_is_terminating() { - var postStopLatch = CreateTestLatch(1); + var postStopLatch = CreateTestLatch(); var options = Backoff.OnFailure(SlowlyFailingActor.Props(postStopLatch), "someChildName", 1.Ticks(), 1.Ticks(), 0.0, -1) .WithSupervisorStrategy(new OneForOneStrategy(ex => ex is StoppingException ? Directive.Stop diff --git a/src/core/Akka.Tests/Routing/ConfiguredLocalRoutingSpec.cs b/src/core/Akka.Tests/Routing/ConfiguredLocalRoutingSpec.cs index a2886cba720..71c70fe7eb6 100644 --- a/src/core/Akka.Tests/Routing/ConfiguredLocalRoutingSpec.cs +++ b/src/core/Akka.Tests/Routing/ConfiguredLocalRoutingSpec.cs @@ -179,7 +179,7 @@ public MyRoutingLogic(Config config) public override Routee Select(object message, Routee[] routees) { - return new MyRoutee(_config.GetString(message.ToString(), null)); + return new MyRoutee(_config.GetString(message.ToString())); } } diff --git a/src/core/Akka.Tests/Serialization/SerializationSpec.cs b/src/core/Akka.Tests/Serialization/SerializationSpec.cs index 28de99f5f4f..ad72481087a 100644 --- a/src/core/Akka.Tests/Serialization/SerializationSpec.cs +++ b/src/core/Akka.Tests/Serialization/SerializationSpec.cs @@ -556,7 +556,7 @@ public void Can_apply_a_config_based_serializer_by_the_binding() var dummy2 = (DummyConfigurableSerializer) Sys.Serialization.GetSerializerById(-7); dummy2.Config.ShouldNotBe(null); - dummy2.Config.GetString("test-key", null).ShouldBe("test value"); + dummy2.Config.GetString("test-key").ShouldBe("test value"); } diff --git a/src/core/Akka.Tests/Util/SwitchTests.cs b/src/core/Akka.Tests/Util/SwitchTests.cs index 4862d2fdb45..c0d8974cb6a 100644 --- a/src/core/Akka.Tests/Util/SwitchTests.cs +++ b/src/core/Akka.Tests/Util/SwitchTests.cs @@ -18,7 +18,7 @@ public class SwitchTests : AkkaSpec [Fact] public void On_and_off() { - var s = new Switch(false); + var s = new Switch(); Assert.True(s.IsOff, "Initially should be off"); Assert.False(s.IsOn, "Initially should not be on"); @@ -50,7 +50,7 @@ public void Initially_on_should_be_on() [Fact] public void Given_OffSwitch_When_SwitchOn_throws_exception_Then_Should_revert() { - var s = new Switch(false); + var s = new Switch(); XAssert.Throws(() => s.SwitchOn(() => { throw new InvalidOperationException(); })); Assert.True(s.IsOff); Assert.False(s.IsOn); @@ -69,7 +69,7 @@ public void Given_OnSwitch_When_SwitchOff_throws_exception_Then_Should_revert() [Fact] public void Run_action_without_locking() { - var s = new Switch(false); + var s = new Switch(); var actionRun = false; Assert.True(s.IfOff(() => { actionRun = true; })); Assert.True(actionRun); @@ -91,7 +91,7 @@ public void Run_action_without_locking() [Fact] public void Run_action_with_locking() { - var s = new Switch(false); + var s = new Switch(); var actionRun = false; Assert.True(s.WhileOff(() => { actionRun = true; })); Assert.True(actionRun); diff --git a/src/core/Akka/Actor/ActorCell.FaultHandling.cs b/src/core/Akka/Actor/ActorCell.FaultHandling.cs index 6d5b504a336..ab38b9a81cc 100644 --- a/src/core/Akka/Actor/ActorCell.FaultHandling.cs +++ b/src/core/Akka/Actor/ActorCell.FaultHandling.cs @@ -147,7 +147,7 @@ private void FaultCreate() global::System.Diagnostics.Debug.Assert(Mailbox.IsSuspended(), "Mailbox must be suspended during failed creation, status=" + Mailbox.CurrentStatus()); global::System.Diagnostics.Debug.Assert(_self.Equals(Perpetrator), "Perpetrator should be self"); - SetReceiveTimeout(null); + SetReceiveTimeout(); CancelReceiveTimeout(); // stop all children, which will turn childrenRefs into TerminatingChildrenContainer (if there are children) @@ -180,7 +180,7 @@ private void FinishCreate() /// Terminates this instance. private void Terminate() { - SetReceiveTimeout(null); + SetReceiveTimeout(); CancelReceiveTimeout(); // prevent Deadletter(Terminated) messages diff --git a/src/core/Akka/Actor/ActorCell.cs b/src/core/Akka/Actor/ActorCell.cs index 14b3cae2513..0296f6c3198 100644 --- a/src/core/Akka/Actor/ActorCell.cs +++ b/src/core/Akka/Actor/ActorCell.cs @@ -203,7 +203,7 @@ public void Init(bool sendSupervise, MailboxType mailboxType) if (System.Mailboxes.ProducesMessageQueue(mailboxType.GetType()) && System.Mailboxes.HasRequiredType(actorClass)) { var req = System.Mailboxes.GetRequiredType(actorClass); - if (req.IsInstanceOfType(mailbox.MessageQueue)) createMessage = new Create(null); //success + if (req.IsInstanceOfType(mailbox.MessageQueue)) createMessage = new Create(); //success else { var gotType = mailbox.MessageQueue == null ? "null" : mailbox.MessageQueue.GetType().FullName; @@ -212,7 +212,7 @@ public void Init(bool sendSupervise, MailboxType mailboxType) } else { - createMessage = new Create(null); + createMessage = new Create(); } SwapMailbox(mailbox); diff --git a/src/core/Akka/Actor/CoordinatedShutdown.cs b/src/core/Akka/Actor/CoordinatedShutdown.cs index f3d4358e1c0..e149447cdd4 100644 --- a/src/core/Akka/Actor/CoordinatedShutdown.cs +++ b/src/core/Akka/Actor/CoordinatedShutdown.cs @@ -273,7 +273,7 @@ private ClusterJoinUnsuccessfulReason() { } private readonly ConcurrentSet>> _clrShutdownTasks = new ConcurrentSet>>(); private readonly ConcurrentDictionary>)>> _tasks = new ConcurrentDictionary>)>>(); private readonly AtomicReference _runStarted = new AtomicReference(null); - private readonly AtomicBoolean _clrHooksStarted = new AtomicBoolean(false); + private readonly AtomicBoolean _clrHooksStarted = new AtomicBoolean(); private readonly TaskCompletionSource _runPromise = new TaskCompletionSource(); private readonly TaskCompletionSource _hooksRunPromise = new TaskCompletionSource(); @@ -559,7 +559,7 @@ internal static Dictionary PhasesFromConfig(Config config) if (config.IsNullOrEmpty()) throw new ConfigurationException("Invalid phase configuration."); - var defaultPhaseTimeout = config.GetString("default-phase-timeout", null); + var defaultPhaseTimeout = config.GetString("default-phase-timeout"); var phasesConf = config.GetConfig("phases"); var defaultPhaseConfig = ConfigurationFactory.ParseString($"timeout = {defaultPhaseTimeout}" + @" recover = true @@ -570,8 +570,8 @@ internal static Dictionary PhasesFromConfig(Config config) { var c = phasesConf.GetConfig(v.Key).WithFallback(defaultPhaseConfig); var dependsOn = c.GetStringList("depends-on").ToImmutableHashSet(); - var timeout = c.GetTimeSpan("timeout", null, allowInfinite: false); - var recover = c.GetBoolean("recover", false); + var timeout = c.GetTimeSpan("timeout", allowInfinite: false); + var recover = c.GetBoolean("recover"); return new Phase(dependsOn, timeout, recover); }); } @@ -629,7 +629,7 @@ void DepthFirstSearch(string u) internal static void InitPhaseActorSystemTerminate(ActorSystem system, Config conf, CoordinatedShutdown coord) { var terminateActorSystem = system.Settings.CoordinatedShutdownTerminateActorSystem; - var exitClr = conf.GetBoolean("exit-clr", false); + var exitClr = conf.GetBoolean("exit-clr"); if (terminateActorSystem || exitClr) { coord.AddTask(PhaseActorSystemTerminate, "terminate-system", () => @@ -685,7 +685,7 @@ internal static void InitPhaseActorSystemTerminate(ActorSystem system, Config co /// The plugin instance. internal static void InitClrHook(ActorSystem system, Config conf, CoordinatedShutdown coord) { - var runByClrShutdownHook = conf.GetBoolean("run-by-clr-shutdown-hook", false); + var runByClrShutdownHook = conf.GetBoolean("run-by-clr-shutdown-hook"); if (runByClrShutdownHook) { var exitTask = TerminateOnClrExit(coord); diff --git a/src/core/Akka/Actor/Deployer.cs b/src/core/Akka/Actor/Deployer.cs index 442c39c1018..e4b55e96a88 100644 --- a/src/core/Akka/Actor/Deployer.cs +++ b/src/core/Akka/Actor/Deployer.cs @@ -136,7 +136,7 @@ private RouterConfig CreateRouterConfig(string routerTypeAlias, Config deploymen throw ConfigurationException.NullOrEmptyConfig(); var path = string.Format("akka.actor.router.type-mapping.{0}", routerTypeAlias); - var routerTypeName = _settings.Config.GetString(path, null); + var routerTypeName = _settings.Config.GetString(path); if(routerTypeName == null) { diff --git a/src/core/Akka/Actor/Inbox.cs b/src/core/Akka/Actor/Inbox.cs index 0b527218786..a848c5fbe6e 100644 --- a/src/core/Akka/Actor/Inbox.cs +++ b/src/core/Akka/Actor/Inbox.cs @@ -419,8 +419,8 @@ public static Inbox Create(ActorSystem system) if (config.IsNullOrEmpty()) throw ConfigurationException.NullOrEmptyConfig("akka.actor.inbox"); - var inboxSize = config.GetInt("inbox-size", 0); - var timeout = config.GetTimeSpan("default-timeout", null); + var inboxSize = config.GetInt("inbox-size"); + var timeout = config.GetTimeSpan("default-timeout"); var receiver = ((ActorSystemImpl)system).SystemActorOf(Props.Create(() => new InboxActor(inboxSize)), "inbox-" + Interlocked.Increment(ref _inboxNr)); diff --git a/src/core/Akka/Actor/Internal/ActorSystemImpl.cs b/src/core/Akka/Actor/Internal/ActorSystemImpl.cs index b05f38f2d25..077f67b6ce6 100644 --- a/src/core/Akka/Actor/Internal/ActorSystemImpl.cs +++ b/src/core/Akka/Actor/Internal/ActorSystemImpl.cs @@ -248,7 +248,7 @@ public void Start() private void WarnIfJsonIsDefaultSerializer() { const string configPath = "akka.suppress-json-serializer-warning"; - var showSerializerWarning = Settings.Config.HasPath(configPath) && !Settings.Config.GetBoolean(configPath, false); + var showSerializerWarning = Settings.Config.HasPath(configPath) && !Settings.Config.GetBoolean(configPath); if (showSerializerWarning && Serialization.FindSerializerForType(typeof (object)) is NewtonSoftJsonSerializer) diff --git a/src/core/Akka/Actor/RootGuardianSupervisor.cs b/src/core/Akka/Actor/RootGuardianSupervisor.cs index a8c703617e8..e642b5838e4 100644 --- a/src/core/Akka/Actor/RootGuardianSupervisor.cs +++ b/src/core/Akka/Actor/RootGuardianSupervisor.cs @@ -22,7 +22,7 @@ public class RootGuardianSupervisor : MinimalActorRef private readonly ILoggingAdapter _log; private readonly TaskCompletionSource _terminationPromise; private readonly ActorPath _path; - private readonly Switch _stopped = new Switch(false); + private readonly Switch _stopped = new Switch(); private readonly IActorRefProvider _provider; private bool IsWalking => !_terminationPromise.Task.IsCompleted; diff --git a/src/core/Akka/Actor/Scheduler/HashedWheelTimerScheduler.cs b/src/core/Akka/Actor/Scheduler/HashedWheelTimerScheduler.cs index 90c0d17be07..49732e8da01 100644 --- a/src/core/Akka/Actor/Scheduler/HashedWheelTimerScheduler.cs +++ b/src/core/Akka/Actor/Scheduler/HashedWheelTimerScheduler.cs @@ -48,8 +48,8 @@ public HashedWheelTimerScheduler(Config scheduler, ILoggingAdapter log) : base(s if (SchedulerConfig.IsNullOrEmpty()) throw ConfigurationException.NullOrEmptyConfig(); - var ticksPerWheel = SchedulerConfig.GetInt("akka.scheduler.ticks-per-wheel", 0); - var tickDuration = SchedulerConfig.GetTimeSpan("akka.scheduler.tick-duration", null); + var ticksPerWheel = SchedulerConfig.GetInt("akka.scheduler.ticks-per-wheel"); + var tickDuration = SchedulerConfig.GetTimeSpan("akka.scheduler.tick-duration"); if (tickDuration.TotalMilliseconds < 10.0d) throw new ArgumentOutOfRangeException("minimum supported akka.scheduler.tick-duration on Windows is 10ms"); @@ -65,7 +65,7 @@ public HashedWheelTimerScheduler(Config scheduler, ILoggingAdapter log) : base(s throw new ArgumentOutOfRangeException("akka.scheduler.tick-duration", _tickDuration, $"akka.scheduler.tick-duration: {_tickDuration} (expected: 0 < tick-duration in ticks < {long.MaxValue / _wheel.Length}"); - _shutdownTimeout = SchedulerConfig.GetTimeSpan("akka.scheduler.shutdown-timeout", null); + _shutdownTimeout = SchedulerConfig.GetTimeSpan("akka.scheduler.shutdown-timeout"); } private long _startTime = 0; diff --git a/src/core/Akka/Actor/Settings.cs b/src/core/Akka/Actor/Settings.cs index d6a4c2818a4..340c2a2dfb2 100644 --- a/src/core/Akka/Actor/Settings.cs +++ b/src/core/Akka/Actor/Settings.cs @@ -85,11 +85,11 @@ public Settings(ActorSystem system, Config config, ActorSystemSetup setup) var providerSelectionSetup = Setup.Get() .FlatSelect(_ => _.ActorRefProvider) .Select(_ => _.Fqn) - .GetOrElse(Config.GetString("akka.actor.provider", null)); + .GetOrElse(Config.GetString("akka.actor.provider")); ProviderSelectionType = ProviderSelection.GetProvider(providerSelectionSetup); - ConfigVersion = Config.GetString("akka.version", null); + ConfigVersion = Config.GetString("akka.version"); ProviderClass = ProviderSelectionType.Fqn; HasCluster = ProviderSelectionType.HasCluster; @@ -99,20 +99,20 @@ public Settings(ActorSystem system, Config config, ActorSystemSetup setup) if (!typeof(IActorRefProvider).IsAssignableFrom(providerType)) throw new ConfigurationException($"'akka.actor.provider' is not a valid actor ref provider: '{ProviderClass}'"); - SupervisorStrategyClass = Config.GetString("akka.actor.guardian-supervisor-strategy", null); + SupervisorStrategyClass = Config.GetString("akka.actor.guardian-supervisor-strategy"); - AskTimeout = Config.GetTimeSpan("akka.actor.ask-timeout", null, allowInfinite: true); - CreationTimeout = Config.GetTimeSpan("akka.actor.creation-timeout", null); - UnstartedPushTimeout = Config.GetTimeSpan("akka.actor.unstarted-push-timeout", null); + AskTimeout = Config.GetTimeSpan("akka.actor.ask-timeout"); + CreationTimeout = Config.GetTimeSpan("akka.actor.creation-timeout"); + UnstartedPushTimeout = Config.GetTimeSpan("akka.actor.unstarted-push-timeout"); - SerializeAllMessages = Config.GetBoolean("akka.actor.serialize-messages", false); - SerializeAllCreators = Config.GetBoolean("akka.actor.serialize-creators", false); - EmitActorTelemetry = Config.GetBoolean("akka.actor.telemetry.enabled", false); + SerializeAllMessages = Config.GetBoolean("akka.actor.serialize-messages"); + SerializeAllCreators = Config.GetBoolean("akka.actor.serialize-creators"); + EmitActorTelemetry = Config.GetBoolean("akka.actor.telemetry.enabled"); - LogLevel = Config.GetString("akka.loglevel", null); - StdoutLogLevel = Config.GetString("akka.stdout-loglevel", null); + LogLevel = Config.GetString("akka.loglevel"); + StdoutLogLevel = Config.GetString("akka.stdout-loglevel"); - var stdoutClassName = Config.GetString("akka.stdout-logger-class", null); + var stdoutClassName = Config.GetString("akka.stdout-logger-class"); if (string.IsNullOrWhiteSpace(stdoutClassName)) { StdoutLogger = new StandardOutLogger(); @@ -137,11 +137,11 @@ public Settings(ActorSystem system, Config config, ActorSystemSetup setup) } Loggers = Config.GetStringList("akka.loggers", new string[] { }); - LoggersDispatcher = Config.GetString("akka.loggers-dispatcher", null); - LoggerStartTimeout = Config.GetTimeSpan("akka.logger-startup-timeout", null); - LoggerAsyncStart = Config.GetBoolean("akka.logger-async-start", false); + LoggersDispatcher = Config.GetString("akka.loggers-dispatcher"); + LoggerStartTimeout = Config.GetTimeSpan("akka.logger-startup-timeout"); + LoggerAsyncStart = Config.GetBoolean("akka.logger-async-start"); - var loggerFormatterName = Config.GetString("akka.logger-formatter", null); + var loggerFormatterName = Config.GetString("akka.logger-formatter"); if (string.IsNullOrWhiteSpace(loggerFormatterName)) { LogFormatter = DefaultLogMessageFormatter.Instance; @@ -174,10 +174,10 @@ public Settings(ActorSystem system, Config config, ActorSystemSetup setup) } //handled - LogConfigOnStart = Config.GetBoolean("akka.log-config-on-start", false); + LogConfigOnStart = Config.GetBoolean("akka.log-config-on-start"); LogSerializerOverrideOnStart = Config.GetBoolean("akka.log-serializer-override-on-start", true); LogDeadLetters = 0; - switch (Config.GetString("akka.log-dead-letters", null)) + switch (Config.GetString("akka.log-dead-letters")) { case "on": case "true": @@ -190,26 +190,26 @@ public Settings(ActorSystem system, Config config, ActorSystemSetup setup) LogDeadLetters = 0; break; default: - LogDeadLetters = Config.GetInt("akka.log-dead-letters", 0); + LogDeadLetters = Config.GetInt("akka.log-dead-letters"); break; } - LogDeadLettersDuringShutdown = Config.GetBoolean("akka.log-dead-letters-during-shutdown", false); + LogDeadLettersDuringShutdown = Config.GetBoolean("akka.log-dead-letters-during-shutdown"); const string key = "akka.log-dead-letters-suspend-duration"; - LogDeadLettersSuspendDuration = Config.GetString(key, null) == "infinite" ? Timeout.InfiniteTimeSpan : Config.GetTimeSpan(key); - - AddLoggingReceive = Config.GetBoolean("akka.actor.debug.receive", false); - DebugAutoReceive = Config.GetBoolean("akka.actor.debug.autoreceive", false); - DebugLifecycle = Config.GetBoolean("akka.actor.debug.lifecycle", false); - FsmDebugEvent = Config.GetBoolean("akka.actor.debug.fsm", false); - DebugEventStream = Config.GetBoolean("akka.actor.debug.event-stream", false); - DebugUnhandledMessage = Config.GetBoolean("akka.actor.debug.unhandled", false); - DebugRouterMisconfiguration = Config.GetBoolean("akka.actor.debug.router-misconfiguration", false); + LogDeadLettersSuspendDuration = Config.GetString(key) == "infinite" ? Timeout.InfiniteTimeSpan : Config.GetTimeSpan(key); + + AddLoggingReceive = Config.GetBoolean("akka.actor.debug.receive"); + DebugAutoReceive = Config.GetBoolean("akka.actor.debug.autoreceive"); + DebugLifecycle = Config.GetBoolean("akka.actor.debug.lifecycle"); + FsmDebugEvent = Config.GetBoolean("akka.actor.debug.fsm"); + DebugEventStream = Config.GetBoolean("akka.actor.debug.event-stream"); + DebugUnhandledMessage = Config.GetBoolean("akka.actor.debug.unhandled"); + DebugRouterMisconfiguration = Config.GetBoolean("akka.actor.debug.router-misconfiguration"); Home = Config.GetString("akka.home", ""); - DefaultVirtualNodesFactor = Config.GetInt("akka.actor.deployment.default.virtual-nodes-factor", 0); + DefaultVirtualNodesFactor = Config.GetInt("akka.actor.deployment.default.virtual-nodes-factor"); - SchedulerClass = Config.GetString("akka.scheduler.implementation", null); - SchedulerShutdownTimeout = Config.GetTimeSpan("akka.scheduler.shutdown-timeout", null); + SchedulerClass = Config.GetString("akka.scheduler.implementation"); + SchedulerShutdownTimeout = Config.GetTimeSpan("akka.scheduler.shutdown-timeout"); CoordinatedShutdownTerminateActorSystem = Config.GetBoolean("akka.coordinated-shutdown.terminate-actor-system"); CoordinatedShutdownRunByActorSystemTerminate = Config.GetBoolean("akka.coordinated-shutdown.run-by-actor-system-terminate"); diff --git a/src/core/Akka/Actor/SupervisorStrategy.cs b/src/core/Akka/Actor/SupervisorStrategy.cs index 3e045152954..633e5b563c1 100644 --- a/src/core/Akka/Actor/SupervisorStrategy.cs +++ b/src/core/Akka/Actor/SupervisorStrategy.cs @@ -314,7 +314,7 @@ public OneForOneStrategy(int maxNrOfRetries, int withinTimeMilliseconds, IDecide /// /// mapping from Exception to public OneForOneStrategy(Func localOnlyDecider) - : this(-1, -1, localOnlyDecider, true) + : this(-1, -1, localOnlyDecider) { } @@ -333,7 +333,7 @@ public OneForOneStrategy(Func localOnlyDecider, bool loggi /// /// TBD public OneForOneStrategy(IDecider decider) - : this(-1, -1, decider, true) + : this(-1, -1, decider) { } @@ -581,7 +581,7 @@ public AllForOneStrategy(int maxNrOfRetries, int withinTimeMilliseconds, IDecide /// /// The mapping used to translate an to a . public AllForOneStrategy(Func localOnlyDecider) - : this(-1, -1, localOnlyDecider, true) + : this(-1, -1, localOnlyDecider) { } @@ -590,7 +590,7 @@ public AllForOneStrategy(Func localOnlyDecider) /// /// The mapping used to translate an to a . public AllForOneStrategy(IDecider decider) - : this(-1, -1, decider, true) + : this(-1, -1, decider) { //Intentionally left blank } diff --git a/src/core/Akka/Dispatch/AbstractDispatcher.cs b/src/core/Akka/Dispatch/AbstractDispatcher.cs index 48eb0426e27..58b068cee0e 100644 --- a/src/core/Akka/Dispatch/AbstractDispatcher.cs +++ b/src/core/Akka/Dispatch/AbstractDispatcher.cs @@ -323,7 +323,7 @@ protected MessageDispatcherConfigurator(Config config, IDispatcherPrerequisites /// The requested instance. protected ExecutorServiceConfigurator ConfigureExecutor() { - var executor = Config.GetString("executor", null); + var executor = Config.GetString("executor"); switch (executor) { case null: diff --git a/src/core/Akka/Dispatch/CurrentSynchronizationContextDispatcher.cs b/src/core/Akka/Dispatch/CurrentSynchronizationContextDispatcher.cs index e540c8c7724..e712f27f6bc 100644 --- a/src/core/Akka/Dispatch/CurrentSynchronizationContextDispatcher.cs +++ b/src/core/Akka/Dispatch/CurrentSynchronizationContextDispatcher.cs @@ -79,11 +79,11 @@ public override MessageDispatcher Dispatcher() if (Config.IsNullOrEmpty()) throw ConfigurationException.NullOrEmptyConfig(); - return new CurrentSynchronizationContextDispatcher(this, Config.GetString("id", null), - Config.GetInt("throughput", 0), - Config.GetTimeSpan("throughput-deadline-time", null).Ticks, + return new CurrentSynchronizationContextDispatcher(this, Config.GetString("id"), + Config.GetInt("throughput"), + Config.GetTimeSpan("throughput-deadline-time").Ticks, _executorServiceConfigurator, - Config.GetTimeSpan("shutdown-timeout", null)); + Config.GetTimeSpan("shutdown-timeout")); } } diff --git a/src/core/Akka/Dispatch/Dispatchers.cs b/src/core/Akka/Dispatch/Dispatchers.cs index bcf409e923e..461d3959a89 100644 --- a/src/core/Akka/Dispatch/Dispatchers.cs +++ b/src/core/Akka/Dispatch/Dispatchers.cs @@ -576,8 +576,8 @@ private MessageDispatcherConfigurator ConfiguratorFrom(Config cfg) if (!cfg.HasPath("id")) throw new ConfigurationException($"Missing dispatcher `id` property in config: {cfg.Root}"); - var id = cfg.GetString("id", null); - var type = cfg.GetString("type", null); + var id = cfg.GetString("id"); + var type = cfg.GetString("type"); MessageDispatcherConfigurator dispatcher; @@ -637,7 +637,7 @@ public DispatcherConfigurator(Config config, IDispatcherPrerequisites prerequisi : base(config, prerequisites) { // Need to see if a non-zero value is available for this setting - TimeSpan deadlineTime = Config.GetTimeSpan("throughput-deadline-time", null); + TimeSpan deadlineTime = Config.GetTimeSpan("throughput-deadline-time"); long? deadlineTimeTicks = null; if (deadlineTime.Ticks > 0) deadlineTimeTicks = deadlineTime.Ticks; diff --git a/src/core/Akka/Dispatch/Mailbox.cs b/src/core/Akka/Dispatch/Mailbox.cs index 4a4efef5083..cf4e5f263e4 100644 --- a/src/core/Akka/Dispatch/Mailbox.cs +++ b/src/core/Akka/Dispatch/Mailbox.cs @@ -696,7 +696,7 @@ public BoundedMailbox(Settings settings, Config config) if (config.IsNullOrEmpty()) throw ConfigurationException.NullOrEmptyConfig(); - Capacity = config.GetInt("mailbox-capacity", 0); + Capacity = config.GetInt("mailbox-capacity"); PushTimeout = config.GetTimeSpan("mailbox-push-timeout-time", TimeSpan.FromSeconds(-1)); if (Capacity < 0) @@ -835,7 +835,7 @@ public BoundedDequeBasedMailbox(Settings settings, Config config) if (config.IsNullOrEmpty()) throw ConfigurationException.NullOrEmptyConfig(); - Capacity = config.GetInt("mailbox-capacity", 0); + Capacity = config.GetInt("mailbox-capacity"); PushTimeout = config.GetTimeSpan("mailbox-push-timeout-time", TimeSpan.FromSeconds(-1)); if (Capacity < 0) diff --git a/src/core/Akka/Dispatch/Mailboxes.cs b/src/core/Akka/Dispatch/Mailboxes.cs index 49f2b6606e6..dc307302890 100644 --- a/src/core/Akka/Dispatch/Mailboxes.cs +++ b/src/core/Akka/Dispatch/Mailboxes.cs @@ -170,7 +170,7 @@ private MailboxType LookupConfigurator(string id) if (!Settings.Config.HasPath(id)) throw new ConfigurationException($"Mailbox Type [{id}] not configured"); var conf = Config(id); - var mailboxTypeName = conf.GetString("mailbox-type", null); + var mailboxTypeName = conf.GetString("mailbox-type"); if (string.IsNullOrEmpty(mailboxTypeName)) throw new ConfigurationException($"The setting mailbox-type defined in [{id}] is empty"); var mailboxType = Type.GetType(mailboxTypeName) @@ -260,7 +260,7 @@ private Type GetProducedMessageQueueType(MailboxType mailboxType) private Type GetMailboxRequirement(Config config) { - var mailboxRequirement = config.GetString("mailbox-requirement", null); + var mailboxRequirement = config.GetString("mailbox-requirement"); return mailboxRequirement == null || mailboxRequirement.Equals(NoMailboxRequirement) ? typeof (IMessageQueue) : Type.GetType(mailboxRequirement, true); } @@ -277,7 +277,7 @@ public MailboxType GetMailboxType(Props props, Config dispatcherConfig) { if (dispatcherConfig == null) dispatcherConfig = ConfigurationFactory.Empty; - var id = dispatcherConfig.GetString("id", null); + var id = dispatcherConfig.GetString("id"); var deploy = props.Deploy; var actorType = props.Type; var actorRequirement = new Lazy(() => GetRequiredType(actorType)); @@ -286,7 +286,7 @@ public MailboxType GetMailboxType(Props props, Config dispatcherConfig) var hasMailboxRequirement = mailboxRequirement != typeof(IMessageQueue); var hasMailboxType = dispatcherConfig.HasPath("mailbox-type") && - dispatcherConfig.GetString("mailbox-type", null) != Deploy.NoMailboxGiven; + dispatcherConfig.GetString("mailbox-type") != Deploy.NoMailboxGiven; if (!hasMailboxType && !_mailboxSizeWarningIssued && dispatcherConfig.HasPath("mailbox-size")) { @@ -307,7 +307,7 @@ MailboxType VerifyRequirements(MailboxType mailboxType) if (!deploy.Mailbox.Equals(Deploy.NoMailboxGiven)) return VerifyRequirements(Lookup(deploy.Mailbox)); if (!deploy.Dispatcher.Equals(Deploy.NoDispatcherGiven) && hasMailboxType) - return VerifyRequirements(Lookup(dispatcherConfig.GetString("id", null))); + return VerifyRequirements(Lookup(dispatcherConfig.GetString("id"))); if (actorRequirement.Value != null) { try diff --git a/src/core/Akka/Dispatch/MessageQueues/BoundedMessageQueue.cs b/src/core/Akka/Dispatch/MessageQueues/BoundedMessageQueue.cs index 928f76b1265..baf3c7d2512 100644 --- a/src/core/Akka/Dispatch/MessageQueues/BoundedMessageQueue.cs +++ b/src/core/Akka/Dispatch/MessageQueues/BoundedMessageQueue.cs @@ -25,7 +25,7 @@ public class BoundedMessageQueue : IMessageQueue, IBoundedMessageQueueSemantics /// /// The configuration for this mailbox. public BoundedMessageQueue(Config config) - : this(config.GetInt("mailbox-capacity", 0), config.GetTimeSpan("mailbox-push-timeout-time", null)) + : this(config.GetInt("mailbox-capacity"), config.GetTimeSpan("mailbox-push-timeout-time")) { } diff --git a/src/core/Akka/Dispatch/PinnedDispatcher.cs b/src/core/Akka/Dispatch/PinnedDispatcher.cs index fa6393b014b..743c39227cf 100644 --- a/src/core/Akka/Dispatch/PinnedDispatcher.cs +++ b/src/core/Akka/Dispatch/PinnedDispatcher.cs @@ -34,7 +34,7 @@ public PinnedDispatcherConfigurator(Config config, IDispatcherPrerequisites prer { _executorServiceConfigurator = new ForkJoinExecutorServiceFactory( - ForkJoinExecutorServiceFactory.SingleThreadDefault.WithFallback("id=" + config.GetString("id", null)), Prerequisites); + ForkJoinExecutorServiceFactory.SingleThreadDefault.WithFallback("id=" + config.GetString("id")), Prerequisites); // We don't bother trying to support any other type of executor here. PinnedDispatcher doesn't support them } @@ -47,11 +47,11 @@ public override MessageDispatcher Dispatcher() if (Config.IsNullOrEmpty()) throw ConfigurationException.NullOrEmptyConfig(); - return new PinnedDispatcher(this, Config.GetString("id", null), - Config.GetInt("throughput", 0), - Config.GetTimeSpan("throughput-deadline-time", null).Ticks, + return new PinnedDispatcher(this, Config.GetString("id"), + Config.GetInt("throughput"), + Config.GetTimeSpan("throughput-deadline-time").Ticks, _executorServiceConfigurator, - Config.GetTimeSpan("shutdown-timeout", null)); + Config.GetTimeSpan("shutdown-timeout")); } } diff --git a/src/core/Akka/Dispatch/ThreadPoolBuilder.cs b/src/core/Akka/Dispatch/ThreadPoolBuilder.cs index ea9cab7d8d4..9150d1ce676 100644 --- a/src/core/Akka/Dispatch/ThreadPoolBuilder.cs +++ b/src/core/Akka/Dispatch/ThreadPoolBuilder.cs @@ -70,7 +70,7 @@ public ThreadPoolConfig(Config config) /// public int PoolSizeMin { - get { return _config.GetInt("pool-size-min", 0); } + get { return _config.GetInt("pool-size-min"); } } /// @@ -78,7 +78,7 @@ public int PoolSizeMin /// public double PoolSizeFactor { - get { return _config.GetDouble("pool-size-factor", 0); } + get { return _config.GetDouble("pool-size-factor"); } } /// @@ -86,7 +86,7 @@ public double PoolSizeFactor /// public int PoolSizeMax { - get { return _config.GetInt("pool-size-max", 0); } + get { return _config.GetInt("pool-size-max"); } } #region Static methods diff --git a/src/core/Akka/IO/Dns.cs b/src/core/Akka/IO/Dns.cs index d85250861eb..5e937f2a023 100644 --- a/src/core/Akka/IO/Dns.cs +++ b/src/core/Akka/IO/Dns.cs @@ -223,10 +223,10 @@ public DnsSettings(Config config) if (config.IsNullOrEmpty()) throw ConfigurationException.NullOrEmptyConfig(); - Dispatcher = config.GetString("dispatcher", null); - Resolver = config.GetString("resolver", null); + Dispatcher = config.GetString("dispatcher"); + Resolver = config.GetString("resolver"); ResolverConfig = config.GetConfig(Resolver); - ProviderObjectName = ResolverConfig.GetString("provider-object", null); + ProviderObjectName = ResolverConfig.GetString("provider-object"); } /// diff --git a/src/core/Akka/IO/InetAddressDnsResolver.cs b/src/core/Akka/IO/InetAddressDnsResolver.cs index 2e1b8a64da3..01ad5761d4d 100644 --- a/src/core/Akka/IO/InetAddressDnsResolver.cs +++ b/src/core/Akka/IO/InetAddressDnsResolver.cs @@ -33,9 +33,9 @@ public class InetAddressDnsResolver : ActorBase public InetAddressDnsResolver(SimpleDnsCache cache, Config config) { _cache = cache; - _positiveTtl = (long) config.GetTimeSpan("positive-ttl", null).TotalMilliseconds; - _negativeTtl = (long) config.GetTimeSpan("negative-ttl", null).TotalMilliseconds; - _useIpv6 = config.GetBoolean( "use-ipv6" , false); + _positiveTtl = (long) config.GetTimeSpan("positive-ttl").TotalMilliseconds; + _negativeTtl = (long) config.GetTimeSpan("negative-ttl").TotalMilliseconds; + _useIpv6 = config.GetBoolean( "use-ipv6"); } /// diff --git a/src/core/Akka/IO/SimpleDnsManager.cs b/src/core/Akka/IO/SimpleDnsManager.cs index dd878970dbf..68677da6ebf 100644 --- a/src/core/Akka/IO/SimpleDnsManager.cs +++ b/src/core/Akka/IO/SimpleDnsManager.cs @@ -37,7 +37,7 @@ public SimpleDnsManager(DnsExt ext) if (_cacheCleanup != null) { - var interval = ext.Settings.ResolverConfig.GetTimeSpan("cache-cleanup-interval", null); + var interval = ext.Settings.ResolverConfig.GetTimeSpan("cache-cleanup-interval"); _cleanupTimer = Context.System.Scheduler.ScheduleTellRepeatedlyCancelable(interval, interval, Self, CacheCleanup.Instance, Self); } } diff --git a/src/core/Akka/IO/Tcp.cs b/src/core/Akka/IO/Tcp.cs index 43a6c4693d3..f05918e2779 100644 --- a/src/core/Akka/IO/Tcp.cs +++ b/src/core/Akka/IO/Tcp.cs @@ -1107,7 +1107,7 @@ private IBufferPool CreateBufferPool(ExtendedActorSystem system, Config config) if (config.IsNullOrEmpty()) throw ConfigurationException.NullOrEmptyConfig(); - var type = Type.GetType(config.GetString("class", null), true); + var type = Type.GetType(config.GetString("class"), true); if (!typeof(IBufferPool).IsAssignableFrom(type)) throw new ArgumentException($"Buffer pool of type {type} doesn't implement {nameof(IBufferPool)} interface"); diff --git a/src/core/Akka/IO/TcpSettings.cs b/src/core/Akka/IO/TcpSettings.cs index 3cb1df011f8..9c76ce6c91f 100644 --- a/src/core/Akka/IO/TcpSettings.cs +++ b/src/core/Akka/IO/TcpSettings.cs @@ -43,19 +43,19 @@ public static TcpSettings Create(Config config) return new TcpSettings( bufferPoolConfigPath: config.GetString("buffer-pool", "akka.io.tcp.disabled-buffer-pool"), initialSocketAsyncEventArgs: config.GetInt("nr-of-socket-async-event-args", 32), - traceLogging: config.GetBoolean("trace-logging", false), + traceLogging: config.GetBoolean("trace-logging"), batchAcceptLimit: config.GetInt("batch-accept-limit", 10), registerTimeout: config.GetTimeSpan("register-timeout", TimeSpan.FromSeconds(5)), receivedMessageSizeLimit: config.GetString("max-received-message-size", "unlimited") == "unlimited" ? int.MaxValue - : config.GetInt("max-received-message-size", 0), + : config.GetInt("max-received-message-size"), managementDispatcher: config.GetString("management-dispatcher", "akka.actor.default-dispatcher"), fileIoDispatcher: config.GetString("file-io-dispatcher", "akka.actor.default-dispatcher"), - transferToLimit: config.GetString("file-io-transferTo-limit", null) == "unlimited" + transferToLimit: config.GetString("file-io-transferTo-limit") == "unlimited" ? int.MaxValue : config.GetInt("file-io-transferTo-limit", 512 * 1024), finishConnectRetries: config.GetInt("finish-connect-retries", 5), - outgoingSocketForceIpv4: config.GetBoolean("outgoing-socket-force-ipv4", false), + outgoingSocketForceIpv4: config.GetBoolean("outgoing-socket-force-ipv4"), writeCommandsQueueMaxSize: config.GetInt("write-commands-queue-max-size", -1)); } diff --git a/src/core/Akka/IO/Udp.cs b/src/core/Akka/IO/Udp.cs index 5ed2290bf82..0ab8a77c83c 100644 --- a/src/core/Akka/IO/Udp.cs +++ b/src/core/Akka/IO/Udp.cs @@ -532,7 +532,7 @@ private static IBufferPool CreateBufferPool(ExtendedActorSystem system, Config c if (config.IsNullOrEmpty()) throw ConfigurationException.NullOrEmptyConfig(); - var type = Type.GetType(config.GetString("class", null), true); + var type = Type.GetType(config.GetString("class"), true); if (!typeof(IBufferPool).IsAssignableFrom(type)) throw new ArgumentException($"Buffer pool of type {type} doesn't implement {nameof(IBufferPool)} interface"); diff --git a/src/core/Akka/IO/UdpConnected.cs b/src/core/Akka/IO/UdpConnected.cs index f4da78d8391..e6f78cc489b 100644 --- a/src/core/Akka/IO/UdpConnected.cs +++ b/src/core/Akka/IO/UdpConnected.cs @@ -417,7 +417,7 @@ private static IBufferPool CreateBufferPool(ExtendedActorSystem system, Config c if (config.IsNullOrEmpty()) throw ConfigurationException.NullOrEmptyConfig(); - var type = Type.GetType(config.GetString("class", null), true); + var type = Type.GetType(config.GetString("class"), true); if (!typeof(IBufferPool).IsAssignableFrom(type)) throw new ArgumentException($"Buffer pool of type {type} doesn't implement {nameof(IBufferPool)} interface"); diff --git a/src/core/Akka/IO/UdpSettings.cs b/src/core/Akka/IO/UdpSettings.cs index 21389c6c67c..88a79aeac76 100644 --- a/src/core/Akka/IO/UdpSettings.cs +++ b/src/core/Akka/IO/UdpSettings.cs @@ -38,10 +38,10 @@ public static UdpSettings Create(Config config) throw ConfigurationException.NullOrEmptyConfig(); return new UdpSettings( - bufferPoolConfigPath: config.GetString("buffer-pool", null), - traceLogging: config.GetBoolean("trace-logging", false), + bufferPoolConfigPath: config.GetString("buffer-pool"), + traceLogging: config.GetBoolean("trace-logging"), initialSocketAsyncEventArgs: config.GetInt("nr-of-socket-async-event-args", 32), - batchReceiveLimit: config.GetInt("receive-throughput", 0), + batchReceiveLimit: config.GetInt("receive-throughput"), managementDispatcher: config.GetString("management-dispatcher", "akka.actor.default-dispatcher"), fileIoDispatcher: config.GetString("file-io-dispatcher", "akka.actor.default-dispatcher")); } diff --git a/src/core/Akka/Routing/Broadcast.cs b/src/core/Akka/Routing/Broadcast.cs index 45cf8658a1b..6b3736f84f8 100644 --- a/src/core/Akka/Routing/Broadcast.cs +++ b/src/core/Akka/Routing/Broadcast.cs @@ -51,8 +51,7 @@ public BroadcastPool(int nrOfInstances) : this( nrOfInstances, null, Pool.DefaultSupervisorStrategy, - Dispatchers.DefaultDispatcherId, - false) { } + Dispatchers.DefaultDispatcherId) { } // TODO: do we need to check for null or empty config here? /// @@ -61,7 +60,7 @@ public BroadcastPool(int nrOfInstances) : this( /// The configuration used to configure the pool. public BroadcastPool(Config config) : this( - nrOfInstances: config.GetInt("nr-of-instances", 0), + nrOfInstances: config.GetInt("nr-of-instances"), resizer: Resizer.FromConfig(config), supervisorStrategy: Pool.DefaultSupervisorStrategy, routerDispatcher: Dispatchers.DefaultDispatcherId, diff --git a/src/core/Akka/Routing/ConsistentHashRouter.cs b/src/core/Akka/Routing/ConsistentHashRouter.cs index d7ddd86e4ae..bd57b80311d 100644 --- a/src/core/Akka/Routing/ConsistentHashRouter.cs +++ b/src/core/Akka/Routing/ConsistentHashRouter.cs @@ -333,8 +333,7 @@ public ConsistentHashingPool(int nrOfInstances) : this( nrOfInstances, null, Pool.DefaultSupervisorStrategy, - Dispatchers.DefaultDispatcherId, - false) { } + Dispatchers.DefaultDispatcherId) { } // TODO: do we need to check for null or empty config here? /// @@ -347,13 +346,13 @@ public ConsistentHashingPool(int nrOfInstances) : this( /// The configuration used to configure the pool. public ConsistentHashingPool(Config config) : this( - nrOfInstances: config.GetInt("nr-of-instances", 0), + nrOfInstances: config.GetInt("nr-of-instances"), resizer: Resizer.FromConfig(config), supervisorStrategy: Pool.DefaultSupervisorStrategy, routerDispatcher: Dispatchers.DefaultDispatcherId, usePoolDispatcher: config.HasPath("pool-dispatcher")) { - VirtualNodesFactor = config.GetInt("virtual-nodes-factor", 0); + VirtualNodesFactor = config.GetInt("virtual-nodes-factor"); } /// @@ -622,7 +621,7 @@ public sealed class ConsistentHashingGroup : Group public ConsistentHashingGroup(Config config) : this(config.GetStringList("routees.paths", new string[] { })) { - VirtualNodesFactor = config.GetInt("virtual-nodes-factor", 0); + VirtualNodesFactor = config.GetInt("virtual-nodes-factor"); } /// diff --git a/src/core/Akka/Routing/Random.cs b/src/core/Akka/Routing/Random.cs index 9c7766d34b2..e210df86cc3 100644 --- a/src/core/Akka/Routing/Random.cs +++ b/src/core/Akka/Routing/Random.cs @@ -46,7 +46,7 @@ public sealed class RandomPool : Pool /// The configuration used to configure the pool. public RandomPool(Config config) : this( - nrOfInstances: config.GetInt("nr-of-instances", 0), + nrOfInstances: config.GetInt("nr-of-instances"), resizer: Resizer.FromConfig(config), supervisorStrategy: Pool.DefaultSupervisorStrategy, routerDispatcher: Dispatchers.DefaultDispatcherId, diff --git a/src/core/Akka/Routing/Resizer.cs b/src/core/Akka/Routing/Resizer.cs index 7ce746d9629..d0ea1a8b735 100644 --- a/src/core/Akka/Routing/Resizer.cs +++ b/src/core/Akka/Routing/Resizer.cs @@ -56,7 +56,7 @@ public static Resizer FromConfig(Config parentConfig) { var defaultResizerConfig = parentConfig.GetConfig("resizer"); - if (!defaultResizerConfig.IsNullOrEmpty() && defaultResizerConfig.GetBoolean("enabled", false)) + if (!defaultResizerConfig.IsNullOrEmpty() && defaultResizerConfig.GetBoolean("enabled")) { return DefaultResizer.Apply(defaultResizerConfig); } @@ -134,7 +134,7 @@ public DefaultResizer( /// TBD public new static DefaultResizer FromConfig(Config resizerConfig) { - return resizerConfig.GetBoolean("resizer.enabled", false) ? DefaultResizer.Apply(resizerConfig.GetConfig("resizer")) : null; + return resizerConfig.GetBoolean("resizer.enabled") ? DefaultResizer.Apply(resizerConfig.GetConfig("resizer")) : null; } /// @@ -148,13 +148,13 @@ internal static DefaultResizer Apply(Config resizerConfig) throw ConfigurationException.NullOrEmptyConfig(); return new DefaultResizer( - resizerConfig.GetInt("lower-bound", 0), - resizerConfig.GetInt("upper-bound", 0), - resizerConfig.GetInt("pressure-threshold", 0), - resizerConfig.GetDouble("rampup-rate", 0), - resizerConfig.GetDouble("backoff-threshold", 0), - resizerConfig.GetDouble("backoff-rate", 0), - resizerConfig.GetInt("messages-per-resize", 0) + resizerConfig.GetInt("lower-bound"), + resizerConfig.GetInt("upper-bound"), + resizerConfig.GetInt("pressure-threshold"), + resizerConfig.GetDouble("rampup-rate"), + resizerConfig.GetDouble("backoff-threshold"), + resizerConfig.GetDouble("backoff-rate"), + resizerConfig.GetInt("messages-per-resize") ); } diff --git a/src/core/Akka/Routing/RoundRobin.cs b/src/core/Akka/Routing/RoundRobin.cs index 09a3c49861b..0122227b596 100644 --- a/src/core/Akka/Routing/RoundRobin.cs +++ b/src/core/Akka/Routing/RoundRobin.cs @@ -79,7 +79,7 @@ public sealed class RoundRobinPool : Pool /// The configuration used to configure the pool. public RoundRobinPool(Config config) : this( - nrOfInstances: config.GetInt("nr-of-instances", 0), + nrOfInstances: config.GetInt("nr-of-instances"), resizer: Resizer.FromConfig(config), supervisorStrategy: Pool.DefaultSupervisorStrategy, routerDispatcher: Dispatchers.DefaultDispatcherId, diff --git a/src/core/Akka/Routing/ScatterGatherFirstCompleted.cs b/src/core/Akka/Routing/ScatterGatherFirstCompleted.cs index b1b62c09339..fcaaf46b36a 100644 --- a/src/core/Akka/Routing/ScatterGatherFirstCompleted.cs +++ b/src/core/Akka/Routing/ScatterGatherFirstCompleted.cs @@ -125,9 +125,9 @@ public sealed class ScatterGatherFirstCompletedPool : Pool /// public ScatterGatherFirstCompletedPool(Config config) : this( - nrOfInstances: config.GetInt("nr-of-instances", 0), + nrOfInstances: config.GetInt("nr-of-instances"), resizer: Resizer.FromConfig(config), - within: config.GetTimeSpan("within", null), + within: config.GetTimeSpan("within"), supervisorStrategy: Pool.DefaultSupervisorStrategy, routerDispatcher: Dispatchers.DefaultDispatcherId, usePoolDispatcher: config.HasPath("pool-dispatcher")) @@ -367,7 +367,7 @@ public sealed class ScatterGatherFirstCompletedGroup : Group public ScatterGatherFirstCompletedGroup(Config config) : this( config.GetStringList("routees.paths", new string[] { }), - config.GetTimeSpan("within", null), + config.GetTimeSpan("within"), Dispatchers.DefaultDispatcherId) { } diff --git a/src/core/Akka/Routing/SmallestMailbox.cs b/src/core/Akka/Routing/SmallestMailbox.cs index 8d91bbb5247..72ce8693f16 100644 --- a/src/core/Akka/Routing/SmallestMailbox.cs +++ b/src/core/Akka/Routing/SmallestMailbox.cs @@ -115,7 +115,7 @@ public sealed class SmallestMailboxPool : Pool /// The configuration used to configure the pool. public SmallestMailboxPool(Config config) : this( - nrOfInstances: config.GetInt("nr-of-instances", 0), + nrOfInstances: config.GetInt("nr-of-instances"), resizer: Resizer.FromConfig(config), supervisorStrategy: Pool.DefaultSupervisorStrategy, routerDispatcher: Dispatchers.DefaultDispatcherId, diff --git a/src/core/Akka/Routing/TailChopping.cs b/src/core/Akka/Routing/TailChopping.cs index 1007f56de54..14b99a00d41 100644 --- a/src/core/Akka/Routing/TailChopping.cs +++ b/src/core/Akka/Routing/TailChopping.cs @@ -162,11 +162,11 @@ public sealed class TailChoppingPool : Pool /// The configuration used to configure the pool. public TailChoppingPool(Config config) : this( - config.GetInt("nr-of-instances", 0), + config.GetInt("nr-of-instances"), Resizer.FromConfig(config), Pool.DefaultSupervisorStrategy, Dispatchers.DefaultDispatcherId, - config.GetTimeSpan("within", null), config.GetTimeSpan("tail-chopping-router.interval", null), config.HasPath("pool-dispatcher")) + config.GetTimeSpan("within"), config.GetTimeSpan("tail-chopping-router.interval"), config.HasPath("pool-dispatcher")) { } @@ -398,8 +398,8 @@ public sealed class TailChoppingGroup : Group public TailChoppingGroup(Config config) : this( config.GetStringList("routees.paths", new string[] { }), - config.GetTimeSpan("within", null), - config.GetTimeSpan("tail-chopping-router.interval", null), + config.GetTimeSpan("within"), + config.GetTimeSpan("tail-chopping-router.interval"), Dispatchers.DefaultDispatcherId) { } diff --git a/src/examples/Akka.Persistence.Custom/Settings.cs b/src/examples/Akka.Persistence.Custom/Settings.cs index 86d3d7db590..f467bbc3980 100644 --- a/src/examples/Akka.Persistence.Custom/Settings.cs +++ b/src/examples/Akka.Persistence.Custom/Settings.cs @@ -89,7 +89,7 @@ public SnapshotStoreSettings(Config config) ConnectionString = config.GetString("connection-string"); ConnectionTimeout = config.GetTimeSpan("connection-timeout"); AutoInitialize = config.GetBoolean("auto-initialize"); - DefaultSerializer = config.GetString("serializer", null); + DefaultSerializer = config.GetString("serializer"); } } } From baf5491b87656be7862e659604da09e91d37d9d1 Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Fri, 23 Jun 2023 20:17:25 +1000 Subject: [PATCH 2/2] . --- .../Akka.Benchmarks/Hocon/HoconBenchmarks.cs | 8 +++--- .../ClustetMetricsRoutingSpec.cs | 2 +- .../ReplicatorChaosSpec.cs | 4 +-- .../ReplicatorSpec.cs | 20 ++++++------- .../SqliteConfigSpec.cs | 14 +++++----- .../Routing/ClusterRoundRobinSpec.cs | 2 +- .../Akka.Cluster.Tests/DowningProviderSpec.cs | 2 +- .../ClusterMessageSerializerSpec.cs | 2 +- src/core/Akka.Cluster/Cluster.cs | 2 +- src/core/Akka.Coordination.Tests/TestLease.cs | 2 +- .../AtLeastOnceDeliveryFailureSpec.cs | 2 +- .../ReceivePersistentActorTests.cs | 2 +- src/core/Akka.Remote.TestKit/Extension.cs | 6 ++-- .../RemoteGatePiercingSpec.cs | 2 +- .../Akka.Remote.Tests/RemoteConfigSpec.cs | 28 +++++++++---------- src/core/Akka.Remote/RemoteSystemDaemon.cs | 2 +- src/core/Akka.Streams/Implementation/Sinks.cs | 2 +- .../Akka.TestKit.Tests/TestSchedulerTests.cs | 2 +- .../Dispatch/GetMailboxTypeSpec.cs | 2 +- .../Actor/Dispatch/ActorModelSpec.cs | 10 +++---- .../Akka.Tests/Actor/ReceiveActorTests.cs | 2 +- src/core/Akka/Actor/CoordinatedShutdown.cs | 12 ++++---- src/core/Akka/Actor/RootGuardianSupervisor.cs | 2 +- 23 files changed, 66 insertions(+), 66 deletions(-) diff --git a/src/benchmark/Akka.Benchmarks/Hocon/HoconBenchmarks.cs b/src/benchmark/Akka.Benchmarks/Hocon/HoconBenchmarks.cs index fb9701a389a..5c73004cba9 100644 --- a/src/benchmark/Akka.Benchmarks/Hocon/HoconBenchmarks.cs +++ b/src/benchmark/Akka.Benchmarks/Hocon/HoconBenchmarks.cs @@ -80,25 +80,25 @@ public string Hocon_parse_resolve_string_value() [Benchmark] public int Hocon_parse_resolve_int_value() { - return fallback2.GetInt("akka.remote.dot-netty.tcp.port", 0); + return fallback2.GetInt("akka.remote.dot-netty.tcp.port"); } [Benchmark] public double Hocon_parse_resolve_double_value() { - return fallback1.GetDouble("akka.actor.branch-factor", 0); + return fallback1.GetDouble("akka.actor.branch-factor"); } [Benchmark] public bool Hocon_parse_resolve_boolean_value() { - return fallback1.GetBoolean("akka.persistence.journal.sql-server.auto-initialize", false); + return fallback1.GetBoolean("akka.persistence.journal.sql-server.auto-initialize"); } [Benchmark] public TimeSpan Hocon_parse_resolve_TimeSpan_value() { - return fallback1.GetTimeSpan("akka.actor.ask-timeout", null); + return fallback1.GetTimeSpan("akka.actor.ask-timeout"); } [Benchmark] diff --git a/src/contrib/cluster/Akka.Cluster.Metrics.Tests.MultiNode/ClustetMetricsRoutingSpec.cs b/src/contrib/cluster/Akka.Cluster.Metrics.Tests.MultiNode/ClustetMetricsRoutingSpec.cs index 4608a4eb6fe..b2f9e567df2 100644 --- a/src/contrib/cluster/Akka.Cluster.Metrics.Tests.MultiNode/ClustetMetricsRoutingSpec.cs +++ b/src/contrib/cluster/Akka.Cluster.Metrics.Tests.MultiNode/ClustetMetricsRoutingSpec.cs @@ -321,7 +321,7 @@ private async Task StartRouter(string name) { var router = Sys.ActorOf(new ClusterRouterPool( new AdaptiveLoadBalancingPool(MemoryMetricsSelector.Instance), - new ClusterRouterPoolSettings(10, 1, true, null) + new ClusterRouterPoolSettings(10, 1, true) ).Props(Props.Create()), name); // it may take some time until router receives cluster member events diff --git a/src/contrib/cluster/Akka.DistributedData.Tests.MultiNode/ReplicatorChaosSpec.cs b/src/contrib/cluster/Akka.DistributedData.Tests.MultiNode/ReplicatorChaosSpec.cs index 25300c74fab..7d0b390b500 100644 --- a/src/contrib/cluster/Akka.DistributedData.Tests.MultiNode/ReplicatorChaosSpec.cs +++ b/src/contrib/cluster/Akka.DistributedData.Tests.MultiNode/ReplicatorChaosSpec.cs @@ -187,7 +187,7 @@ public void Replicator_in_chaotic_cluster_should_be_available_during_network_spl RunOn(() => { - _replicator.Tell(Dsl.Update(KeyA, GCounter.Empty, new WriteTo(2, _timeout), x => x.Increment(_cluster, 1))); + _replicator.Tell(Dsl.Update(KeyA, GCounter.Empty, new WriteTo(2, _timeout), x => x.Increment(_cluster))); ExpectMsg(new UpdateSuccess(KeyA, null)); }, First); @@ -205,7 +205,7 @@ public void Replicator_in_chaotic_cluster_should_be_available_during_network_spl RunOn(() => { - _replicator.Tell(Dsl.Update(KeyD, GCounter.Empty, new WriteTo(2, _timeout), x => x.Increment(_cluster, 1))); + _replicator.Tell(Dsl.Update(KeyD, GCounter.Empty, new WriteTo(2, _timeout), x => x.Increment(_cluster))); ExpectMsg(new UpdateSuccess(KeyD, null)); }, Fourth); diff --git a/src/contrib/cluster/Akka.DistributedData.Tests.MultiNode/ReplicatorSpec.cs b/src/contrib/cluster/Akka.DistributedData.Tests.MultiNode/ReplicatorSpec.cs index aa71d0f10ee..b9c857164dc 100644 --- a/src/contrib/cluster/Akka.DistributedData.Tests.MultiNode/ReplicatorSpec.cs +++ b/src/contrib/cluster/Akka.DistributedData.Tests.MultiNode/ReplicatorSpec.cs @@ -360,7 +360,7 @@ public void Cluster_CRDT_should_be_replicated_after_successful_update() changedProbe.ExpectMsg(c => Equals(c.Key, KeyC)).Get(KeyC).Value.ShouldBe(30UL); // replicate with gossip after WriteLocal - _replicator.Tell(Dsl.Update(KeyC, GCounter.Empty, WriteLocal.Instance, x => x.Increment(_cluster, 1))); + _replicator.Tell(Dsl.Update(KeyC, GCounter.Empty, WriteLocal.Instance, x => x.Increment(_cluster))); ExpectMsg(new UpdateSuccess(KeyC, null)); changedProbe.ExpectMsg(c => Equals(c.Key, KeyC)).Get(KeyC).Value.ShouldBe(31UL); @@ -400,7 +400,7 @@ public void Cluster_CRDT_should_be_replicated_after_successful_update() var c31 = ExpectMsg(g => Equals(g.Key, KeyC)).Get(KeyC); c31.Value.ShouldBe(31UL); - _replicator.Tell(Dsl.Update(KeyC, GCounter.Empty, WriteLocal.Instance, x => x.Increment(_cluster, 1))); + _replicator.Tell(Dsl.Update(KeyC, GCounter.Empty, WriteLocal.Instance, x => x.Increment(_cluster))); ExpectMsg(new UpdateSuccess(KeyC, null)); Within(TimeSpan.FromSeconds(5), () => @@ -436,9 +436,9 @@ public void Cluster_CRDT_should_converge_after_partition() var c40 = ExpectMsg(g => Equals(g.Key, KeyD)).Get(KeyD); c40.Value.ShouldBe(40UL); - _replicator.Tell(Dsl.Update(KeyD, GCounter.Empty.Increment(_cluster, 1), _writeTwo, x => x.Increment(_cluster, 1))); + _replicator.Tell(Dsl.Update(KeyD, GCounter.Empty.Increment(_cluster), _writeTwo, x => x.Increment(_cluster))); ExpectMsg(new UpdateTimeout(KeyD, null), _timeOut.Add(TimeSpan.FromSeconds(1))); - _replicator.Tell(Dsl.Update(KeyD, GCounter.Empty, _writeTwo, x => x.Increment(_cluster, 1))); + _replicator.Tell(Dsl.Update(KeyD, GCounter.Empty, _writeTwo, x => x.Increment(_cluster))); ExpectMsg(new UpdateTimeout(KeyD, null), _timeOut.Add(TimeSpan.FromSeconds(1))); }, _first, _second); @@ -526,7 +526,7 @@ public void Cluster_CRDT_should_support_majority_quorum_write_and_read_with_3_no RunOn(() => { - _replicator.Tell(Dsl.Update(KeyE, GCounter.Empty, WriteLocal.Instance, x => x.Increment(_cluster, 1))); + _replicator.Tell(Dsl.Update(KeyE, GCounter.Empty, WriteLocal.Instance, x => x.Increment(_cluster))); ExpectMsg(new UpdateSuccess(KeyE, null)); }, _second); @@ -542,7 +542,7 @@ public void Cluster_CRDT_should_support_majority_quorum_write_and_read_with_3_no _replicator.Tell(Dsl.Update(KeyE, GCounter.Empty, _writeMajority, data => { probe1.Ref.Tell(data.Value); - return data.Increment(_cluster, 1); + return data.Increment(_cluster); }), probe2.Ref); // verify read your own writes, without waiting for the UpdateSuccess reply @@ -562,14 +562,14 @@ public void Cluster_CRDT_should_support_majority_quorum_write_and_read_with_3_no var probe1 = CreateTestProbe(); _replicator.Tell(Dsl.Get(KeyE, _readMajority), probe1.Ref); probe1.ExpectMsg(); - _replicator.Tell(Dsl.Update(KeyE, GCounter.Empty, _writeMajority, 153, x => x.Increment(_cluster, 1)), probe1.Ref); + _replicator.Tell(Dsl.Update(KeyE, GCounter.Empty, _writeMajority, 153, x => x.Increment(_cluster)), probe1.Ref); // verify read your own writes, without waiting for the UpdateSuccess reply // note that the order of the replies are not defined, and therefore we use separate probes var probe2 = CreateTestProbe(); - _replicator.Tell(Dsl.Update(KeyE, GCounter.Empty, _writeMajority, 154, x => x.Increment(_cluster, 1)), probe2.Ref); + _replicator.Tell(Dsl.Update(KeyE, GCounter.Empty, _writeMajority, 154, x => x.Increment(_cluster)), probe2.Ref); var probe3 = CreateTestProbe(); - _replicator.Tell(Dsl.Update(KeyE, GCounter.Empty, _writeMajority, 155, x => x.Increment(_cluster, 1)), probe3.Ref); + _replicator.Tell(Dsl.Update(KeyE, GCounter.Empty, _writeMajority, 155, x => x.Increment(_cluster)), probe3.Ref); var probe5 = CreateTestProbe(); _replicator.Tell(Dsl.Get(KeyE, _readMajority), probe5.Ref); probe1.ExpectMsg(new UpdateSuccess(KeyE, 153)); @@ -622,7 +622,7 @@ public void Cluster_CRDT_should_converge_after_many_concurrent_updates() for (ulong i = 0; i < 100UL; i++) { c = c.Increment(_cluster, i); - _replicator.Tell(Dsl.Update(KeyF, GCounter.Empty, _writeTwo, x => x.Increment(_cluster, 1))); + _replicator.Tell(Dsl.Update(KeyF, GCounter.Empty, _writeTwo, x => x.Increment(_cluster))); } var results = ReceiveN(100); diff --git a/src/contrib/persistence/Akka.Persistence.Sqlite.Tests/SqliteConfigSpec.cs b/src/contrib/persistence/Akka.Persistence.Sqlite.Tests/SqliteConfigSpec.cs index b085256de58..735bf14b8ed 100644 --- a/src/contrib/persistence/Akka.Persistence.Sqlite.Tests/SqliteConfigSpec.cs +++ b/src/contrib/persistence/Akka.Persistence.Sqlite.Tests/SqliteConfigSpec.cs @@ -87,16 +87,16 @@ public void Should_sqlite_snapshot_has_default_config() var config = Sys.Settings.Config.GetConfig("akka.persistence.snapshot-store.sqlite"); Assert.False(config.IsNullOrEmpty()); - Assert.Equal("Akka.Persistence.Sqlite.Snapshot.SqliteSnapshotStore, Akka.Persistence.Sqlite", config.GetString("class", null)); - Assert.Equal("akka.actor.default-dispatcher", config.GetString("plugin-dispatcher", null)); - Assert.Equal(string.Empty, config.GetString("connection-string", null)); - Assert.Equal(string.Empty, config.GetString("connection-string-name", null)); - Assert.Equal(TimeSpan.FromSeconds(30), config.GetTimeSpan("connection-timeout", null)); + Assert.Equal("Akka.Persistence.Sqlite.Snapshot.SqliteSnapshotStore, Akka.Persistence.Sqlite", config.GetString("class")); + Assert.Equal("akka.actor.default-dispatcher", config.GetString("plugin-dispatcher")); + Assert.Equal(string.Empty, config.GetString("connection-string")); + Assert.Equal(string.Empty, config.GetString("connection-string-name")); + Assert.Equal(TimeSpan.FromSeconds(30), config.GetTimeSpan("connection-timeout")); // This is changed from "snapshot-store" to "snapshot" - Assert.Equal("snapshot", config.GetString("table-name", null)); + Assert.Equal("snapshot", config.GetString("table-name")); Assert.Equal("unspecified", config.GetString("read-isolation-level")); Assert.Equal("unspecified", config.GetString("write-isolation-level")); - Assert.False(config.GetBoolean("auto-initialize", false)); + Assert.False(config.GetBoolean("auto-initialize")); } [Fact] diff --git a/src/core/Akka.Cluster.Tests.MultiNode/Routing/ClusterRoundRobinSpec.cs b/src/core/Akka.Cluster.Tests.MultiNode/Routing/ClusterRoundRobinSpec.cs index 3fab543c121..37032d964c3 100644 --- a/src/core/Akka.Cluster.Tests.MultiNode/Routing/ClusterRoundRobinSpec.cs +++ b/src/core/Akka.Cluster.Tests.MultiNode/Routing/ClusterRoundRobinSpec.cs @@ -139,7 +139,7 @@ protected ClusterRoundRobinSpec(ClusterRoundRobinSpecConfig config) router2 = new Lazy(() => Sys.ActorOf( new ClusterRouterPool( new RoundRobinPool(0), - new ClusterRouterPoolSettings(3, 1, true, null)).Props(Props.Create()), + new ClusterRouterPoolSettings(3, 1, true)).Props(Props.Create()), "router2")); router3 = new Lazy(() => Sys.ActorOf(FromConfig.Instance.Props(Props.Create()), "router3")); router4 = new Lazy(() => Sys.ActorOf(FromConfig.Instance.Props(), "router4")); diff --git a/src/core/Akka.Cluster.Tests/DowningProviderSpec.cs b/src/core/Akka.Cluster.Tests/DowningProviderSpec.cs index 0e5411af9f6..251666fc2d8 100644 --- a/src/core/Akka.Cluster.Tests/DowningProviderSpec.cs +++ b/src/core/Akka.Cluster.Tests/DowningProviderSpec.cs @@ -36,7 +36,7 @@ public Props DowningActorProps internal class DummyDowningProvider : IDowningProvider { - public readonly AtomicBoolean ActorPropsAccessed = new(false); + public readonly AtomicBoolean ActorPropsAccessed = new(); public DummyDowningProvider(ActorSystem system, Cluster cluster) { } diff --git a/src/core/Akka.Cluster.Tests/Serialization/ClusterMessageSerializerSpec.cs b/src/core/Akka.Cluster.Tests/Serialization/ClusterMessageSerializerSpec.cs index 0d56d540256..2cf3f81efb6 100644 --- a/src/core/Akka.Cluster.Tests/Serialization/ClusterMessageSerializerSpec.cs +++ b/src/core/Akka.Cluster.Tests/Serialization/ClusterMessageSerializerSpec.cs @@ -211,7 +211,7 @@ public void Can_serialize_ClusterRouterPool() public void Can_serialize_ClusterRouterPoolWithEmptyRole() { var roundRobinPool = new RoundRobinPool(nrOfInstances: 4); - var clusterRouterPoolSettings = new ClusterRouterPoolSettings(2, 5, true, null); + var clusterRouterPoolSettings = new ClusterRouterPoolSettings(2, 5, true); var message = new ClusterRouterPool(roundRobinPool, clusterRouterPoolSettings); AssertEqual(message); } diff --git a/src/core/Akka.Cluster/Cluster.cs b/src/core/Akka.Cluster/Cluster.cs index 9909c64156f..bf7caaa9018 100644 --- a/src/core/Akka.Cluster/Cluster.cs +++ b/src/core/Akka.Cluster/Cluster.cs @@ -543,7 +543,7 @@ public ImmutableHashSet SelfRoles /// public Member SelfMember => _readView.Self; - private readonly AtomicBoolean _isTerminated = new(false); + private readonly AtomicBoolean _isTerminated = new(); /// /// Determine whether or not this cluster instance has been shutdown. diff --git a/src/core/Akka.Coordination.Tests/TestLease.cs b/src/core/Akka.Coordination.Tests/TestLease.cs index 1992bea1be0..4c44b1c2fd0 100644 --- a/src/core/Akka.Coordination.Tests/TestLease.cs +++ b/src/core/Akka.Coordination.Tests/TestLease.cs @@ -118,7 +118,7 @@ public static Config Configuration public TestProbe Probe { get; } private AtomicReference> nextAcquireResult; - private AtomicBoolean nextCheckLeaseResult = new(false); + private AtomicBoolean nextCheckLeaseResult = new(); private AtomicReference> currentCallBack = new(_ => { }); private ILoggingAdapter _log; public TaskCompletionSource InitialPromise { get; } = new(); diff --git a/src/core/Akka.Persistence.Tests/AtLeastOnceDeliveryFailureSpec.cs b/src/core/Akka.Persistence.Tests/AtLeastOnceDeliveryFailureSpec.cs index 18dd11794e3..58ae40fd786 100644 --- a/src/core/Akka.Persistence.Tests/AtLeastOnceDeliveryFailureSpec.cs +++ b/src/core/Akka.Persistence.Tests/AtLeastOnceDeliveryFailureSpec.cs @@ -249,7 +249,7 @@ public ChaosDestination(IActorRef probe) Probe = probe; State = new List(); _config = Context.System.Settings.Config.GetConfig("akka.persistence.destination.chaos"); - _confirmFailureRate = _config.GetDouble("confirm-failure-rate", 0); + _confirmFailureRate = _config.GetDouble("confirm-failure-rate"); Receive(m => { diff --git a/src/core/Akka.Persistence.Tests/ReceivePersistentActorTests.cs b/src/core/Akka.Persistence.Tests/ReceivePersistentActorTests.cs index 7482ead57a0..7f36ddbc4d6 100644 --- a/src/core/Akka.Persistence.Tests/ReceivePersistentActorTests.cs +++ b/src/core/Akka.Persistence.Tests/ReceivePersistentActorTests.cs @@ -242,7 +242,7 @@ public TypePredicatesActor(string pid) : base(pid) } return false; }); //Func, when 10 <= i < 15 - Command(typeof(int), i => Sender.Tell("int:" + i, Self), null); //Null predicate, when i >= 15 + Command(typeof(int), i => Sender.Tell("int:" + i, Self)); //Null predicate, when i >= 15 Command(typeof(int), i => Sender.Tell("ShouldNeverMatch:" + i, Self)); //The handler above should never be invoked Command(typeof(string), i => Sender.Tell("string:" + i)); } diff --git a/src/core/Akka.Remote.TestKit/Extension.cs b/src/core/Akka.Remote.TestKit/Extension.cs index ad960704b91..382f9dc1269 100644 --- a/src/core/Akka.Remote.TestKit/Extension.cs +++ b/src/core/Akka.Remote.TestKit/Extension.cs @@ -132,9 +132,9 @@ public int ComputeWps(Config config) return ThreadPoolConfig.ScaledPoolSize(2, 1.0, 2); return ThreadPoolConfig.ScaledPoolSize( - config.GetInt("pool-size-min", 0), - config.GetDouble("pool-size-factor", 0), - config.GetInt("pool-size-max", 0)); + config.GetInt("pool-size-min"), + config.GetDouble("pool-size-factor"), + config.GetInt("pool-size-max")); } } } diff --git a/src/core/Akka.Remote.Tests.MultiNode/RemoteGatePiercingSpec.cs b/src/core/Akka.Remote.Tests.MultiNode/RemoteGatePiercingSpec.cs index 0caf35fcfd1..567f415070d 100644 --- a/src/core/Akka.Remote.Tests.MultiNode/RemoteGatePiercingSpec.cs +++ b/src/core/Akka.Remote.Tests.MultiNode/RemoteGatePiercingSpec.cs @@ -84,7 +84,7 @@ public void RemoteGatePiercing_must_allow_restarted_node_to_pass_through_gate() _identify(_config.Second, "subject"); EnterBarrier("actors-communicate"); - EventFilter.Warning(null, contains: "address is now gated").ExpectOne(() => + EventFilter.Warning(contains: "address is now gated").ExpectOne(() => { var cmd = RARP.For(Sys) diff --git a/src/core/Akka.Remote.Tests/RemoteConfigSpec.cs b/src/core/Akka.Remote.Tests/RemoteConfigSpec.cs index bd59e864f7e..36fee3ff342 100644 --- a/src/core/Akka.Remote.Tests/RemoteConfigSpec.cs +++ b/src/core/Akka.Remote.Tests/RemoteConfigSpec.cs @@ -57,10 +57,10 @@ public void Remoting_should_contain_correct_configuration_values_in_ReferenceCon Assert.Equal(TimeSpan.FromSeconds(1), remoteSettings.WatchHeartBeatInterval); Assert.Equal(TimeSpan.FromSeconds(1), remoteSettings.WatchHeartbeatExpectedResponseAfter); Assert.Equal(TimeSpan.FromSeconds(1), remoteSettings.WatchUnreachableReaperInterval); - Assert.Equal(10, remoteSettings.WatchFailureDetectorConfig.GetDouble("threshold", 0)); - Assert.Equal(200, remoteSettings.WatchFailureDetectorConfig.GetDouble("max-sample-size", 0)); - Assert.Equal(TimeSpan.FromSeconds(10), remoteSettings.WatchFailureDetectorConfig.GetTimeSpan("acceptable-heartbeat-pause", null)); - Assert.Equal(TimeSpan.FromMilliseconds(100), remoteSettings.WatchFailureDetectorConfig.GetTimeSpan("min-std-deviation", null)); + Assert.Equal(10, remoteSettings.WatchFailureDetectorConfig.GetDouble("threshold")); + Assert.Equal(200, remoteSettings.WatchFailureDetectorConfig.GetDouble("max-sample-size")); + Assert.Equal(TimeSpan.FromSeconds(10), remoteSettings.WatchFailureDetectorConfig.GetTimeSpan("acceptable-heartbeat-pause")); + Assert.Equal(TimeSpan.FromMilliseconds(100), remoteSettings.WatchFailureDetectorConfig.GetTimeSpan("min-std-deviation")); var remoteSettingsAdaptersStandart = new List>() { @@ -73,7 +73,7 @@ public void Remoting_should_contain_correct_configuration_values_in_ReferenceCon Assert.Empty(remoteSettingsAdapters.Except(remoteSettingsAdaptersStandart)); - remoteSettings.Config.GetString("akka.remote.log-frame-size-exceeding", null).ShouldBe("off"); + remoteSettings.Config.GetString("akka.remote.log-frame-size-exceeding").ShouldBe("off"); } [Fact] @@ -83,7 +83,7 @@ public void Remoting_should_be_able_to_parse_AkkaProtocol_related_config_element Assert.Equal(typeof(DeadlineFailureDetector), Type.GetType(settings.TransportFailureDetectorImplementationClass)); Assert.Equal(TimeSpan.FromSeconds(4), settings.TransportHeartBeatInterval); - Assert.Equal(TimeSpan.FromSeconds(120), settings.TransportFailureDetectorConfig.GetTimeSpan("acceptable-heartbeat-pause", null)); + Assert.Equal(TimeSpan.FromSeconds(120), settings.TransportFailureDetectorConfig.GetTimeSpan("acceptable-heartbeat-pause")); } [Fact] @@ -102,8 +102,8 @@ public void Remoting_should_contain_correct_heliosTCP_values_in_ReferenceConf() Assert.Equal(4096, s.Backlog); Assert.True(s.TcpNoDelay); Assert.True(s.TcpKeepAlive); - Assert.Equal("off-for-windows", c.GetString("tcp-reuse-addr", null)); - Assert.True(string.IsNullOrEmpty(c.GetString("hostname", null))); + Assert.Equal("off-for-windows", c.GetString("tcp-reuse-addr")); + Assert.True(string.IsNullOrEmpty(c.GetString("hostname"))); Assert.Null(s.PublicPort); Assert.Equal(2, s.ServerSocketWorkerPoolSize); Assert.Equal(2, s.ClientSocketWorkerPoolSize); @@ -142,17 +142,17 @@ public void Remoting_should_contain_correct_socket_worker_pool_configuration_val // server-socket-worker-pool { var pool = c.GetConfig("server-socket-worker-pool"); - Assert.Equal(2, pool.GetInt("pool-size-min", 0)); - Assert.Equal(1.0d, pool.GetDouble("pool-size-factor", 0)); - Assert.Equal(2, pool.GetInt("pool-size-max", 0)); + Assert.Equal(2, pool.GetInt("pool-size-min")); + Assert.Equal(1.0d, pool.GetDouble("pool-size-factor")); + Assert.Equal(2, pool.GetInt("pool-size-max")); } //client-socket-worker-pool { var pool = c.GetConfig("client-socket-worker-pool"); - Assert.Equal(2, pool.GetInt("pool-size-min", 0)); - Assert.Equal(1.0d, pool.GetDouble("pool-size-factor", 0)); - Assert.Equal(2, pool.GetInt("pool-size-max", 0)); + Assert.Equal(2, pool.GetInt("pool-size-min")); + Assert.Equal(1.0d, pool.GetDouble("pool-size-factor")); + Assert.Equal(2, pool.GetInt("pool-size-max")); } } diff --git a/src/core/Akka.Remote/RemoteSystemDaemon.cs b/src/core/Akka.Remote/RemoteSystemDaemon.cs index 1076ad98327..a03ffb24e06 100644 --- a/src/core/Akka.Remote/RemoteSystemDaemon.cs +++ b/src/core/Akka.Remote/RemoteSystemDaemon.cs @@ -80,7 +80,7 @@ public DaemonMsgCreate(Props props, Deploy deploy, string path, IActorRef superv internal sealed class RemoteSystemDaemon : VirtualPathContainer { private readonly ActorSystemImpl _system; - private readonly Switch _terminating = new(false); + private readonly Switch _terminating = new(); private readonly ConcurrentDictionary> _parent2Children = new(); private readonly IActorRef _terminator; diff --git a/src/core/Akka.Streams/Implementation/Sinks.cs b/src/core/Akka.Streams/Implementation/Sinks.cs index ec528bf28da..e6682ae861a 100644 --- a/src/core/Akka.Streams/Implementation/Sinks.cs +++ b/src/core/Akka.Streams/Implementation/Sinks.cs @@ -1071,7 +1071,7 @@ private sealed class ObserverDisposable : IDisposable { private readonly ObservableLogic _logic; private readonly IObserver _observer; - private readonly AtomicBoolean _disposed = new(false); + private readonly AtomicBoolean _disposed = new(); public ObserverDisposable(ObservableLogic logic, IObserver observer) { diff --git a/src/core/Akka.TestKit.Tests/TestSchedulerTests.cs b/src/core/Akka.TestKit.Tests/TestSchedulerTests.cs index bf400601346..c4804f64fa6 100644 --- a/src/core/Akka.TestKit.Tests/TestSchedulerTests.cs +++ b/src/core/Akka.TestKit.Tests/TestSchedulerTests.cs @@ -98,7 +98,7 @@ public async Task Doesnt_reschedule_cancelled() [Fact] public async Task Advance_to_takes_us_to_correct_time() { - _testReceiveActor.Tell(new ScheduleOnceMessage(TimeSpan.FromSeconds(1), 1)); + _testReceiveActor.Tell(new ScheduleOnceMessage(TimeSpan.FromSeconds(1))); _testReceiveActor.Tell(new ScheduleOnceMessage(TimeSpan.FromSeconds(2), 2)); _testReceiveActor.Tell(new ScheduleOnceMessage(TimeSpan.FromSeconds(3), 3)); await _testReceiveActor.Ask(new Identify(null), RemainingOrDefault); // verify that the ActorCell has started diff --git a/src/core/Akka.Tests.Performance/Dispatch/GetMailboxTypeSpec.cs b/src/core/Akka.Tests.Performance/Dispatch/GetMailboxTypeSpec.cs index 17384c16a4a..1cca6dc1db1 100644 --- a/src/core/Akka.Tests.Performance/Dispatch/GetMailboxTypeSpec.cs +++ b/src/core/Akka.Tests.Performance/Dispatch/GetMailboxTypeSpec.cs @@ -25,7 +25,7 @@ protected override void OnReceive(object message) public static Props Props { get; } = Props.Create(() => new EchoActor()); } - private static readonly AtomicCounter Counter = new(0); + private static readonly AtomicCounter Counter = new(); private Counter _createActorThroughput; private const string CreateThroughputCounter = "GetMailboxTypeFootprint"; private const int GetMailboxTypeNumber = 1000000; diff --git a/src/core/Akka.Tests/Actor/Dispatch/ActorModelSpec.cs b/src/core/Akka.Tests/Actor/Dispatch/ActorModelSpec.cs index 02cde5781c4..8879a56c11d 100644 --- a/src/core/Akka.Tests/Actor/Dispatch/ActorModelSpec.cs +++ b/src/core/Akka.Tests/Actor/Dispatch/ActorModelSpec.cs @@ -195,7 +195,7 @@ public ThrowException(Exception e) class DispatcherActor : ReceiveActor { - private Switch _busy = new(false); + private Switch _busy = new(); private readonly ILoggingAdapter _log = Context.GetLogger(); private MessageDispatcherInterceptor _interceptor = Context.Dispatcher.AsInstanceOf(); @@ -321,11 +321,11 @@ public MessageDispatcherInterceptorConfigurator(Config config, IDispatcherPrereq throw ConfigurationException.NullOrEmptyConfig(); _instance = new MessageDispatcherInterceptor(this, - config.GetString("id", null), - config.GetInt("throughput", 0), - config.GetTimeSpan("throughput-deadline-time", null).Ticks, + config.GetString("id"), + config.GetInt("throughput"), + config.GetTimeSpan("throughput-deadline-time").Ticks, ConfigureExecutor(), - Config.GetTimeSpan("shutdown-timeout", null)); + Config.GetTimeSpan("shutdown-timeout")); } public override MessageDispatcher Dispatcher() diff --git a/src/core/Akka.Tests/Actor/ReceiveActorTests.cs b/src/core/Akka.Tests/Actor/ReceiveActorTests.cs index 4b266af83c8..4d5357d8aa8 100644 --- a/src/core/Akka.Tests/Actor/ReceiveActorTests.cs +++ b/src/core/Akka.Tests/Actor/ReceiveActorTests.cs @@ -219,7 +219,7 @@ public TypePredicatesActor() } return false; }); //Func, when 10 <= i < 15 - Receive(typeof(int), i => Sender.Tell("int:" + i, Self), null); //Null predicate, when i >= 15 + Receive(typeof(int), i => Sender.Tell("int:" + i, Self)); //Null predicate, when i >= 15 Receive(typeof(int), i => Sender.Tell("ShouldNeverMatch:" + i, Self)); //The handler above should never be invoked Receive(typeof(string), i => Sender.Tell("string:" + i)); } diff --git a/src/core/Akka/Actor/CoordinatedShutdown.cs b/src/core/Akka/Actor/CoordinatedShutdown.cs index 96029d19e0f..9c76ea3f472 100644 --- a/src/core/Akka/Actor/CoordinatedShutdown.cs +++ b/src/core/Akka/Actor/CoordinatedShutdown.cs @@ -273,7 +273,7 @@ private ClusterJoinUnsuccessfulReason() { } private readonly ConcurrentSet>> _clrShutdownTasks = new(); private readonly ConcurrentDictionary>)>> _tasks = new(); private readonly AtomicReference _runStarted = new(null); - private readonly AtomicBoolean _clrHooksStarted = new(false); + private readonly AtomicBoolean _clrHooksStarted = new(); private readonly TaskCompletionSource _runPromise = new(); private readonly TaskCompletionSource _hooksRunPromise = new(); @@ -559,7 +559,7 @@ internal static Dictionary PhasesFromConfig(Config config) if (config.IsNullOrEmpty()) throw new ConfigurationException("Invalid phase configuration."); - var defaultPhaseTimeout = config.GetString("default-phase-timeout", null); + var defaultPhaseTimeout = config.GetString("default-phase-timeout"); var phasesConf = config.GetConfig("phases"); var defaultPhaseConfig = ConfigurationFactory.ParseString($"timeout = {defaultPhaseTimeout}" + @" recover = true @@ -570,8 +570,8 @@ internal static Dictionary PhasesFromConfig(Config config) { var c = phasesConf.GetConfig(v.Key).WithFallback(defaultPhaseConfig); var dependsOn = c.GetStringList("depends-on").ToImmutableHashSet(); - var timeout = c.GetTimeSpan("timeout", null, allowInfinite: false); - var recover = c.GetBoolean("recover", false); + var timeout = c.GetTimeSpan("timeout", allowInfinite: false); + var recover = c.GetBoolean("recover"); return new Phase(dependsOn, timeout, recover); }); } @@ -629,7 +629,7 @@ void DepthFirstSearch(string u) internal static void InitPhaseActorSystemTerminate(ActorSystem system, Config conf, CoordinatedShutdown coord) { var terminateActorSystem = system.Settings.CoordinatedShutdownTerminateActorSystem; - var exitClr = conf.GetBoolean("exit-clr", false); + var exitClr = conf.GetBoolean("exit-clr"); if (terminateActorSystem || exitClr) { coord.AddTask(PhaseActorSystemTerminate, "terminate-system", () => @@ -685,7 +685,7 @@ internal static void InitPhaseActorSystemTerminate(ActorSystem system, Config co /// The plugin instance. internal static void InitClrHook(ActorSystem system, Config conf, CoordinatedShutdown coord) { - var runByClrShutdownHook = conf.GetBoolean("run-by-clr-shutdown-hook", false); + var runByClrShutdownHook = conf.GetBoolean("run-by-clr-shutdown-hook"); if (runByClrShutdownHook) { var exitTask = TerminateOnClrExit(coord); diff --git a/src/core/Akka/Actor/RootGuardianSupervisor.cs b/src/core/Akka/Actor/RootGuardianSupervisor.cs index 3f8b5189060..3309ee40569 100644 --- a/src/core/Akka/Actor/RootGuardianSupervisor.cs +++ b/src/core/Akka/Actor/RootGuardianSupervisor.cs @@ -22,7 +22,7 @@ public class RootGuardianSupervisor : MinimalActorRef private readonly ILoggingAdapter _log; private readonly TaskCompletionSource _terminationPromise; private readonly ActorPath _path; - private readonly Switch _stopped = new(false); + private readonly Switch _stopped = new(); private readonly IActorRefProvider _provider; private bool IsWalking => !_terminationPromise.Task.IsCompleted;