diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md
index 5119ea4b10d..110c51af109 100644
--- a/RELEASE_NOTES.md
+++ b/RELEASE_NOTES.md
@@ -1,6 +1,77 @@
-#### 1.5.8 May 17th 2023 ####
+#### 1.5.10 July 26th 2023 ####
-**Placeholder for nightlies**
+Akka.NET v1.5.9 is a maintenance release with a minor API change.
+
+* [Persistence.TCK: Add constructor overload that takes ActorSystemSetup argument](https://github.com/akkadotnet/akka.net/pull/6850)
+
+If you want to see the [full set of changes made in Akka.NET v1.5.10, click here](https://github.com/akkadotnet/akka.net/milestone/92?closed=1).
+
+| COMMITS | LOC+ | LOC- | AUTHOR |
+|---------|------|------|---------------------|
+| 1 | 70 | 12 | Gregorius Soedharmo |
+
+#### 1.5.9 July 18th 2023 ####
+
+Akka.NET v1.5.9 is a maintenance release that introduces some performance improvements and internal code cleanup/modernization.
+
+__Changes:__
+* [Remoting: Make transport adapter component public](https://github.com/akkadotnet/akka.net/pull/6838)
+
+__Improvements:__
+* [Memory optimization, use `Array.Empty` instead of creating empty arrays](https://github.com/akkadotnet/akka.net/pull/6801)
+* [Remoting: Log all wrapped message layers during errors](https://github.com/akkadotnet/akka.net/pull/6818)
+* [Port #6805 and #6807, Improve Stream and Pattern.Backoff instance creation time performance](https://github.com/akkadotnet/akka.net/pull/6821)
+* [DData: Harden LWWDictionary serialization null check](https://github.com/akkadotnet/akka.net/pull/6837)
+
+__Code modernization:__
+* [Use C# 9.0 target-typed new()](https://github.com/akkadotnet/akka.net/pull/6798)
+* [Use C# 8.0 null-coalescing operator](https://github.com/akkadotnet/akka.net/pull/6814)
+
+__Update dependency versions:__
+* [Bump Google.Protobuf to 3.23.4](https://github.com/akkadotnet/akka.net/pull/6826)
+* [Bump Akka.MultiNode.TestAdapter to 1.5.8](https://github.com/akkadotnet/akka.net/pull/6802)
+* [Bump Microsoft.Data.SQLite to 7.0.9](https://github.com/akkadotnet/akka.net/pull/6835)
+* [Bump Microsoft.Extensions.ObjectPool to 7.0.8](https://github.com/akkadotnet/akka.net/pull/6813)
+* [Bump Xunit to 2.5.0](https://github.com/akkadotnet/akka.net/pull/6825)
+
+__Akka.TestKit.Xunit Changes__
+
+Due to breaking API change in Xunit 2.5.0, updating to Akka.NET 1.5.9 might break your unit tests. Some of the breaking change that we've noticed are:
+
+* `AkkaEqualException` constructor has been changed due to changes in Xunit API. If you're using this class, please use the `AkkaEqualException.ForMismatchedValues()` static method instead of using the constructor.
+* Testing for exception types by calling async code inside a sync delegate will not unwrap the `AggregateException` thrown. Either use async all the way or manually unwrap the exception.
+* Xunit `Asset.Equal()` does not automatically check for collection item equality anymore, that means doing `Assert.Equal()` between two dictionary or list would not work anymore.
+* Some Xunit classes have been changed from public to private. If you're using these classes, you will need to refactor your code.
+* __FsCheck.Xunit:__ Xunit Roslyn analyzer has become a bit too overzealous and insists that all unit test method can only return either void or Task and will raise a compilation error if you tried to return anything else. If you're using `FsCheck.Xunit`, you will need to use a pragma to disable this check: `#pragma warning disable xUnit1028`.
+
+If you want to see the [full set of changes made in Akka.NET v1.5.9, click here](https://github.com/akkadotnet/akka.net/milestone/91?closed=1).
+
+| COMMITS | LOC+ | LOC- | AUTHOR |
+|---------|------|------|---------------------|
+| 12 | 171 | 155 | dependabot[bot] |
+| 7 | 466 | 165 | Aaron Stannard |
+| 4 | 1648 | 1725 | Simon Cropp |
+| 1 | 9 | 4 | Gregorius Soedharmo |
+| 1 | 7 | 1 | Michael Buck |
+
+#### 1.5.8 June 15th 2023 ####
+
+Akka.NET v1.5.8 is a maintenance release that introduces some new features and fixes some bugs with Akka.NET v1.5.7 and earlier.
+
+* [Akka.Streams: Added `Source`/`Flow` `Setup` operator](https://github.com/akkadotnet/akka.net/pull/6788)
+* [Akka.Cluster.Sharding: fixed potential wire format problem when upgrading from v1.4 to v1.5 with `state-store-mode=ddata` and `remember-entities=on`](https://github.com/akkadotnet/akka.net/issues/6704)
+* [Akka.Remote.TestKit: Fix MNTR crashing because it is using PolyFill extension method](https://github.com/akkadotnet/akka.net/pull/6768)
+
+If you want to see the [full set of changes made in Akka.NET v1.5.8, click here](https://github.com/akkadotnet/akka.net/milestone/90?closed=1).
+
+| COMMITS | LOC+ | LOC- | AUTHOR |
+| --- | --- | --- | --- |
+| 9 | 11 | 11 | dependabot[bot] |
+| 2 | 8 | 0 | Aaron Stannard |
+| 2 | 75 | 4 | Gregorius Soedharmo |
+| 2 | 132 | 158 | Simon Cropp |
+| 1 | 431 | 1 | Ismael Hamed |
+| 1 | 1 | 1 | Andrea Di Stefano |
#### 1.5.7 May 17th 2023 ####
diff --git a/docs/articles/configuration/config.md b/docs/articles/configuration/config.md
index 084d6d6e022..ce1cec01ca3 100644
--- a/docs/articles/configuration/config.md
+++ b/docs/articles/configuration/config.md
@@ -23,7 +23,7 @@ Other parts of Akka.NET in the future, such as its dependency injection system,
So what if we want to use some built-in `Setup` types in combination with an `ActorSystem`? How do we work with these new types?
-First, if we have HOCON that we need to pass into our `ActorSystem` still then we must use the [`BootstrapSetup` class]((xref:Akka.Actor.BootstrapSetup) to store our HOCON `Config`:
+First, if we have HOCON that we need to pass into our `ActorSystem` still then we must use the [`BootstrapSetup` class](xref:Akka.Actor.BootstrapSetup) to store our HOCON `Config`:
[!code-csharp[SerializationSetup](../../../src/core/Akka.Docs.Tests/Configuration/SerializationSetupDocSpec.cs?name=MergedSetup)]
diff --git a/docs/articles/streams/builtinstages.md b/docs/articles/streams/builtinstages.md
index a8666c94264..d8fbf4e5e41 100644
--- a/docs/articles/streams/builtinstages.md
+++ b/docs/articles/streams/builtinstages.md
@@ -231,6 +231,13 @@ Combine the elements of multiple streams into a stream of sequences using a comb
**completes** when any upstream completes
+### Setup
+
+Defer the creation of a `Source` until materialization and access `ActorMaterializer` and `Attributes`.
+
+Typically used when access to materializer is needed to run a different stream during the construction of a source/flow.
+Can also be used to access the underlying `ActorSystem` from `ActorMaterializer`.
+
## Sink Stages
These built-in sinks are available from ``Akka.Stream.DSL.Sink``:
@@ -615,6 +622,13 @@ Just like `Scan` but receiving a function that results in a `Task` to the next v
**completes** when upstream completes and the last `Task` is resolved
+### Setup
+
+Defer the creation of a `Flow` until materialization and access `ActorMaterializer` and `Attributes`.
+
+Typically used when access to materializer is needed to run a different stream during the construction of a source/flow.
+Can also be used to access the underlying `ActorSystem` from `ActorMaterializer`.
+
### Aggregate
Start with current value ``zero`` and then apply the current and next value to the given function, when upstream
diff --git a/src/Akka.sln b/src/Akka.sln
index d46ec8ccf3a..7af6015fac7 100644
--- a/src/Akka.sln
+++ b/src/Akka.sln
@@ -77,6 +77,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
Akka.sln.DotSettings = Akka.sln.DotSettings
NuGet.Config = NuGet.Config
Directory.Build.props = Directory.Build.props
+ ..\README.md = ..\README.md
+ ..\RELEASE_NOTES.md = ..\RELEASE_NOTES.md
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Akka.Remote.Tests.MultiNode", "core\Akka.Remote.Tests.MultiNode\Akka.Remote.Tests.MultiNode.csproj", "{C9105C76-B084-4DA1-9348-1C74A8F22F6B}"
diff --git a/src/Directory.Build.props b/src/Directory.Build.props
index aab0b208f51..6c24322b94f 100644
--- a/src/Directory.Build.props
+++ b/src/Directory.Build.props
@@ -14,14 +14,14 @@
11.0
- 2.4.2
- 2.4.2
- 17.6.0
+ 2.5.0
+ 2.5.0
+ 17.6.3
0.12.2
[13.0.1,)
2.0.1
- 3.23.2
- 0.13.2
+ 3.23.4
+ 0.13.6
net7.0
6.0.5
net471
@@ -29,10 +29,10 @@
net6.0
5.10.3
true
- 2.16.5
+ 2.16.6
2.0.3
6.0.1
- 1.5.6
+ 1.5.8
5.0.0
akka;actors;actor model;Akka;concurrency
diff --git a/src/benchmark/Akka.Benchmarks/Actor/ActorMemoryFootprintBenchmark.cs b/src/benchmark/Akka.Benchmarks/Actor/ActorMemoryFootprintBenchmark.cs
index 162ef45ba5d..9989721cc0b 100644
--- a/src/benchmark/Akka.Benchmarks/Actor/ActorMemoryFootprintBenchmark.cs
+++ b/src/benchmark/Akka.Benchmarks/Actor/ActorMemoryFootprintBenchmark.cs
@@ -17,7 +17,7 @@
namespace Akka.Benchmarks.Actor
{
[Config(typeof(MicroBenchmarkConfig))]
- [SimpleJob(RunStrategy.Monitoring, targetCount: 25, warmupCount: 5)]
+ [SimpleJob(RunStrategy.Monitoring, warmupCount: 5)]
public class ActorMemoryFootprintBenchmark
{
public ActorSystem Sys;
diff --git a/src/benchmark/Akka.Benchmarks/Actor/ActorMessagingMemoryPressureBenchmark.cs b/src/benchmark/Akka.Benchmarks/Actor/ActorMessagingMemoryPressureBenchmark.cs
index 71e988185de..c98487a8021 100644
--- a/src/benchmark/Akka.Benchmarks/Actor/ActorMessagingMemoryPressureBenchmark.cs
+++ b/src/benchmark/Akka.Benchmarks/Actor/ActorMessagingMemoryPressureBenchmark.cs
@@ -21,7 +21,7 @@ public class ActorMessagingMemoryPressureBenchmark
public sealed class StopActor
{
private StopActor(){}
- public static readonly StopActor Instance = new StopActor();
+ public static readonly StopActor Instance = new();
}
public sealed class MyActor : ReceiveActor
diff --git a/src/benchmark/Akka.Benchmarks/Actor/ActorPathBenchmarks.cs b/src/benchmark/Akka.Benchmarks/Actor/ActorPathBenchmarks.cs
index 0b116bfa646..6507904f673 100644
--- a/src/benchmark/Akka.Benchmarks/Actor/ActorPathBenchmarks.cs
+++ b/src/benchmark/Akka.Benchmarks/Actor/ActorPathBenchmarks.cs
@@ -18,8 +18,8 @@ public class ActorPathBenchmarks
private ActorPath x;
private ActorPath y;
private ActorPath _childPath;
- private Address _sysAdr = new Address("akka.tcp", "system", "127.0.0.1", 1337);
- private Address _otherAdr = new Address("akka.tcp", "system", "127.0.0.1", 1338);
+ private Address _sysAdr = new("akka.tcp", "system", "127.0.0.1", 1337);
+ private Address _otherAdr = new("akka.tcp", "system", "127.0.0.1", 1338);
private string _actorPathStr;
diff --git a/src/benchmark/Akka.Benchmarks/Actor/GetChildBenchmark.cs b/src/benchmark/Akka.Benchmarks/Actor/GetChildBenchmark.cs
index 55814914e79..eefbef1923b 100644
--- a/src/benchmark/Akka.Benchmarks/Actor/GetChildBenchmark.cs
+++ b/src/benchmark/Akka.Benchmarks/Actor/GetChildBenchmark.cs
@@ -93,17 +93,17 @@ protected override void OnReceive(object message)
private ActorSystem _system;
private IActorRef _parentActor;
- private ActorWithChild.Get _getMessage = new ActorWithChild.Get("food");
- private ActorWithChild.Create _createMessage = new ActorWithChild.Create("food");
+ private ActorWithChild.Get _getMessage = new("food");
+ private ActorWithChild.Create _createMessage = new("food");
private IActorContext _cell;
private RepointableActorRef _repointableActorRef;
private LocalActorRef _localActorRef;
private VirtualPathContainer _virtualPathContainer;
- private List _rpChildQueryPath = new List() { "food", "ood", "od" };
- private List _lclChildQueryPath = new List() { "ood", "od", "d" };
- private List _virtualPathContainerQueryPath = new List() { "foo" };
+ private List _rpChildQueryPath = new() { "food", "ood", "od" };
+ private List _lclChildQueryPath = new() { "ood", "od", "d" };
+ private List _virtualPathContainerQueryPath = new() { "foo" };
[GlobalSetup]
public async Task Setup()
diff --git a/src/benchmark/Akka.Benchmarks/Actor/PingPongBenchmarks.cs b/src/benchmark/Akka.Benchmarks/Actor/PingPongBenchmarks.cs
index 4eb3ef8524f..73ee3578c30 100644
--- a/src/benchmark/Akka.Benchmarks/Actor/PingPongBenchmarks.cs
+++ b/src/benchmark/Akka.Benchmarks/Actor/PingPongBenchmarks.cs
@@ -16,7 +16,7 @@
namespace Akka.Benchmarks.Actor
{
[Config(typeof(MonitoringConfig))]
- [SimpleJob(RunStrategy.Monitoring, launchCount: 3, warmupCount: 3, targetCount: 3)]
+ [SimpleJob(RunStrategy.Monitoring, launchCount: 10, warmupCount: 10)]
public class PingPongBenchmarks
{
public const int Operations = 1_000_000;
@@ -24,7 +24,7 @@ public class PingPongBenchmarks
private ActorSystem system;
private IActorRef ping;
- [GlobalSetup]
+ [IterationSetup]
public void Setup()
{
timeout = TimeSpan.FromMinutes(1);
@@ -33,13 +33,13 @@ public void Setup()
ping = system.ActorOf(Props.Create(() => new Ping(pong)));
}
- [GlobalCleanup]
+ [IterationCleanup]
public void Cleanup()
{
system.Dispose();
}
- [Benchmark(OperationsPerInvoke = Operations)]
+ [Benchmark(OperationsPerInvoke = Operations * 2)]
public async Task Actor_ping_pong_single_pair_in_memory()
{
await ping.Ask(StartTest.Instance, timeout);
@@ -49,7 +49,7 @@ public async Task Actor_ping_pong_single_pair_in_memory()
sealed class StartTest
{
- public static readonly StartTest Instance = new StartTest();
+ public static readonly StartTest Instance = new();
private StartTest() { }
}
@@ -65,7 +65,7 @@ public Signal(int remaining)
sealed class TestDone
{
- public static readonly TestDone Instance = new TestDone();
+ public static readonly TestDone Instance = new();
private TestDone() { }
}
diff --git a/src/benchmark/Akka.Benchmarks/Actor/SpawnActorBenchmarks.cs b/src/benchmark/Akka.Benchmarks/Actor/SpawnActorBenchmarks.cs
index 1c288d7fd95..a2eaa81fc7f 100644
--- a/src/benchmark/Akka.Benchmarks/Actor/SpawnActorBenchmarks.cs
+++ b/src/benchmark/Akka.Benchmarks/Actor/SpawnActorBenchmarks.cs
@@ -15,7 +15,7 @@
namespace Akka.Benchmarks.Actor
{
[Config(typeof(MicroBenchmarkConfig))]
- [SimpleJob(RunStrategy.Throughput, targetCount:10, warmupCount:5)]
+ [SimpleJob(RunStrategy.Throughput, warmupCount:5)]
public class SpawnActorBenchmarks
{
[Params(100_000)]
@@ -66,13 +66,13 @@ public StartTest(int actorCount) {
sealed class ChildReady
{
- public static readonly ChildReady Instance = new ChildReady();
+ public static readonly ChildReady Instance = new();
private ChildReady() { }
}
sealed class TestDone
{
- public static readonly TestDone Instance = new TestDone();
+ public static readonly TestDone Instance = new();
private TestDone() { }
}
diff --git a/src/benchmark/Akka.Benchmarks/Cluster/ReachabilityBenchmarks.cs b/src/benchmark/Akka.Benchmarks/Cluster/ReachabilityBenchmarks.cs
index 7bf4eb78f66..564886ba8d2 100644
--- a/src/benchmark/Akka.Benchmarks/Cluster/ReachabilityBenchmarks.cs
+++ b/src/benchmark/Akka.Benchmarks/Cluster/ReachabilityBenchmarks.cs
@@ -27,8 +27,8 @@ public class ReachabilityBenchmarks
[Params(100)]
public int Iterations;
- public Address Address = new Address("akka", "sys", "a", 2552);
- public Address Node = new Address("akka", "sys", "a", 2552);
+ public Address Address = new("akka", "sys", "a", 2552);
+ public Address Node = new("akka", "sys", "a", 2552);
private Reachability CreateReachabilityOfSize(Reachability baseReachability, int size)
{
diff --git a/src/benchmark/Akka.Benchmarks/Configurations/Configs.cs b/src/benchmark/Akka.Benchmarks/Configurations/Configs.cs
index 4217cdefcf3..d07c6833556 100644
--- a/src/benchmark/Akka.Benchmarks/Configurations/Configs.cs
+++ b/src/benchmark/Akka.Benchmarks/Configurations/Configs.cs
@@ -5,13 +5,48 @@
//
//-----------------------------------------------------------------------
+using System.Reflection;
+using BenchmarkDotNet.Attributes;
+using BenchmarkDotNet.Columns;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Diagnosers;
using BenchmarkDotNet.Exporters;
using BenchmarkDotNet.Loggers;
+using BenchmarkDotNet.Reports;
+using BenchmarkDotNet.Running;
namespace Akka.Benchmarks.Configurations
{
+ public class RequestsPerSecondColumn : IColumn
+ {
+ public string Id => nameof(RequestsPerSecondColumn);
+ public string ColumnName => "Req/sec";
+
+ public bool IsDefault(Summary summary, BenchmarkCase benchmarkCase) => false;
+ public string GetValue(Summary summary, BenchmarkCase benchmarkCase) => GetValue(summary, benchmarkCase, null);
+ public bool IsAvailable(Summary summary) => true;
+ public bool AlwaysShow => true;
+ public ColumnCategory Category => ColumnCategory.Custom;
+ public int PriorityInCategory => -1;
+ public bool IsNumeric => true;
+ public UnitType UnitType => UnitType.Dimensionless;
+ public string Legend => "Requests per Second";
+
+ public string GetValue(Summary summary, BenchmarkCase benchmarkCase, SummaryStyle style)
+ {
+ var benchmarkAttribute = benchmarkCase.Descriptor.WorkloadMethod.GetCustomAttribute();
+ var totalOperations = benchmarkAttribute?.OperationsPerInvoke ?? 1;
+
+ var report = summary[benchmarkCase];
+ var nsPerOperation = report.ResultStatistics.Mean;
+ var operationsPerSecond = 1 / (nsPerOperation / 1e9);
+
+
+ return operationsPerSecond.ToString("N2"); // or format as you like
+ }
+ }
+
+
///
/// Basic BenchmarkDotNet configuration used for microbenchmarks.
///
@@ -19,8 +54,8 @@ public class MicroBenchmarkConfig : ManualConfig
{
public MicroBenchmarkConfig()
{
- this.Add(MemoryDiagnoser.Default);
- this.Add(MarkdownExporter.GitHub);
+ AddDiagnoser(MemoryDiagnoser.Default);
+ AddExporter(MarkdownExporter.GitHub);
AddLogger(ConsoleLogger.Default);
}
}
@@ -32,7 +67,8 @@ public class MonitoringConfig : ManualConfig
{
public MonitoringConfig()
{
- this.Add(MarkdownExporter.GitHub);
+ AddExporter(MarkdownExporter.GitHub);
+ AddColumn(new RequestsPerSecondColumn());
}
}
}
diff --git a/src/benchmark/Akka.Benchmarks/IO/TcpOperationsBenchmarks.cs b/src/benchmark/Akka.Benchmarks/IO/TcpOperationsBenchmarks.cs
index 162b6b217e7..143f94715a4 100644
--- a/src/benchmark/Akka.Benchmarks/IO/TcpOperationsBenchmarks.cs
+++ b/src/benchmark/Akka.Benchmarks/IO/TcpOperationsBenchmarks.cs
@@ -23,7 +23,7 @@
namespace Akka.Benchmarks
{
[Config(typeof(MicroBenchmarkConfig))]
- [SimpleJob(warmupCount: 1, invocationCount: 1, launchCount: 1, runStrategy: RunStrategy.Monitoring, targetCount: 100)]
+ [SimpleJob(warmupCount: 1, invocationCount: 1, launchCount: 1, runStrategy: RunStrategy.Monitoring)]
public class TcpOperationsBenchmarks
{
private ActorSystem _system;
@@ -104,7 +104,7 @@ public EchoConnection(IActorRef connection)
private class ClientCoordinator : ReceiveActor
{
- private readonly HashSet _waitingChildren = new HashSet();
+ private readonly HashSet _waitingChildren = new();
private IActorRef _requester;
public ClientCoordinator(string host, int port, int clientsCount)
diff --git a/src/benchmark/Akka.Benchmarks/Remoting/AkkaPduCodecBenchmark.cs b/src/benchmark/Akka.Benchmarks/Remoting/AkkaPduCodecBenchmark.cs
index 7074e8568ec..30d4495b2ca 100644
--- a/src/benchmark/Akka.Benchmarks/Remoting/AkkaPduCodecBenchmark.cs
+++ b/src/benchmark/Akka.Benchmarks/Remoting/AkkaPduCodecBenchmark.cs
@@ -48,7 +48,7 @@ public class AkkaPduCodecBenchmark
///
private readonly object _message = "foobar";
- private readonly Ack _lastAck = new Ack(-1);
+ private readonly Ack _lastAck = new(-1);
private ByteString _fullDecode;
private ByteString _pduDecoded;
diff --git a/src/benchmark/Akka.Cluster.Benchmarks/Persistence/JournalWriteBenchmarks.cs b/src/benchmark/Akka.Cluster.Benchmarks/Persistence/JournalWriteBenchmarks.cs
index 8cc94d90291..4b1bfd12f81 100644
--- a/src/benchmark/Akka.Cluster.Benchmarks/Persistence/JournalWriteBenchmarks.cs
+++ b/src/benchmark/Akka.Cluster.Benchmarks/Persistence/JournalWriteBenchmarks.cs
@@ -20,7 +20,7 @@ namespace Akka.Cluster.Benchmarks.Persistence
[Config(typeof(MicroBenchmarkConfig))]
public class JournalWriteBenchmarks
{
- private static readonly Store Message = new Store(1);
+ private static readonly Store Message = new(1);
[Params(1, 10, 100)] public int PersistentActors;
diff --git a/src/benchmark/Akka.Cluster.Benchmarks/Persistence/PersistenceInfrastructure.cs b/src/benchmark/Akka.Cluster.Benchmarks/Persistence/PersistenceInfrastructure.cs
index bd419a03945..bd68f3a2f2d 100644
--- a/src/benchmark/Akka.Cluster.Benchmarks/Persistence/PersistenceInfrastructure.cs
+++ b/src/benchmark/Akka.Cluster.Benchmarks/Persistence/PersistenceInfrastructure.cs
@@ -17,19 +17,19 @@ namespace Akka.Cluster.Benchmarks.Persistence
{
public sealed class Init
{
- public static readonly Init Instance = new Init();
+ public static readonly Init Instance = new();
private Init() { }
}
public sealed class Finish
{
- public static readonly Finish Instance = new Finish();
+ public static readonly Finish Instance = new();
private Finish() { }
}
public sealed class Done
{
- public static readonly Done Instance = new Done();
+ public static readonly Done Instance = new();
private Done() { }
}
@@ -45,7 +45,7 @@ public Finished(long state)
public sealed class RecoveryFinished
{
- public static readonly RecoveryFinished Instance = new RecoveryFinished();
+ public static readonly RecoveryFinished Instance = new();
private RecoveryFinished() { }
}
@@ -75,7 +75,7 @@ public Stored(int value)
///
public sealed class IsFinished
{
- public static readonly IsFinished Instance = new IsFinished();
+ public static readonly IsFinished Instance = new();
private IsFinished(){}
}
@@ -170,7 +170,7 @@ protected override bool ReceiveCommand(object message){
public static class PersistenceInfrastructure{
- public static readonly AtomicCounter DbCounter = new AtomicCounter(0);
+ public static readonly AtomicCounter DbCounter = new(0);
public static Config GenerateJournalConfig(){
var config = ConfigurationFactory.ParseString(@"
diff --git a/src/benchmark/Akka.Cluster.Benchmarks/Sharding/HashCodeMessageExtractorBenchmarks.cs b/src/benchmark/Akka.Cluster.Benchmarks/Sharding/HashCodeMessageExtractorBenchmarks.cs
index 83c47eaac13..f3ab2238a15 100644
--- a/src/benchmark/Akka.Cluster.Benchmarks/Sharding/HashCodeMessageExtractorBenchmarks.cs
+++ b/src/benchmark/Akka.Cluster.Benchmarks/Sharding/HashCodeMessageExtractorBenchmarks.cs
@@ -14,8 +14,8 @@ namespace Akka.Cluster.Benchmarks.Sharding
[Config(typeof(MicroBenchmarkConfig))]
public class HashCodeMessageExtractorBenchmarks
{
- private ShardingEnvelope _m1 = new ShardingEnvelope("foo", 1);
- private ShardedMessage _m2 = new ShardedMessage("foo", 1);
+ private ShardingEnvelope _m1 = new("foo", 1);
+ private ShardedMessage _m2 = new("foo", 1);
private IMessageExtractor _extractor = new ShardMessageExtractor();
[Benchmark]
diff --git a/src/benchmark/Akka.Cluster.Benchmarks/Sharding/ShardSpawnBenchmarks.cs b/src/benchmark/Akka.Cluster.Benchmarks/Sharding/ShardSpawnBenchmarks.cs
index 11cf04057f2..8c5c6c00fb0 100644
--- a/src/benchmark/Akka.Cluster.Benchmarks/Sharding/ShardSpawnBenchmarks.cs
+++ b/src/benchmark/Akka.Cluster.Benchmarks/Sharding/ShardSpawnBenchmarks.cs
@@ -16,7 +16,7 @@
namespace Akka.Cluster.Benchmarks.Sharding
{
[Config(typeof(MonitoringConfig))]
- [SimpleJob(RunStrategy.ColdStart, targetCount:1, warmupCount:0, launchCount:5)]
+ [SimpleJob(RunStrategy.ColdStart, warmupCount:0, launchCount:5)]
public class ShardSpawnBenchmarks
{
[Params(StateStoreMode.Persistence, StateStoreMode.DData)]
diff --git a/src/benchmark/Akka.Cluster.Benchmarks/Sharding/ShardingInfrastructure.cs b/src/benchmark/Akka.Cluster.Benchmarks/Sharding/ShardingInfrastructure.cs
index 65dcd14a257..e3a2b89a907 100644
--- a/src/benchmark/Akka.Cluster.Benchmarks/Sharding/ShardingInfrastructure.cs
+++ b/src/benchmark/Akka.Cluster.Benchmarks/Sharding/ShardingInfrastructure.cs
@@ -17,7 +17,7 @@ public sealed class ShardedEntityActor : ReceiveActor
{
public sealed class Resolve
{
- public static readonly Resolve Instance = new Resolve();
+ public static readonly Resolve Instance = new();
private Resolve(){}
}
@@ -211,7 +211,7 @@ public override string EntityId(object message)
public static class ShardingHelper
{
- public static AtomicCounter DbId = new AtomicCounter(0);
+ public static AtomicCounter DbId = new(0);
internal static string BoolToToggle(bool val)
{
diff --git a/src/benchmark/Akka.Cluster.Cpu.Benchmark/Program.cs b/src/benchmark/Akka.Cluster.Cpu.Benchmark/Program.cs
index 01a93c582be..d05294cc41b 100644
--- a/src/benchmark/Akka.Cluster.Cpu.Benchmark/Program.cs
+++ b/src/benchmark/Akka.Cluster.Cpu.Benchmark/Program.cs
@@ -27,8 +27,8 @@ public static class Program
private const int DefaultWarmUpRepeat = 5;
- private static readonly List Usages = new List();
- private static readonly List Processes = new List();
+ private static readonly List Usages = new();
+ private static readonly List Processes = new();
public static async Task Main(string[] args)
{
diff --git a/src/benchmark/RemotePingPong/Program.cs b/src/benchmark/RemotePingPong/Program.cs
index e0fa5ef072a..72959bb2f1a 100644
--- a/src/benchmark/RemotePingPong/Program.cs
+++ b/src/benchmark/RemotePingPong/Program.cs
@@ -228,7 +228,7 @@ private class AllStartedActor : UntypedActor
{
public class AllStarted { }
- private readonly HashSet _actors = new HashSet();
+ private readonly HashSet _actors = new();
private int _correlationId = 0;
protected override void OnReceive(object message)
diff --git a/src/benchmark/SerializationBenchmarks/Program.cs b/src/benchmark/SerializationBenchmarks/Program.cs
index 57d0c302a53..945f9478612 100644
--- a/src/benchmark/SerializationBenchmarks/Program.cs
+++ b/src/benchmark/SerializationBenchmarks/Program.cs
@@ -55,7 +55,7 @@ public JsonSerializerTests()
_poolSer =
_sys_pool.Serialization.FindSerializerForType(typeof(object));
}
- private static TestSer testObj = new TestSer()
+ private static TestSer testObj = new()
{
Id = 124,
someStr =
@@ -123,8 +123,7 @@ public SerializationTests()
_ser = _sys.Serialization.FindSerializerForType(typeof(MyType));
}
- public static MyType payload =>
- new MyType() { SomeInt = 1, SomeStr = "lol" };
+ public static MyType payload => new() { SomeInt = 1, SomeStr = "lol" };
[Benchmark]
public void Serialization_WithTransport_NoState()
{
diff --git a/src/benchmark/SerializationBenchmarks/SerializationBenchmarks.csproj b/src/benchmark/SerializationBenchmarks/SerializationBenchmarks.csproj
index beaa1e87a10..4cd0037dc2b 100644
--- a/src/benchmark/SerializationBenchmarks/SerializationBenchmarks.csproj
+++ b/src/benchmark/SerializationBenchmarks/SerializationBenchmarks.csproj
@@ -6,7 +6,7 @@
-
+
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 37bbbaf8418..4608a4eb6fe 100644
--- a/src/contrib/cluster/Akka.Cluster.Metrics.Tests.MultiNode/ClustetMetricsRoutingSpec.cs
+++ b/src/contrib/cluster/Akka.Cluster.Metrics.Tests.MultiNode/ClustetMetricsRoutingSpec.cs
@@ -33,7 +33,7 @@ public class AdaptiveLoadBalancingRouterConfig : MultiNodeConfig
public sealed class AllocateMemory
{
private AllocateMemory() { }
- public static readonly AllocateMemory Instance = new AllocateMemory();
+ public static readonly AllocateMemory Instance = new();
}
[Serializable]
diff --git a/src/contrib/cluster/Akka.Cluster.Metrics.Tests/MetricSpec.cs b/src/contrib/cluster/Akka.Cluster.Metrics.Tests/MetricSpec.cs
index d62336a4360..8c3664bb31e 100644
--- a/src/contrib/cluster/Akka.Cluster.Metrics.Tests/MetricSpec.cs
+++ b/src/contrib/cluster/Akka.Cluster.Metrics.Tests/MetricSpec.cs
@@ -74,16 +74,16 @@ public class NodeMetricSpec
[Fact]
public void NodeMetrics_Should_return_correct_result_for_2_same_nodes()
{
- new NodeMetrics(_node1, 0, new NodeMetrics.Types.Metric[0])
- .SameAs(new NodeMetrics(_node1, 0, new NodeMetrics.Types.Metric[0]))
+ new NodeMetrics(_node1, 0, Array.Empty())
+ .SameAs(new NodeMetrics(_node1, 0, Array.Empty()))
.Should().BeTrue();
}
[Fact]
public void NodeMetrics_Should_return_correct_result_for_2_not_same_nodes()
{
- new NodeMetrics(_node1, 0, new NodeMetrics.Types.Metric[0])
- .SameAs(new NodeMetrics(_node2, 0, new NodeMetrics.Types.Metric[0]))
+ new NodeMetrics(_node1, 0, Array.Empty())
+ .SameAs(new NodeMetrics(_node2, 0, Array.Empty()))
.Should().BeFalse();
}
diff --git a/src/contrib/cluster/Akka.Cluster.Metrics/ClusterMetricsCollector.cs b/src/contrib/cluster/Akka.Cluster.Metrics/ClusterMetricsCollector.cs
index 5e943e3acdf..641e1cfa02b 100644
--- a/src/contrib/cluster/Akka.Cluster.Metrics/ClusterMetricsCollector.cs
+++ b/src/contrib/cluster/Akka.Cluster.Metrics/ClusterMetricsCollector.cs
@@ -39,7 +39,7 @@ public class ClusterMetricsCollector : ActorBase
sealed class MetricsTick
{
private MetricsTick() { }
- public static readonly MetricsTick Instance = new MetricsTick();
+ public static readonly MetricsTick Instance = new();
}
///
@@ -48,7 +48,7 @@ private MetricsTick() { }
sealed class GossipTick
{
private GossipTick() { }
- public static readonly GossipTick Instance = new GossipTick();
+ public static readonly GossipTick Instance = new();
}
///
diff --git a/src/contrib/cluster/Akka.Cluster.Metrics/ClusterMetricsSupervisor.cs b/src/contrib/cluster/Akka.Cluster.Metrics/ClusterMetricsSupervisor.cs
index 199fa18a12a..1c78365c05a 100644
--- a/src/contrib/cluster/Akka.Cluster.Metrics/ClusterMetricsSupervisor.cs
+++ b/src/contrib/cluster/Akka.Cluster.Metrics/ClusterMetricsSupervisor.cs
@@ -95,7 +95,7 @@ private CollectionStartMessage(){ }
///
/// Singleton instance for
///
- public static readonly CollectionStartMessage Instance = new CollectionStartMessage();
+ public static readonly CollectionStartMessage Instance = new();
}
///
@@ -107,7 +107,7 @@ private CollectionStopMessage(){ }
///
/// Singleton instance for
///
- public static readonly CollectionStopMessage Instance = new CollectionStopMessage();
+ public static readonly CollectionStopMessage Instance = new();
}
}
}
diff --git a/src/contrib/cluster/Akka.Cluster.Metrics/Collectors/DefaultCollector.cs b/src/contrib/cluster/Akka.Cluster.Metrics/Collectors/DefaultCollector.cs
index 1ae64cc9587..72fe204173b 100644
--- a/src/contrib/cluster/Akka.Cluster.Metrics/Collectors/DefaultCollector.cs
+++ b/src/contrib/cluster/Akka.Cluster.Metrics/Collectors/DefaultCollector.cs
@@ -56,25 +56,37 @@ public NodeMetrics Sample()
using (var process = Process.GetCurrentProcess())
{
process.Refresh();
- var metrics = new List()
- {
- // Memory
- NodeMetrics.Types.Metric.Create(StandardMetrics.MemoryUsed, GC.GetTotalMemory(true)).Value,
+ var metrics = new List();
+
+ var totalMemory = NodeMetrics.Types.Metric.Create(StandardMetrics.MemoryUsed, GC.GetTotalMemory(true));
+ if(totalMemory.HasValue)
+ metrics.Add(totalMemory.Value);
- // total committed process memory = working set + paged
- NodeMetrics.Types.Metric.Create(StandardMetrics.MemoryAvailable, process.WorkingSet64 + process.PagedMemorySize64).Value,
- // CPU Processors
- NodeMetrics.Types.Metric.Create(StandardMetrics.Processors, Environment.ProcessorCount).Value,
- };
+ var availableMemory = NodeMetrics.Types.Metric.Create(StandardMetrics.MemoryAvailable, process.WorkingSet64 + process.PagedMemorySize64);
+ if(availableMemory.HasValue)
+ metrics.Add(availableMemory.Value);
+
+ var processorCount = NodeMetrics.Types.Metric.Create(StandardMetrics.Processors, Environment.ProcessorCount);
+ if(processorCount.HasValue)
+ metrics.Add(processorCount.Value);
if (process.MaxWorkingSet != IntPtr.Zero)
- metrics.Add(NodeMetrics.Types.Metric.Create(StandardMetrics.MaxMemoryRecommended, process.MaxWorkingSet.ToInt64()).Value);
+ {
+ var workingSet = NodeMetrics.Types.Metric.Create(StandardMetrics.MaxMemoryRecommended, process.MaxWorkingSet.ToInt64());
+ if(workingSet.HasValue)
+ metrics.Add(workingSet.Value);
+ }
var (processCpuUsage, totalCpuUsage) = GetCpuUsages(process.Id);
+
// CPU % by process
- metrics.Add(NodeMetrics.Types.Metric.Create(StandardMetrics.CpuProcessUsage, processCpuUsage).Value);
+ var cpuUsage = NodeMetrics.Types.Metric.Create(StandardMetrics.CpuProcessUsage, processCpuUsage);
+ if(cpuUsage.HasValue)
+ metrics.Add(cpuUsage.Value);
+
// CPU % by all processes that are used for overall CPU capacity calculation
- metrics.Add(NodeMetrics.Types.Metric.Create(StandardMetrics.CpuTotalUsage, totalCpuUsage).Value);
+ var totalCpu = NodeMetrics.Types.Metric.Create(StandardMetrics.CpuTotalUsage, totalCpuUsage);
+ metrics.Add(totalCpu.Value);
return new NodeMetrics(_address, DateTime.UtcNow.ToTimestamp(), metrics);
}
diff --git a/src/contrib/cluster/Akka.Cluster.Metrics/DateTimeExtensions.cs b/src/contrib/cluster/Akka.Cluster.Metrics/DateTimeExtensions.cs
index 64a6e6511e0..1710c985f23 100644
--- a/src/contrib/cluster/Akka.Cluster.Metrics/DateTimeExtensions.cs
+++ b/src/contrib/cluster/Akka.Cluster.Metrics/DateTimeExtensions.cs
@@ -14,7 +14,7 @@ namespace Akka.Cluster.Metrics
///
internal static class DateTimeExtensions
{
- private static readonly DateTime UnixOffset = new DateTime(1970, 1, 1);
+ private static readonly DateTime UnixOffset = new(1970, 1, 1);
///
/// Converts given date and time to UNIX Timestamp - number of milliseconds elapsed since 1 Jan 1970
diff --git a/src/contrib/cluster/Akka.Cluster.Metrics/Routing/MetricSelectors.cs b/src/contrib/cluster/Akka.Cluster.Metrics/Routing/MetricSelectors.cs
index c75b15d4495..80525eba199 100644
--- a/src/contrib/cluster/Akka.Cluster.Metrics/Routing/MetricSelectors.cs
+++ b/src/contrib/cluster/Akka.Cluster.Metrics/Routing/MetricSelectors.cs
@@ -100,8 +100,8 @@ public class MemoryMetricsSelector : CapacityMetricsSelector
///
/// Singleton instance
///
- public static readonly MemoryMetricsSelector Instance = new MemoryMetricsSelector();
-
+ public static readonly MemoryMetricsSelector Instance = new();
+
///
public override IImmutableDictionary Capacity(IImmutableSet nodeMetrics)
{
@@ -130,7 +130,7 @@ public class CpuMetricsSelector : CapacityMetricsSelector
///
/// Singleton instance
///
- public static readonly CpuMetricsSelector Instance = new CpuMetricsSelector();
+ public static readonly CpuMetricsSelector Instance = new();
public CpuMetricsSelector()
{
@@ -198,7 +198,7 @@ public MixMetricsSelector(ImmutableArray selectors) : b
/// Singleton instance of the default MixMetricsSelector, which uses and
///
///
- public static readonly MixMetricsSelector Instance = new MixMetricsSelector(
+ public static readonly MixMetricsSelector Instance = new(
ImmutableArray.Create(
MemoryMetricsSelector.Instance,
CpuMetricsSelector.Instance)
diff --git a/src/contrib/cluster/Akka.Cluster.Metrics/Serialization/ClusterMetricsMessageSerializer.cs b/src/contrib/cluster/Akka.Cluster.Metrics/Serialization/ClusterMetricsMessageSerializer.cs
index eeb7ed8d1c2..4d7f0a0ffd0 100644
--- a/src/contrib/cluster/Akka.Cluster.Metrics/Serialization/ClusterMetricsMessageSerializer.cs
+++ b/src/contrib/cluster/Akka.Cluster.Metrics/Serialization/ClusterMetricsMessageSerializer.cs
@@ -54,8 +54,8 @@ public override byte[] ToBinary(object obj)
case MetricsGossipEnvelope m: return Compress(MetricsGossipEnvelopeToProto(m)); // TODO: Add compression here
case Metrics.AdaptiveLoadBalancingPool alb: return AdaptiveLoadBalancingPoolToBinary(alb);
case Metrics.MixMetricsSelector mms: return MixMetricsSelectorToBinary(mms);
- case CpuMetricsSelector _: return new byte[0];
- case MemoryMetricsSelector _: return new byte[0];
+ case CpuMetricsSelector _: return Array.Empty();
+ case MemoryMetricsSelector _: return Array.Empty();
default:
throw new ArgumentException($"Can't serialize object of type ${obj.GetType().Name} in [${GetType().Name}]");
}
diff --git a/src/contrib/cluster/Akka.Cluster.Metrics/Serialization/MetricsGossip.cs b/src/contrib/cluster/Akka.Cluster.Metrics/Serialization/MetricsGossip.cs
index 62503a56b14..05d77f94290 100644
--- a/src/contrib/cluster/Akka.Cluster.Metrics/Serialization/MetricsGossip.cs
+++ b/src/contrib/cluster/Akka.Cluster.Metrics/Serialization/MetricsGossip.cs
@@ -28,7 +28,7 @@ public sealed partial class MetricsGossip
///
/// Empty metrics gossip
///
- public static readonly MetricsGossip Empty = new MetricsGossip(ImmutableHashSet.Empty);
+ public static readonly MetricsGossip Empty = new(ImmutableHashSet.Empty);
public MetricsGossip(IImmutableSet nodes)
{
diff --git a/src/contrib/cluster/Akka.Cluster.Sharding.Tests.MultiNode/AsyncWriteProxyEx.cs b/src/contrib/cluster/Akka.Cluster.Sharding.Tests.MultiNode/AsyncWriteProxyEx.cs
index f5b9a9d43bd..ad116da7d1d 100644
--- a/src/contrib/cluster/Akka.Cluster.Sharding.Tests.MultiNode/AsyncWriteProxyEx.cs
+++ b/src/contrib/cluster/Akka.Cluster.Sharding.Tests.MultiNode/AsyncWriteProxyEx.cs
@@ -86,7 +86,7 @@ public abstract class AsyncWriteProxyEx : AsyncWriteJournal, IWithUnboundedStash
{
private class InitTimeout
{
- public static readonly InitTimeout Instance = new InitTimeout();
+ public static readonly InitTimeout Instance = new();
private InitTimeout() { }
}
diff --git a/src/contrib/cluster/Akka.Cluster.Sharding.Tests.MultiNode/ClusterShardCoordinatorDowning2Spec.cs b/src/contrib/cluster/Akka.Cluster.Sharding.Tests.MultiNode/ClusterShardCoordinatorDowning2Spec.cs
index 23ec914f828..b4f292ffede 100644
--- a/src/contrib/cluster/Akka.Cluster.Sharding.Tests.MultiNode/ClusterShardCoordinatorDowning2Spec.cs
+++ b/src/contrib/cluster/Akka.Cluster.Sharding.Tests.MultiNode/ClusterShardCoordinatorDowning2Spec.cs
@@ -101,7 +101,7 @@ protected override bool Receive(object message)
internal class GetLocations
{
- public static readonly GetLocations Instance = new GetLocations();
+ public static readonly GetLocations Instance = new();
private GetLocations()
{
diff --git a/src/contrib/cluster/Akka.Cluster.Sharding.Tests.MultiNode/ClusterShardCoordinatorDowningSpec.cs b/src/contrib/cluster/Akka.Cluster.Sharding.Tests.MultiNode/ClusterShardCoordinatorDowningSpec.cs
index 435f79035f6..613a48276e6 100644
--- a/src/contrib/cluster/Akka.Cluster.Sharding.Tests.MultiNode/ClusterShardCoordinatorDowningSpec.cs
+++ b/src/contrib/cluster/Akka.Cluster.Sharding.Tests.MultiNode/ClusterShardCoordinatorDowningSpec.cs
@@ -103,7 +103,7 @@ protected override bool Receive(object message)
internal class GetLocations
{
- public static readonly GetLocations Instance = new GetLocations();
+ public static readonly GetLocations Instance = new();
private GetLocations()
{
diff --git a/src/contrib/cluster/Akka.Cluster.Sharding.Tests.MultiNode/ClusterShardingCustomShardAllocationSpec.cs b/src/contrib/cluster/Akka.Cluster.Sharding.Tests.MultiNode/ClusterShardingCustomShardAllocationSpec.cs
index 28df4633a93..9f6b858bbd2 100644
--- a/src/contrib/cluster/Akka.Cluster.Sharding.Tests.MultiNode/ClusterShardingCustomShardAllocationSpec.cs
+++ b/src/contrib/cluster/Akka.Cluster.Sharding.Tests.MultiNode/ClusterShardingCustomShardAllocationSpec.cs
@@ -70,7 +70,7 @@ public abstract class ClusterShardingCustomShardAllocationSpec : MultiNodeCluste
internal class AllocateReq
{
- public static readonly AllocateReq Instance = new AllocateReq();
+ public static readonly AllocateReq Instance = new();
private AllocateReq()
{
@@ -89,7 +89,7 @@ public UseRegion(IActorRef region)
internal class UseRegionAck
{
- public static readonly UseRegionAck Instance = new UseRegionAck();
+ public static readonly UseRegionAck Instance = new();
private UseRegionAck()
{
@@ -98,7 +98,7 @@ private UseRegionAck()
internal class RebalanceReq
{
- public static readonly RebalanceReq Instance = new RebalanceReq();
+ public static readonly RebalanceReq Instance = new();
private RebalanceReq()
{
@@ -117,7 +117,7 @@ public RebalanceShards(IImmutableSet shards)
internal class RebalanceShardsAck
{
- public static readonly RebalanceShardsAck Instance = new RebalanceShardsAck();
+ public static readonly RebalanceShardsAck Instance = new();
private RebalanceShardsAck()
{
diff --git a/src/contrib/cluster/Akka.Cluster.Sharding.Tests.MultiNode/ClusterShardingGracefulShutdownOldestSpec.cs b/src/contrib/cluster/Akka.Cluster.Sharding.Tests.MultiNode/ClusterShardingGracefulShutdownOldestSpec.cs
index 6290884ab7c..071ce064390 100644
--- a/src/contrib/cluster/Akka.Cluster.Sharding.Tests.MultiNode/ClusterShardingGracefulShutdownOldestSpec.cs
+++ b/src/contrib/cluster/Akka.Cluster.Sharding.Tests.MultiNode/ClusterShardingGracefulShutdownOldestSpec.cs
@@ -71,7 +71,7 @@ public class TerminationOrderActor : ActorBase
{
public class RegionTerminated
{
- public static RegionTerminated Instance = new RegionTerminated();
+ public static RegionTerminated Instance = new();
private RegionTerminated()
{
@@ -80,7 +80,7 @@ private RegionTerminated()
public class CoordinatorTerminated
{
- public static CoordinatorTerminated Instance = new CoordinatorTerminated();
+ public static CoordinatorTerminated Instance = new();
private CoordinatorTerminated()
{
@@ -127,7 +127,7 @@ public class SlowStopShardedEntity : ActorBase, IWithTimers
{
public class Stop
{
- public static Stop Instance = new Stop();
+ public static Stop Instance = new();
private Stop()
{
@@ -136,7 +136,7 @@ private Stop()
public class ActualStop
{
- public static ActualStop Instance = new ActualStop();
+ public static ActualStop Instance = new();
private ActualStop()
{
diff --git a/src/contrib/cluster/Akka.Cluster.Sharding.Tests.MultiNode/ClusterShardingLeavingSpec.cs b/src/contrib/cluster/Akka.Cluster.Sharding.Tests.MultiNode/ClusterShardingLeavingSpec.cs
index 220993ae5bb..e770a9abb75 100644
--- a/src/contrib/cluster/Akka.Cluster.Sharding.Tests.MultiNode/ClusterShardingLeavingSpec.cs
+++ b/src/contrib/cluster/Akka.Cluster.Sharding.Tests.MultiNode/ClusterShardingLeavingSpec.cs
@@ -93,7 +93,7 @@ public Ping(string id)
[Serializable]
internal sealed class GetLocations
{
- public static readonly GetLocations Instance = new GetLocations();
+ public static readonly GetLocations Instance = new();
private GetLocations()
{
diff --git a/src/contrib/cluster/Akka.Cluster.Sharding.Tests.MultiNode/ClusterShardingSpec.cs b/src/contrib/cluster/Akka.Cluster.Sharding.Tests.MultiNode/ClusterShardingSpec.cs
index 1e47d8d0569..6a0a004faff 100644
--- a/src/contrib/cluster/Akka.Cluster.Sharding.Tests.MultiNode/ClusterShardingSpec.cs
+++ b/src/contrib/cluster/Akka.Cluster.Sharding.Tests.MultiNode/ClusterShardingSpec.cs
@@ -160,7 +160,7 @@ public abstract class ClusterShardingSpec : MultiNodeClusterShardingSpec _log ?? (_log = Context.GetLogger());
+ private ILoggingAdapter Log => _log ??= Context.GetLogger();
protected override bool Receive(object message)
{
@@ -105,7 +105,7 @@ protected class ShardedEntity : ActorBase
{
public class Stop
{
- public static readonly Stop Instance = new Stop();
+ public static readonly Stop Instance = new();
private Stop()
{
diff --git a/src/contrib/cluster/Akka.Cluster.Sharding.Tests.MultiNode/RollingUpdateShardAllocationSpec.cs b/src/contrib/cluster/Akka.Cluster.Sharding.Tests.MultiNode/RollingUpdateShardAllocationSpec.cs
index 9e87bdb2572..e7b57c227d7 100644
--- a/src/contrib/cluster/Akka.Cluster.Sharding.Tests.MultiNode/RollingUpdateShardAllocationSpec.cs
+++ b/src/contrib/cluster/Akka.Cluster.Sharding.Tests.MultiNode/RollingUpdateShardAllocationSpec.cs
@@ -91,7 +91,7 @@ public Home(Address address)
};
private ILoggingAdapter _log;
- private ILoggingAdapter Log => _log ?? (_log = Context.GetLogger());
+ private ILoggingAdapter Log => _log ??= Context.GetLogger();
private Address SelfAddress => Cluster.Get(Context.System).SelfAddress;
diff --git a/src/contrib/cluster/Akka.Cluster.Sharding.Tests.MultiNode/ShardedDaemonProcessSpec.cs b/src/contrib/cluster/Akka.Cluster.Sharding.Tests.MultiNode/ShardedDaemonProcessSpec.cs
index 26caf0995a8..63a83b767cb 100644
--- a/src/contrib/cluster/Akka.Cluster.Sharding.Tests.MultiNode/ShardedDaemonProcessSpec.cs
+++ b/src/contrib/cluster/Akka.Cluster.Sharding.Tests.MultiNode/ShardedDaemonProcessSpec.cs
@@ -127,7 +127,7 @@ internal class ProcessActor : UntypedActor
[Serializable]
public sealed class Stop
{
- public static readonly Stop Instance = new Stop();
+ public static readonly Stop Instance = new();
private Stop() { }
}
diff --git a/src/contrib/cluster/Akka.Cluster.Sharding.Tests.MultiNode/SnapshotStoreProxy.cs b/src/contrib/cluster/Akka.Cluster.Sharding.Tests.MultiNode/SnapshotStoreProxy.cs
index 29d0f95d35e..7f9ec9c430a 100644
--- a/src/contrib/cluster/Akka.Cluster.Sharding.Tests.MultiNode/SnapshotStoreProxy.cs
+++ b/src/contrib/cluster/Akka.Cluster.Sharding.Tests.MultiNode/SnapshotStoreProxy.cs
@@ -19,7 +19,7 @@ public abstract class SnapshotStoreProxy : SnapshotStore, IWithUnboundedStash
{
private class InitTimeout
{
- public static readonly InitTimeout Instance = new InitTimeout();
+ public static readonly InitTimeout Instance = new();
private InitTimeout() { }
}
diff --git a/src/contrib/cluster/Akka.Cluster.Sharding.Tests/ClusterShardingInternalsSpec.cs b/src/contrib/cluster/Akka.Cluster.Sharding.Tests/ClusterShardingInternalsSpec.cs
index 49b93af449c..8e76b659cff 100644
--- a/src/contrib/cluster/Akka.Cluster.Sharding.Tests/ClusterShardingInternalsSpec.cs
+++ b/src/contrib/cluster/Akka.Cluster.Sharding.Tests/ClusterShardingInternalsSpec.cs
@@ -105,7 +105,7 @@ public void ClusterSharding_must_stop_entities_from_HandOffStopper_even_if_the_e
internal class HandOffStopMessage : INoSerializationVerificationNeeded
{
- public static readonly HandOffStopMessage Instance = new HandOffStopMessage();
+ public static readonly HandOffStopMessage Instance = new();
private HandOffStopMessage()
{
}
diff --git a/src/contrib/cluster/Akka.Cluster.Sharding.Tests/InactiveEntityPassivationSpec.cs b/src/contrib/cluster/Akka.Cluster.Sharding.Tests/InactiveEntityPassivationSpec.cs
index 9112c0dcdc0..8d25e762781 100644
--- a/src/contrib/cluster/Akka.Cluster.Sharding.Tests/InactiveEntityPassivationSpec.cs
+++ b/src/contrib/cluster/Akka.Cluster.Sharding.Tests/InactiveEntityPassivationSpec.cs
@@ -26,7 +26,7 @@ public abstract class AbstractInactiveEntityPassivationSpec : AkkaSpec
internal class Passivate
{
- public static readonly Passivate Instance = new Passivate();
+ public static readonly Passivate Instance = new();
private Passivate() { }
}
diff --git a/src/contrib/cluster/Akka.Cluster.Sharding.Tests/LeastShardAllocationStrategySpec.cs b/src/contrib/cluster/Akka.Cluster.Sharding.Tests/LeastShardAllocationStrategySpec.cs
index b72dd832657..c03b71b7e81 100644
--- a/src/contrib/cluster/Akka.Cluster.Sharding.Tests/LeastShardAllocationStrategySpec.cs
+++ b/src/contrib/cluster/Akka.Cluster.Sharding.Tests/LeastShardAllocationStrategySpec.cs
@@ -97,7 +97,7 @@ internal static IActorRef NewFakeRegion(string idForDebug, Member member)
///
internal sealed class ImmutableDictionaryKeepOrder : IImmutableDictionary
{
- public static readonly ImmutableDictionaryKeepOrder Empty = new ImmutableDictionaryKeepOrder(ImmutableDictionary.Empty, ImmutableList>.Empty);
+ public static readonly ImmutableDictionaryKeepOrder Empty = new(ImmutableDictionary.Empty, ImmutableList>.Empty);
private readonly ImmutableDictionary _dictionary = ImmutableDictionary.Empty;
private readonly ImmutableList> _items = ImmutableList>.Empty;
diff --git a/src/contrib/cluster/Akka.Cluster.Sharding.Tests/ProxyShardingSpec.cs b/src/contrib/cluster/Akka.Cluster.Sharding.Tests/ProxyShardingSpec.cs
index 9435cd8b37f..26bf1e5a05f 100644
--- a/src/contrib/cluster/Akka.Cluster.Sharding.Tests/ProxyShardingSpec.cs
+++ b/src/contrib/cluster/Akka.Cluster.Sharding.Tests/ProxyShardingSpec.cs
@@ -21,7 +21,7 @@ public class ProxyShardingSpec : Akka.TestKit.Xunit2.TestKit
{
ClusterSharding clusterSharding;
ClusterShardingSettings shardingSettings;
- private MessageExtractor messageExtractor = new MessageExtractor(10);
+ private MessageExtractor messageExtractor = new(10);
private class MessageExtractor : HashCodeMessageExtractor
{
diff --git a/src/contrib/cluster/Akka.Cluster.Sharding.Tests/ShardWithLeaseSpec.cs b/src/contrib/cluster/Akka.Cluster.Sharding.Tests/ShardWithLeaseSpec.cs
index d7b8407a4a7..27790a86ab9 100644
--- a/src/contrib/cluster/Akka.Cluster.Sharding.Tests/ShardWithLeaseSpec.cs
+++ b/src/contrib/cluster/Akka.Cluster.Sharding.Tests/ShardWithLeaseSpec.cs
@@ -138,7 +138,7 @@ public TestLease LeaseFor(string shardId)
private TimeSpan shortDuration = TimeSpan.FromMilliseconds(100);
private TestLeaseExt testLeaseExt;
- private static AtomicCounter typeIdx = new AtomicCounter(0);
+ private static AtomicCounter typeIdx = new(0);
public ShardWithLeaseSpec(ITestOutputHelper helper) : base(SpecConfig, helper)
{
diff --git a/src/contrib/cluster/Akka.Cluster.Sharding.Tests/ShardedDaemonProcessSpec.cs b/src/contrib/cluster/Akka.Cluster.Sharding.Tests/ShardedDaemonProcessSpec.cs
index 8432c0a2869..9aea9fb27ac 100644
--- a/src/contrib/cluster/Akka.Cluster.Sharding.Tests/ShardedDaemonProcessSpec.cs
+++ b/src/contrib/cluster/Akka.Cluster.Sharding.Tests/ShardedDaemonProcessSpec.cs
@@ -20,7 +20,7 @@ public class ShardedDaemonProcessSpec : AkkaSpec
{
private sealed class Stop
{
- public static Stop Instance { get; } = new Stop();
+ public static Stop Instance { get; } = new();
private Stop() { }
}
diff --git a/src/contrib/cluster/Akka.Cluster.Sharding.Tests/SupervisionSpec.cs b/src/contrib/cluster/Akka.Cluster.Sharding.Tests/SupervisionSpec.cs
index 9a5d59a39aa..a6df7a77953 100644
--- a/src/contrib/cluster/Akka.Cluster.Sharding.Tests/SupervisionSpec.cs
+++ b/src/contrib/cluster/Akka.Cluster.Sharding.Tests/SupervisionSpec.cs
@@ -47,7 +47,7 @@ public Response(IActorRef self)
internal class StopMessage
{
- public static readonly StopMessage Instance = new StopMessage();
+ public static readonly StopMessage Instance = new();
private StopMessage() { }
}
diff --git a/src/contrib/cluster/Akka.Cluster.Sharding/ClusterSharding.cs b/src/contrib/cluster/Akka.Cluster.Sharding/ClusterSharding.cs
index 1dda5eed1bb..c6b8e35ec77 100644
--- a/src/contrib/cluster/Akka.Cluster.Sharding/ClusterSharding.cs
+++ b/src/contrib/cluster/Akka.Cluster.Sharding/ClusterSharding.cs
@@ -269,8 +269,8 @@ public class ClusterSharding : IExtension
#pragma warning restore CS0419 // Ambiguous reference in cref attribute
{
private readonly Lazy _guardian;
- private readonly ConcurrentDictionary _regions = new ConcurrentDictionary();
- private readonly ConcurrentDictionary _proxies = new ConcurrentDictionary();
+ private readonly ConcurrentDictionary _regions = new();
+ private readonly ConcurrentDictionary _proxies = new();
private readonly ExtendedActorSystem _system;
private readonly Cluster _cluster;
diff --git a/src/contrib/cluster/Akka.Cluster.Sharding/ClusterShardingGuardian.cs b/src/contrib/cluster/Akka.Cluster.Sharding/ClusterShardingGuardian.cs
index 40b25cce83a..1f76a1818c6 100644
--- a/src/contrib/cluster/Akka.Cluster.Sharding/ClusterShardingGuardian.cs
+++ b/src/contrib/cluster/Akka.Cluster.Sharding/ClusterShardingGuardian.cs
@@ -173,7 +173,7 @@ public StartProxy(
private readonly ConcurrentDictionary _regions;
private readonly ConcurrentDictionary _proxies;
- private readonly ConcurrentDictionary _typeLookup = new ConcurrentDictionary();
+ private readonly ConcurrentDictionary _typeLookup = new();
///
/// TBD
diff --git a/src/contrib/cluster/Akka.Cluster.Sharding/ClusterShardingSettings.cs b/src/contrib/cluster/Akka.Cluster.Sharding/ClusterShardingSettings.cs
index 0df6bd78470..51827975e09 100644
--- a/src/contrib/cluster/Akka.Cluster.Sharding/ClusterShardingSettings.cs
+++ b/src/contrib/cluster/Akka.Cluster.Sharding/ClusterShardingSettings.cs
@@ -230,7 +230,7 @@ private TuningParameters Copy(
int? coordinatorStateReadMajorityPlus = null,
int? leastShardAllocationAbsoluteLimit = null,
double? leastShardAllocationRelativeLimit = null)
- => new TuningParameters(
+ => new(
coordinatorFailureBackoff: coordinatorFailureBackoff ?? CoordinatorFailureBackoff,
retryInterval: retryInterval ?? RetryInterval,
bufferSize: bufferSize ?? BufferSize,
diff --git a/src/contrib/cluster/Akka.Cluster.Sharding/DDataShardCoordinator.cs b/src/contrib/cluster/Akka.Cluster.Sharding/DDataShardCoordinator.cs
index 1393196e109..25cba4b05ff 100644
--- a/src/contrib/cluster/Akka.Cluster.Sharding/DDataShardCoordinator.cs
+++ b/src/contrib/cluster/Akka.Cluster.Sharding/DDataShardCoordinator.cs
@@ -28,7 +28,7 @@ internal sealed class DDataShardCoordinator : ActorBase, IWithTimers, IWithUnbou
private sealed class RememberEntitiesStoreStopped
{
- public static RememberEntitiesStoreStopped Instance = new RememberEntitiesStoreStopped();
+ public static RememberEntitiesStoreStopped Instance = new();
private RememberEntitiesStoreStopped()
{
@@ -47,7 +47,7 @@ public RememberEntitiesTimeout(ShardId shardId)
private sealed class RememberEntitiesLoadTimeout
{
- public static readonly RememberEntitiesLoadTimeout Instance = new RememberEntitiesLoadTimeout();
+ public static readonly RememberEntitiesLoadTimeout Instance = new();
private RememberEntitiesLoadTimeout()
{
diff --git a/src/contrib/cluster/Akka.Cluster.Sharding/External/ExternalShardAllocation.cs b/src/contrib/cluster/Akka.Cluster.Sharding/External/ExternalShardAllocation.cs
index 1ede3674a6a..5fdb60dca56 100644
--- a/src/contrib/cluster/Akka.Cluster.Sharding/External/ExternalShardAllocation.cs
+++ b/src/contrib/cluster/Akka.Cluster.Sharding/External/ExternalShardAllocation.cs
@@ -24,7 +24,7 @@ public static ExternalShardAllocation Get(ActorSystem system)
}
private readonly ExtendedActorSystem _system;
- private readonly ConcurrentDictionary _clients = new ConcurrentDictionary();
+ private readonly ConcurrentDictionary _clients = new();
public ExternalShardAllocation(ExtendedActorSystem system)
{
diff --git a/src/contrib/cluster/Akka.Cluster.Sharding/External/ExternalShardAllocationStrategy.cs b/src/contrib/cluster/Akka.Cluster.Sharding/External/ExternalShardAllocationStrategy.cs
index 4bdd42bdd8e..ccd85e1b10a 100644
--- a/src/contrib/cluster/Akka.Cluster.Sharding/External/ExternalShardAllocationStrategy.cs
+++ b/src/contrib/cluster/Akka.Cluster.Sharding/External/ExternalShardAllocationStrategy.cs
@@ -58,7 +58,7 @@ public override int GetHashCode()
public sealed class GetShardLocations : INoSerializationVerificationNeeded
{
- public static readonly GetShardLocations Instance = new GetShardLocations();
+ public static readonly GetShardLocations Instance = new();
private GetShardLocations()
{
diff --git a/src/contrib/cluster/Akka.Cluster.Sharding/Internal/AbstractLeastShardAllocationStrategy.cs b/src/contrib/cluster/Akka.Cluster.Sharding/Internal/AbstractLeastShardAllocationStrategy.cs
index 668f611ac23..432fca72093 100644
--- a/src/contrib/cluster/Akka.Cluster.Sharding/Internal/AbstractLeastShardAllocationStrategy.cs
+++ b/src/contrib/cluster/Akka.Cluster.Sharding/Internal/AbstractLeastShardAllocationStrategy.cs
@@ -41,7 +41,7 @@ public RegionEntry(IActorRef region, Member member, IImmutableList shar
internal sealed class ShardSuitabilityOrdering : IComparer
{
- public static readonly ShardSuitabilityOrdering Instance = new ShardSuitabilityOrdering();
+ public static readonly ShardSuitabilityOrdering Instance = new();
private ShardSuitabilityOrdering()
{
diff --git a/src/contrib/cluster/Akka.Cluster.Sharding/Internal/EventSourcedRememberEntitiesCoordinatorStore.cs b/src/contrib/cluster/Akka.Cluster.Sharding/Internal/EventSourcedRememberEntitiesCoordinatorStore.cs
index 6b0a6f3d20d..b8edd25380c 100644
--- a/src/contrib/cluster/Akka.Cluster.Sharding/Internal/EventSourcedRememberEntitiesCoordinatorStore.cs
+++ b/src/contrib/cluster/Akka.Cluster.Sharding/Internal/EventSourcedRememberEntitiesCoordinatorStore.cs
@@ -74,7 +74,7 @@ public override int GetHashCode()
public sealed class MigrationMarker : IClusterShardingSerializable
{
- public static readonly MigrationMarker Instance = new MigrationMarker();
+ public static readonly MigrationMarker Instance = new();
private MigrationMarker()
{
@@ -107,7 +107,7 @@ public EventSourcedRememberEntitiesCoordinatorStore(
///
public override string PersistenceId { get; }
- private readonly HashSet _shards = new HashSet();
+ private readonly HashSet _shards = new();
private bool _writtenMarker = false;
protected override bool ReceiveRecover(object message)
diff --git a/src/contrib/cluster/Akka.Cluster.Sharding/Internal/EventSourcedRememberEntitiesShardStore.cs b/src/contrib/cluster/Akka.Cluster.Sharding/Internal/EventSourcedRememberEntitiesShardStore.cs
index c61541bb32b..3f2b01e0402 100644
--- a/src/contrib/cluster/Akka.Cluster.Sharding/Internal/EventSourcedRememberEntitiesShardStore.cs
+++ b/src/contrib/cluster/Akka.Cluster.Sharding/Internal/EventSourcedRememberEntitiesShardStore.cs
@@ -120,7 +120,7 @@ public override int GetHashCode()
public sealed class StartedAck
{
- public static readonly StartedAck Instance = new StartedAck();
+ public static readonly StartedAck Instance = new();
private StartedAck()
{
@@ -179,7 +179,7 @@ public static Props Props(string typeName, ShardId shardId, ClusterShardingSetti
}
private readonly int _maxUpdatesPerWrite;
- private State _state = new State();
+ private State _state = new();
///
/// Persistent actor keeping the state for Akka Persistence backed remember entities (enabled through `state-store-mode=persistence`).
diff --git a/src/contrib/cluster/Akka.Cluster.Sharding/Internal/RememberEntitiesStore.cs b/src/contrib/cluster/Akka.Cluster.Sharding/Internal/RememberEntitiesStore.cs
index ad3ddaafdcc..3d4861c7d30 100644
--- a/src/contrib/cluster/Akka.Cluster.Sharding/Internal/RememberEntitiesStore.cs
+++ b/src/contrib/cluster/Akka.Cluster.Sharding/Internal/RememberEntitiesStore.cs
@@ -154,7 +154,7 @@ public override int GetHashCode()
public sealed class GetEntities : ICommand
{
- public static readonly GetEntities Instance = new GetEntities();
+ public static readonly GetEntities Instance = new();
private GetEntities()
{
@@ -342,7 +342,7 @@ public override int GetHashCode()
///
public sealed class GetShards : ICommand
{
- public static readonly GetShards Instance = new GetShards();
+ public static readonly GetShards Instance = new();
private GetShards()
{
diff --git a/src/contrib/cluster/Akka.Cluster.Sharding/Internal/RememberEntityStarter.cs b/src/contrib/cluster/Akka.Cluster.Sharding/Internal/RememberEntityStarter.cs
index 329cf46eaa8..485ec915c97 100644
--- a/src/contrib/cluster/Akka.Cluster.Sharding/Internal/RememberEntityStarter.cs
+++ b/src/contrib/cluster/Akka.Cluster.Sharding/Internal/RememberEntityStarter.cs
@@ -42,7 +42,7 @@ public StartBatch(int batchSize)
// private case object ResendUnAcked extends NoSerializationVerificationNeeded
private sealed class ResendUnAcked
{
- public static readonly ResendUnAcked Instance = new ResendUnAcked();
+ public static readonly ResendUnAcked Instance = new();
private ResendUnAcked()
{
diff --git a/src/contrib/cluster/Akka.Cluster.Sharding/Shard.cs b/src/contrib/cluster/Akka.Cluster.Sharding/Shard.cs
index 3418551cf34..44611eb2a3a 100644
--- a/src/contrib/cluster/Akka.Cluster.Sharding/Shard.cs
+++ b/src/contrib/cluster/Akka.Cluster.Sharding/Shard.cs
@@ -134,7 +134,7 @@ public sealed class GetCurrentShardState : IShardQuery, IClusterShardingSerializ
///
/// TBD
///
- public static readonly GetCurrentShardState Instance = new GetCurrentShardState();
+ public static readonly GetCurrentShardState Instance = new();
private GetCurrentShardState()
{
@@ -211,7 +211,7 @@ public sealed class GetShardStats : IShardQuery, IClusterShardingSerializable
///
/// TBD
///
- public static readonly GetShardStats Instance = new GetShardStats();
+ public static readonly GetShardStats Instance = new();
private GetShardStats()
{
@@ -309,7 +309,7 @@ public LeaseLost(Exception reason)
[Serializable]
public sealed class LeaseRetry : IDeadLetterSuppression, INoSerializationVerificationNeeded
{
- public static readonly LeaseRetry Instance = new LeaseRetry();
+ public static readonly LeaseRetry Instance = new();
private LeaseRetry() { }
}
@@ -340,7 +340,7 @@ public static Props Props(
[Serializable]
public sealed class PassivateIdleTick : INoSerializationVerificationNeeded
{
- public static readonly PassivateIdleTick Instance = new PassivateIdleTick();
+ public static readonly PassivateIdleTick Instance = new();
private PassivateIdleTick() { }
}
@@ -456,7 +456,7 @@ public override string ToString()
///
internal sealed class NoState : EntityState
{
- public static readonly NoState Instance = new NoState();
+ public static readonly NoState Instance = new();
private NoState()
{
@@ -488,7 +488,7 @@ public override EntityState Transition(EntityState newState, Entities entities)
///
internal sealed class RememberedButNotCreated : EntityState
{
- public static readonly RememberedButNotCreated Instance = new RememberedButNotCreated();
+ public static readonly RememberedButNotCreated Instance = new();
private RememberedButNotCreated()
{
@@ -518,7 +518,7 @@ public override EntityState Transition(EntityState newState, Entities entities)
///
internal sealed class RememberingStart : EntityState, IEquatable
{
- private static readonly RememberingStart Empty = new RememberingStart(ImmutableHashSet.Empty);
+ private static readonly RememberingStart Empty = new(ImmutableHashSet.Empty);
public static RememberingStart Create(IActorRef ackTo)
{
@@ -601,7 +601,7 @@ public override int GetHashCode()
///
internal sealed class RememberingStop : EntityState
{
- public static readonly RememberingStop Instance = new RememberingStop();
+ public static readonly RememberingStop Instance = new();
private RememberingStop()
{
@@ -705,7 +705,7 @@ public override EntityState Transition(EntityState newState, Entities entities)
internal sealed class WaitingForRestart : EntityState
{
- public static readonly WaitingForRestart Instance = new WaitingForRestart();
+ public static readonly WaitingForRestart Instance = new();
private WaitingForRestart()
{
@@ -730,11 +730,11 @@ public override EntityState Transition(EntityState newState, Entities entities)
internal sealed class Entities
{
- private readonly Dictionary _entities = new Dictionary();
+ private readonly Dictionary _entities = new();
// needed to look up entity by ref when a Passivating is received
- private readonly Dictionary _byRef = new Dictionary();
+ private readonly Dictionary _byRef = new();
// optimization to not have to go through all entities to find batched writes
- private readonly HashSet _remembering = new HashSet();
+ private readonly HashSet _remembering = new();
public Entities(
@@ -928,8 +928,8 @@ public override string ToString()
private readonly IActorRef _rememberEntitiesStore;
private readonly bool _rememberEntities;
private readonly Entities _entities;
- private readonly Dictionary _lastMessageTimestamp = new Dictionary();
- private readonly MessageBufferMap _messageBuffers = new MessageBufferMap();
+ private readonly Dictionary _lastMessageTimestamp = new();
+ private readonly MessageBufferMap _messageBuffers = new();
private IActorRef _handOffStopper;
private readonly ICancelable _passivateIdleTask;
diff --git a/src/contrib/cluster/Akka.Cluster.Sharding/ShardCoordinator.cs b/src/contrib/cluster/Akka.Cluster.Sharding/ShardCoordinator.cs
index ad078938b3b..4155c9f98d4 100644
--- a/src/contrib/cluster/Akka.Cluster.Sharding/ShardCoordinator.cs
+++ b/src/contrib/cluster/Akka.Cluster.Sharding/ShardCoordinator.cs
@@ -29,7 +29,7 @@ internal class ShardCoordinator
///
internal sealed class Terminate : IDeadLetterSuppression
{
- public static readonly Terminate Instance = new Terminate();
+ public static readonly Terminate Instance = new();
private Terminate()
{
@@ -1005,7 +1005,7 @@ public override int GetHashCode()
[Serializable]
public sealed class ShardCoordinatorInitialized : IDomainEvent, IEquatable
{
- public static readonly ShardCoordinatorInitialized Instance = new ShardCoordinatorInitialized();
+ public static readonly ShardCoordinatorInitialized Instance = new();
private ShardCoordinatorInitialized()
{
@@ -1047,7 +1047,7 @@ internal sealed class StateInitialized
///
/// TBD
///
- public static readonly StateInitialized Instance = new StateInitialized();
+ public static readonly StateInitialized Instance = new();
private StateInitialized() { }
}
@@ -1062,7 +1062,7 @@ internal sealed class CoordinatorState : IClusterShardingSerializable, IEquatabl
///
/// TBD
///
- public static readonly CoordinatorState Empty = new CoordinatorState();
+ public static readonly CoordinatorState Empty = new();
///
/// Region for each shard.
@@ -1301,7 +1301,7 @@ private sealed class RebalanceTick
///
/// TBD
///
- public static readonly RebalanceTick Instance = new RebalanceTick();
+ public static readonly RebalanceTick Instance = new();
private RebalanceTick() { }
}
@@ -1488,7 +1488,7 @@ public static Props Props(
private readonly bool _isRebalance;
private ILoggingAdapter _log;
- private ILoggingAdapter Log { get { return _log ?? (_log = Context.GetLogger()); } }
+ private ILoggingAdapter Log { get { return _log ??= Context.GetLogger(); } }
public ITimerScheduler Timers { get; set; }
diff --git a/src/contrib/cluster/Akka.Cluster.Sharding/ShardRegion.cs b/src/contrib/cluster/Akka.Cluster.Sharding/ShardRegion.cs
index 98011c610ea..9540cf03e45 100644
--- a/src/contrib/cluster/Akka.Cluster.Sharding/ShardRegion.cs
+++ b/src/contrib/cluster/Akka.Cluster.Sharding/ShardRegion.cs
@@ -44,7 +44,7 @@ internal sealed class Retry : IShardRegionCommand, INoSerializationVerificationN
///
/// TBD
///
- public static readonly Retry Instance = new Retry();
+ public static readonly Retry Instance = new();
private Retry() { }
}
@@ -65,7 +65,7 @@ internal sealed class RegisterRetry : IShardRegionCommand
///
/// TBD
///
- public static readonly RegisterRetry Instance = new RegisterRetry();
+ public static readonly RegisterRetry Instance = new();
private RegisterRetry() { }
}
@@ -214,7 +214,7 @@ internal class HandOffStopper : ReceiveActor, IWithTimers
{
private sealed class StopTimeout
{
- public static readonly StopTimeout Instance = new StopTimeout();
+ public static readonly StopTimeout Instance = new();
private StopTimeout()
{
@@ -223,7 +223,7 @@ private StopTimeout()
private sealed class StopTimeoutWarning
{
- public static readonly StopTimeoutWarning Instance = new StopTimeoutWarning();
+ public static readonly StopTimeoutWarning Instance = new();
private StopTimeoutWarning()
{
@@ -408,7 +408,7 @@ internal static Props ProxyProps(
private IImmutableDictionary> _regions = ImmutableDictionary>.Empty;
private IImmutableDictionary _regionByShard = ImmutableDictionary.Empty;
- private readonly MessageBufferMap _shardBuffers = new MessageBufferMap();
+ private readonly MessageBufferMap _shardBuffers = new();
private IImmutableDictionary _shards = ImmutableDictionary.Empty;
private IImmutableDictionary _shardsByRef = ImmutableDictionary.Empty;
private IImmutableSet _startingShards = ImmutableHashSet.Empty;
@@ -424,7 +424,7 @@ internal static Props ProxyProps(
private bool _gracefulShutdownInProgress;
private readonly CoordinatedShutdown _coordShutdown = CoordinatedShutdown.Get(Context.System);
- private readonly TaskCompletionSource _gracefulShutdownProgress = new TaskCompletionSource();
+ private readonly TaskCompletionSource _gracefulShutdownProgress = new();
///
/// TBD
diff --git a/src/contrib/cluster/Akka.Cluster.Sharding/ShardedDaemonProcess.cs b/src/contrib/cluster/Akka.Cluster.Sharding/ShardedDaemonProcess.cs
index fc3fcfc5549..0de178d708c 100644
--- a/src/contrib/cluster/Akka.Cluster.Sharding/ShardedDaemonProcess.cs
+++ b/src/contrib/cluster/Akka.Cluster.Sharding/ShardedDaemonProcess.cs
@@ -18,7 +18,7 @@ internal class KeepAlivePinger : UntypedActor, IWithTimers
{
private sealed class Tick
{
- public static Tick Instance { get; } = new Tick();
+ public static Tick Instance { get; } = new();
private Tick() { }
}
@@ -170,6 +170,6 @@ public void Init(string name, int numberOfInstances, Func propsFacto
public class ShardedDaemonProcessExtensionProvider : ExtensionIdProvider
{
- public override ShardedDaemonProcess CreateExtension(ExtendedActorSystem system) => new ShardedDaemonProcess(system);
+ public override ShardedDaemonProcess CreateExtension(ExtendedActorSystem system) => new(system);
}
}
diff --git a/src/contrib/cluster/Akka.Cluster.Sharding/ShardingMessages.cs b/src/contrib/cluster/Akka.Cluster.Sharding/ShardingMessages.cs
index 0cf2bd2b857..a95d8094758 100644
--- a/src/contrib/cluster/Akka.Cluster.Sharding/ShardingMessages.cs
+++ b/src/contrib/cluster/Akka.Cluster.Sharding/ShardingMessages.cs
@@ -72,7 +72,7 @@ public sealed class GracefulShutdown : IShardRegionCommand
///
/// TBD
///
- public static readonly GracefulShutdown Instance = new GracefulShutdown();
+ public static readonly GracefulShutdown Instance = new();
private GracefulShutdown()
{
@@ -85,7 +85,7 @@ internal sealed class GracefulShutdownTimeout : IShardRegionCommand
///
/// TBD
///
- public static readonly GracefulShutdownTimeout Instance = new GracefulShutdownTimeout();
+ public static readonly GracefulShutdownTimeout Instance = new();
private GracefulShutdownTimeout()
{
@@ -151,7 +151,7 @@ public sealed class GetCurrentRegions : IShardRegionQuery, IClusterShardingSeria
///
/// TBD
///
- public static readonly GetCurrentRegions Instance = new GetCurrentRegions();
+ public static readonly GetCurrentRegions Instance = new();
private GetCurrentRegions()
{
@@ -399,7 +399,7 @@ public sealed class GetShardRegionStats : IShardRegionQuery, IClusterShardingSer
///
/// TBD
///
- public static readonly GetShardRegionStats Instance = new GetShardRegionStats();
+ public static readonly GetShardRegionStats Instance = new();
private GetShardRegionStats()
{
@@ -493,7 +493,7 @@ public sealed class GetShardRegionState : IShardRegionQuery, IClusterShardingSer
///
/// TBD
///
- public static readonly GetShardRegionState Instance = new GetShardRegionState();
+ public static readonly GetShardRegionState Instance = new();
private GetShardRegionState()
{
@@ -644,7 +644,7 @@ public override string ToString()
///
internal sealed class GetShardRegionStatus : IShardRegionQuery, INoSerializationVerificationNeeded
{
- public static readonly GetShardRegionStatus Instance = new GetShardRegionStatus();
+ public static readonly GetShardRegionStatus Instance = new();
private GetShardRegionStatus()
{
diff --git a/src/contrib/cluster/Akka.Cluster.Tools.Tests.MultiNode/ClusterClient/ClusterClientSpec.cs b/src/contrib/cluster/Akka.Cluster.Tools.Tests.MultiNode/ClusterClient/ClusterClientSpec.cs
index 3498962cd05..0599542346b 100644
--- a/src/contrib/cluster/Akka.Cluster.Tools.Tests.MultiNode/ClusterClient/ClusterClientSpec.cs
+++ b/src/contrib/cluster/Akka.Cluster.Tools.Tests.MultiNode/ClusterClient/ClusterClientSpec.cs
@@ -109,7 +109,7 @@ public class TestClientListener : ReceiveActor
#region TestClientListener messages
public sealed class GetLatestContactPoints
{
- public static readonly GetLatestContactPoints Instance = new GetLatestContactPoints();
+ public static readonly GetLatestContactPoints Instance = new();
private GetLatestContactPoints() { }
}
@@ -168,7 +168,7 @@ public class TestReceptionistListener : ReceiveActor
#region TestReceptionistListener messages
public sealed class GetLatestClusterClients
{
- public static readonly GetLatestClusterClients Instance = new GetLatestClusterClients();
+ public static readonly GetLatestClusterClients Instance = new();
private GetLatestClusterClients() { }
}
diff --git a/src/contrib/cluster/Akka.Cluster.Tools.Tests.MultiNode/PublishSubscribe/DistributedPubSubMediatorSpec.cs b/src/contrib/cluster/Akka.Cluster.Tools.Tests.MultiNode/PublishSubscribe/DistributedPubSubMediatorSpec.cs
index 8d47ebe0eff..95d060501d8 100644
--- a/src/contrib/cluster/Akka.Cluster.Tools.Tests.MultiNode/PublishSubscribe/DistributedPubSubMediatorSpec.cs
+++ b/src/contrib/cluster/Akka.Cluster.Tools.Tests.MultiNode/PublishSubscribe/DistributedPubSubMediatorSpec.cs
@@ -238,7 +238,7 @@ protected override void OnReceive(object message)
private readonly RoleName _second;
private readonly RoleName _third;
- private readonly ConcurrentDictionary _chatUsers = new ConcurrentDictionary();
+ private readonly ConcurrentDictionary _chatUsers = new();
public DistributedPubSubMediatorSpec() : this(new DistributedPubSubMediatorSpecConfig())
{
diff --git a/src/contrib/cluster/Akka.Cluster.Tools.Tests.MultiNode/Singleton/ClusterSingletonManagerChaosSpec.cs b/src/contrib/cluster/Akka.Cluster.Tools.Tests.MultiNode/Singleton/ClusterSingletonManagerChaosSpec.cs
index 0d18ed2b323..b95fa792562 100644
--- a/src/contrib/cluster/Akka.Cluster.Tools.Tests.MultiNode/Singleton/ClusterSingletonManagerChaosSpec.cs
+++ b/src/contrib/cluster/Akka.Cluster.Tools.Tests.MultiNode/Singleton/ClusterSingletonManagerChaosSpec.cs
@@ -57,7 +57,7 @@ public class ClusterSingletonManagerChaosSpec : MultiNodeClusterSpec
{
private class EchoStarted
{
- public static readonly EchoStarted Instance = new EchoStarted();
+ public static readonly EchoStarted Instance = new();
private EchoStarted() { }
}
diff --git a/src/contrib/cluster/Akka.Cluster.Tools.Tests.MultiNode/Singleton/ClusterSingletonManagerDownedSpec.cs b/src/contrib/cluster/Akka.Cluster.Tools.Tests.MultiNode/Singleton/ClusterSingletonManagerDownedSpec.cs
index 03e0efd9468..6e562891a43 100644
--- a/src/contrib/cluster/Akka.Cluster.Tools.Tests.MultiNode/Singleton/ClusterSingletonManagerDownedSpec.cs
+++ b/src/contrib/cluster/Akka.Cluster.Tools.Tests.MultiNode/Singleton/ClusterSingletonManagerDownedSpec.cs
@@ -44,7 +44,7 @@ public ClusterSingletonManagerDownedSpecConfig()
internal class EchoStarted
{
- public static readonly EchoStarted Instance = new EchoStarted();
+ public static readonly EchoStarted Instance = new();
private EchoStarted()
{
}
@@ -52,7 +52,7 @@ private EchoStarted()
internal class EchoStopped
{
- public static readonly EchoStopped Instance = new EchoStopped();
+ public static readonly EchoStopped Instance = new();
private EchoStopped()
{
}
diff --git a/src/contrib/cluster/Akka.Cluster.Tools.Tests.MultiNode/Singleton/ClusterSingletonManagerLeave2Spec.cs b/src/contrib/cluster/Akka.Cluster.Tools.Tests.MultiNode/Singleton/ClusterSingletonManagerLeave2Spec.cs
index 7d1461e7fe0..4dbbaa4de3b 100644
--- a/src/contrib/cluster/Akka.Cluster.Tools.Tests.MultiNode/Singleton/ClusterSingletonManagerLeave2Spec.cs
+++ b/src/contrib/cluster/Akka.Cluster.Tools.Tests.MultiNode/Singleton/ClusterSingletonManagerLeave2Spec.cs
@@ -51,7 +51,7 @@ public ClusterSingletonManagerLeave2SpecConfig()
public class EchoStared
{
- public static EchoStared Instance { get; } = new EchoStared();
+ public static EchoStared Instance { get; } = new();
private EchoStared() { }
}
diff --git a/src/contrib/cluster/Akka.Cluster.Tools.Tests.MultiNode/Singleton/ClusterSingletonManagerSpec.cs b/src/contrib/cluster/Akka.Cluster.Tools.Tests.MultiNode/Singleton/ClusterSingletonManagerSpec.cs
index 0dab4e99e97..5906e7750a8 100644
--- a/src/contrib/cluster/Akka.Cluster.Tools.Tests.MultiNode/Singleton/ClusterSingletonManagerSpec.cs
+++ b/src/contrib/cluster/Akka.Cluster.Tools.Tests.MultiNode/Singleton/ClusterSingletonManagerSpec.cs
@@ -69,7 +69,7 @@ internal class PointToPointChannel : UntypedActor
public sealed class UnregisterConsumer
{
- public static readonly UnregisterConsumer Instance = new UnregisterConsumer();
+ public static readonly UnregisterConsumer Instance = new();
private UnregisterConsumer()
{
@@ -78,7 +78,7 @@ private UnregisterConsumer()
public sealed class RegisterConsumer
{
- public static readonly RegisterConsumer Instance = new RegisterConsumer();
+ public static readonly RegisterConsumer Instance = new();
private RegisterConsumer()
{
@@ -87,7 +87,7 @@ private RegisterConsumer()
public sealed class RegistrationOk
{
- public static readonly RegistrationOk Instance = new RegistrationOk();
+ public static readonly RegistrationOk Instance = new();
private RegistrationOk()
{
@@ -96,7 +96,7 @@ private RegistrationOk()
public sealed class UnexpectedRegistration
{
- public static readonly UnexpectedRegistration Instance = new UnexpectedRegistration();
+ public static readonly UnexpectedRegistration Instance = new();
private UnexpectedRegistration()
{
@@ -105,7 +105,7 @@ private UnexpectedRegistration()
public sealed class UnregistrationOk
{
- public static readonly UnregistrationOk Instance = new UnregistrationOk();
+ public static readonly UnregistrationOk Instance = new();
private UnregistrationOk()
{
@@ -114,7 +114,7 @@ private UnregistrationOk()
public sealed class UnexpectedUnregistration
{
- public static readonly UnexpectedUnregistration Instance = new UnexpectedUnregistration();
+ public static readonly UnexpectedUnregistration Instance = new();
private UnexpectedUnregistration()
{
@@ -123,7 +123,7 @@ private UnexpectedUnregistration()
public sealed class Reset
{
- public static readonly Reset Instance = new Reset();
+ public static readonly Reset Instance = new();
private Reset()
{
@@ -132,7 +132,7 @@ private Reset()
public sealed class ResetOk
{
- public static readonly ResetOk Instance = new ResetOk();
+ public static readonly ResetOk Instance = new();
private ResetOk()
{
@@ -223,7 +223,7 @@ internal class Consumer : ReceiveActor
public sealed class Ping
{
- public static readonly Ping Instance = new Ping();
+ public static readonly Ping Instance = new();
private Ping()
{
@@ -232,7 +232,7 @@ private Ping()
public sealed class Pong
{
- public static readonly Pong Instance = new Pong();
+ public static readonly Pong Instance = new();
private Pong()
{
@@ -241,7 +241,7 @@ private Pong()
public sealed class End
{
- public static readonly End Instance = new End();
+ public static readonly End Instance = new();
private End()
{
@@ -250,7 +250,7 @@ private End()
public sealed class GetCurrent
{
- public static readonly GetCurrent Instance = new GetCurrent();
+ public static readonly GetCurrent Instance = new();
private GetCurrent()
{
diff --git a/src/contrib/cluster/Akka.Cluster.Tools.Tests/PublishSubscribe/DistributedPubSubMediatorSpec.cs b/src/contrib/cluster/Akka.Cluster.Tools.Tests/PublishSubscribe/DistributedPubSubMediatorSpec.cs
index 36f6a693f55..03a3c239dac 100644
--- a/src/contrib/cluster/Akka.Cluster.Tools.Tests/PublishSubscribe/DistributedPubSubMediatorSpec.cs
+++ b/src/contrib/cluster/Akka.Cluster.Tools.Tests/PublishSubscribe/DistributedPubSubMediatorSpec.cs
@@ -86,11 +86,11 @@ await EventFilter.DeadLetter
internal sealed class ReceptionistShutdown : IClusterClientMessage
{
- public static readonly ReceptionistShutdown Instance = new ReceptionistShutdown();
+ public static readonly ReceptionistShutdown Instance = new();
private ReceptionistShutdown() { }
}
#endregion
@@ -314,7 +314,7 @@ internal class RingOrdering : IComparer
///
/// The singleton instance of this comparer
///
- public static RingOrdering Instance { get; } = new RingOrdering();
+ public static RingOrdering Instance { get; } = new();
private RingOrdering() { }
///
diff --git a/src/contrib/cluster/Akka.Cluster.Tools/PublishSubscribe/DistributedMessages.cs b/src/contrib/cluster/Akka.Cluster.Tools/PublishSubscribe/DistributedMessages.cs
index 465f971d1df..d839d3bf9e6 100644
--- a/src/contrib/cluster/Akka.Cluster.Tools/PublishSubscribe/DistributedMessages.cs
+++ b/src/contrib/cluster/Akka.Cluster.Tools/PublishSubscribe/DistributedMessages.cs
@@ -561,7 +561,7 @@ public sealed class GetTopics
///
/// TBD
///
- public static GetTopics Instance { get; } = new GetTopics();
+ public static GetTopics Instance { get; } = new();
private GetTopics() { }
}
diff --git a/src/contrib/cluster/Akka.Cluster.Tools/PublishSubscribe/DistributedPubSubMediator.cs b/src/contrib/cluster/Akka.Cluster.Tools/PublishSubscribe/DistributedPubSubMediator.cs
index 4802e4c37d9..de00d5e9340 100644
--- a/src/contrib/cluster/Akka.Cluster.Tools/PublishSubscribe/DistributedPubSubMediator.cs
+++ b/src/contrib/cluster/Akka.Cluster.Tools/PublishSubscribe/DistributedPubSubMediator.cs
@@ -126,7 +126,7 @@ public static Props Props(DistributedPubSubSettings settings)
///
/// TBD
///
- public ILoggingAdapter Log { get { return _log ?? (_log = Context.GetLogger()); } }
+ public ILoggingAdapter Log { get { return _log ??= Context.GetLogger(); } }
///
/// TBD
diff --git a/src/contrib/cluster/Akka.Cluster.Tools/PublishSubscribe/Internal/TopicMessages.cs b/src/contrib/cluster/Akka.Cluster.Tools/PublishSubscribe/Internal/TopicMessages.cs
index cbcb0782e02..33f40e1fe19 100644
--- a/src/contrib/cluster/Akka.Cluster.Tools/PublishSubscribe/Internal/TopicMessages.cs
+++ b/src/contrib/cluster/Akka.Cluster.Tools/PublishSubscribe/Internal/TopicMessages.cs
@@ -10,6 +10,7 @@
using System.Collections.Immutable;
using System.Linq;
using Akka.Actor;
+using Akka.Annotations;
using Akka.Event;
using Akka.Routing;
@@ -24,7 +25,7 @@ internal sealed class Prune
///
/// TBD
///
- public static Prune Instance { get; } = new Prune();
+ public static Prune Instance { get; } = new();
private Prune() { }
}
@@ -37,14 +38,15 @@ internal sealed class Count
///
/// TBD
///
- public static Count Instance { get; } = new Count();
+ public static Count Instance { get; } = new();
private Count() { }
}
///
- /// TBD
+ /// Get all subscribers for a given topic.
///
- internal sealed class CountSubscribers
+ [ApiMayChange]
+ public sealed class CountSubscribers
{
public string Topic { get; }
@@ -159,7 +161,7 @@ public ValueHolder(long version, IActorRef @ref)
///
/// TBD
///
- public Routee Routee { get { return _routee ?? (_routee = Ref != null ? new ActorRefRoutee(Ref) : null); } }
+ public Routee Routee { get { return _routee ??= Ref != null ? new ActorRefRoutee(Ref) : null; } }
///
public bool Equals(ValueHolder other)
@@ -299,7 +301,7 @@ internal sealed class DeltaCount
///
/// TBD
///
- public static readonly DeltaCount Instance = new DeltaCount();
+ public static readonly DeltaCount Instance = new();
private DeltaCount() { }
}
@@ -313,7 +315,7 @@ internal sealed class GossipTick
///
/// TBD
///
- public static GossipTick Instance { get; } = new GossipTick();
+ public static GossipTick Instance { get; } = new();
private GossipTick() { }
}
@@ -458,7 +460,7 @@ internal sealed class NoMoreSubscribers : IChildActorTerminationProtocol
///
/// TBD
///
- public static NoMoreSubscribers Instance { get; } = new NoMoreSubscribers();
+ public static NoMoreSubscribers Instance { get; } = new();
private NoMoreSubscribers() {}
}
@@ -471,7 +473,7 @@ internal sealed class TerminateRequest : IChildActorTerminationProtocol
///
/// TBD
///
- public static TerminateRequest Instance { get; } = new TerminateRequest();
+ public static TerminateRequest Instance { get; } = new();
private TerminateRequest() {}
}
@@ -485,7 +487,7 @@ internal sealed class NewSubscriberArrived : IChildActorTerminationProtocol
///
/// TBD
///
- public static NewSubscriberArrived Instance { get; } = new NewSubscriberArrived();
+ public static NewSubscriberArrived Instance { get; } = new();
private NewSubscriberArrived() { }
}
diff --git a/src/contrib/cluster/Akka.Cluster.Tools/PublishSubscribe/Internal/Topics.cs b/src/contrib/cluster/Akka.Cluster.Tools/PublishSubscribe/Internal/Topics.cs
index af7b1545c35..b1be7fffd6c 100644
--- a/src/contrib/cluster/Akka.Cluster.Tools/PublishSubscribe/Internal/Topics.cs
+++ b/src/contrib/cluster/Akka.Cluster.Tools/PublishSubscribe/Internal/Topics.cs
@@ -324,8 +324,7 @@ protected override bool Business(object message)
///
internal static class Utils
{
- private static System.Text.RegularExpressions.Regex _pathRegex =
- new System.Text.RegularExpressions.Regex("^/remote/.+(/user/.+)");
+ private static System.Text.RegularExpressions.Regex _pathRegex = new("^/remote/.+(/user/.+)");
///
///
diff --git a/src/contrib/cluster/Akka.Cluster.Tools/PublishSubscribe/PerGroupingBuffer.cs b/src/contrib/cluster/Akka.Cluster.Tools/PublishSubscribe/PerGroupingBuffer.cs
index 22c88092b03..728c3237b92 100644
--- a/src/contrib/cluster/Akka.Cluster.Tools/PublishSubscribe/PerGroupingBuffer.cs
+++ b/src/contrib/cluster/Akka.Cluster.Tools/PublishSubscribe/PerGroupingBuffer.cs
@@ -17,7 +17,7 @@ namespace Akka.Cluster.Tools.PublishSubscribe
///
internal class PerGroupingBuffer
{
- private readonly Dictionary _buffers = new Dictionary();
+ private readonly Dictionary _buffers = new();
private int _totalBufferSize = 0;
///
diff --git a/src/contrib/cluster/Akka.Cluster.Tools/Singleton/ClusterSingleton.cs b/src/contrib/cluster/Akka.Cluster.Tools/Singleton/ClusterSingleton.cs
index 0c73b15e96f..d86d402b74c 100644
--- a/src/contrib/cluster/Akka.Cluster.Tools/Singleton/ClusterSingleton.cs
+++ b/src/contrib/cluster/Akka.Cluster.Tools/Singleton/ClusterSingleton.cs
@@ -22,7 +22,7 @@ public class ClusterSingleton : IExtension
{
private readonly ActorSystem _system;
private readonly Lazy _cluster;
- private readonly ConcurrentDictionary _proxies = new ConcurrentDictionary();
+ private readonly ConcurrentDictionary _proxies = new();
public static ClusterSingleton Get(ActorSystem system) =>
system.WithExtension();
@@ -83,7 +83,7 @@ IActorRef ProxyCreator()
public class ClusterSingletonProvider : ExtensionIdProvider
{
- public override ClusterSingleton CreateExtension(ExtendedActorSystem system) => new ClusterSingleton(system);
+ public override ClusterSingleton CreateExtension(ExtendedActorSystem system) => new(system);
}
public class SingletonActor
@@ -96,8 +96,7 @@ public class SingletonActor
public Option Settings { get; }
- public static SingletonActor Create(Props props, string name) =>
- new SingletonActor(name, props, Option