diff --git a/src/core/Akka.Cluster/ClusterActorRefProvider.cs b/src/core/Akka.Cluster/ClusterActorRefProvider.cs
index b2206fbc0d7..8cb06387981 100644
--- a/src/core/Akka.Cluster/ClusterActorRefProvider.cs
+++ b/src/core/Akka.Cluster/ClusterActorRefProvider.cs
@@ -130,7 +130,7 @@ public override Scope Copy()
///
/// Deployer of cluster-aware routers
///
- internal class ClusterDeployer : RemoteDeployer
+ internal sealed class ClusterDeployer : RemoteDeployer
{
///
/// Initializes a new instance of the class.
diff --git a/src/core/Akka.Remote/Endpoint.cs b/src/core/Akka.Remote/Endpoint.cs
index c43fe025cf5..eac24ca5a5a 100644
--- a/src/core/Akka.Remote/Endpoint.cs
+++ b/src/core/Akka.Remote/Endpoint.cs
@@ -49,7 +49,7 @@ void Dispatch(IInternalActorRef recipient, Address recipientAddress, SerializedM
///
/// INTERNAL API
///
- internal class DefaultMessageDispatcher : IInboundMessageDispatcher
+ internal sealed class DefaultMessageDispatcher : IInboundMessageDispatcher
{
private readonly ExtendedActorSystem _system;
private readonly IRemoteActorRefProvider _provider;
@@ -398,7 +398,7 @@ public OversizedPayloadException(string message)
///
/// INTERNAL API
///
- internal class ReliableDeliverySupervisor : ReceiveActor
+ internal sealed class ReliableDeliverySupervisor : ReceiveActor
{
#region Internal message classes
@@ -447,7 +447,7 @@ private TooLongIdle() { }
private readonly int? _refuseUid;
private readonly AkkaProtocolTransport _transport;
private readonly RemoteSettings _settings;
- private AkkaPduCodec _codec;
+ private readonly AkkaPduCodec _codec;
private AkkaProtocolHandle _currentHandle;
private readonly ConcurrentDictionary _receiveBuffers;
@@ -599,7 +599,7 @@ protected override void PostRestart(Exception reason)
/// TBD
///
/// TBD
- protected void Receiving()
+ private void Receiving()
{
Receive(_ =>
{
@@ -680,7 +680,7 @@ private void GoToActive()
/// TBD
/// TBD
/// TBD
- protected void Gated(bool writerTerminated, bool earlyUngateRequested)
+ private void Gated(bool writerTerminated, bool earlyUngateRequested)
{
Receive(_ =>
{
@@ -740,7 +740,7 @@ protected void Gated(bool writerTerminated, bool earlyUngateRequested)
///
/// TBD
///
- protected void IdleBehavior()
+ private void IdleBehavior()
{
Receive(_ => Sender.Tell(Idle.Instance));
Receive(send =>
@@ -772,7 +772,7 @@ protected void IdleBehavior()
///
/// TBD
///
- protected void FlushWait()
+ private void FlushWait()
{
Receive(_ => { }); // Do not reply, we will Terminate soon, which will do the inbound connection unstashing
Receive(_ =>
@@ -1015,7 +1015,7 @@ private void TryPublish(RemotingLifecycleEvent ev)
///
/// INTERNAL API
///
- internal class EndpointWriter : EndpointActor
+ internal sealed class EndpointWriter : EndpointActor
{
///
/// TBD
@@ -1876,7 +1876,7 @@ public OutboundAck(Ack ack)
///
/// INTERNAL API
///
- internal class EndpointReader : EndpointActor
+ internal sealed class EndpointReader : EndpointActor
{
///
/// TBD
diff --git a/src/core/Akka.Remote/EndpointManager.cs b/src/core/Akka.Remote/EndpointManager.cs
index 24959efaa5f..717a488b24f 100644
--- a/src/core/Akka.Remote/EndpointManager.cs
+++ b/src/core/Akka.Remote/EndpointManager.cs
@@ -9,7 +9,6 @@
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
-using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using Akka.Actor;
@@ -24,7 +23,7 @@ namespace Akka.Remote
///
/// INTERNAL API
///
- internal class EndpointManager : ReceiveActor, IRequiresMessageQueue
+ internal sealed class EndpointManager : ReceiveActor, IRequiresMessageQueue
{
#region Policy definitions
@@ -701,7 +700,7 @@ into g
/// Message-processing behavior when the is able to accept
/// inbound association requests.
///
- protected void Accepting()
+ private void Accepting()
{
Receive(mc =>
{
@@ -929,7 +928,7 @@ IActorRef CreateAndRegisterWritingEndpoint() => _endpoints.RegisterWritableEndpo
///
/// TBD
///
- protected void Flushing()
+ private void Flushing()
{
Receive(send => Context.System.DeadLetters.Tell(send));
Receive(
diff --git a/src/core/Akka.Remote/EndpointRegistry.cs b/src/core/Akka.Remote/EndpointRegistry.cs
index a9bc731174d..9f4254b5a4f 100644
--- a/src/core/Akka.Remote/EndpointRegistry.cs
+++ b/src/core/Akka.Remote/EndpointRegistry.cs
@@ -16,7 +16,7 @@ namespace Akka.Remote
///
/// Not threadsafe - only to be used in HeadActor
///
- internal class EndpointRegistry
+ internal sealed class EndpointRegistry
{
private Dictionary _addressToRefuseUid = new();
private readonly Dictionary _addressToReadonly = new();
diff --git a/src/core/Akka.Remote/PhiAccrualFailureDetector.cs b/src/core/Akka.Remote/PhiAccrualFailureDetector.cs
index 49e54c4c109..b0bd20ae99a 100644
--- a/src/core/Akka.Remote/PhiAccrualFailureDetector.cs
+++ b/src/core/Akka.Remote/PhiAccrualFailureDetector.cs
@@ -6,7 +6,6 @@
//-----------------------------------------------------------------------
using System;
-using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using Akka.Actor;
@@ -38,9 +37,9 @@ public class PhiAccrualFailureDetector : FailureDetector
{
private readonly double _threshold;
private readonly int _maxSampleSize;
- private TimeSpan _minStdDeviation;
- private TimeSpan _acceptableHeartbeatPause;
- private TimeSpan _firstHeartbeatEstimate;
+ private readonly TimeSpan _minStdDeviation;
+ private readonly TimeSpan _acceptableHeartbeatPause;
+ private readonly TimeSpan _firstHeartbeatEstimate;
private readonly Clock _clock;
///
@@ -128,7 +127,7 @@ private HeartbeatHistory FirstHeartBeat
///
/// Uses volatile memory and immutability for lockless concurrency.
///
- internal class AccrualState
+ internal sealed class AccrualState
{
///
/// TBD
diff --git a/src/core/Akka.Remote/RemoteDeploymentWatcher.cs b/src/core/Akka.Remote/RemoteDeploymentWatcher.cs
index 0b7a35ce6ee..1341dd1b7ad 100644
--- a/src/core/Akka.Remote/RemoteDeploymentWatcher.cs
+++ b/src/core/Akka.Remote/RemoteDeploymentWatcher.cs
@@ -16,7 +16,7 @@ namespace Akka.Remote
/// Responsible for cleaning up child references of remote deployed actors when remote node
/// goes down (crash, network failure), i.e. triggered by Akka.Actor.Terminated.AddressTerminated
///
- internal class RemoteDeploymentWatcher : ReceiveActor, IRequiresMessageQueue
+ internal sealed class RemoteDeploymentWatcher : ReceiveActor, IRequiresMessageQueue
{
private readonly IDictionary _supervisors =
@@ -48,7 +48,7 @@ public RemoteDeploymentWatcher()
///
/// TBD
///
- internal class WatchRemote
+ internal sealed class WatchRemote
{
///
/// TBD
diff --git a/src/core/Akka.Remote/RemoteMetricsExtension.cs b/src/core/Akka.Remote/RemoteMetricsExtension.cs
index 9afbb64c939..cc6ac47596c 100644
--- a/src/core/Akka.Remote/RemoteMetricsExtension.cs
+++ b/src/core/Akka.Remote/RemoteMetricsExtension.cs
@@ -18,7 +18,7 @@ namespace Akka.Remote
/// Extension that keeps track of remote metrics, such
/// as max size of different message types.
///
- internal class RemoteMetricsExtension : ExtensionIdProvider
+ internal sealed class RemoteMetricsExtension : ExtensionIdProvider
{
///
/// TBD
@@ -54,7 +54,7 @@ public static IRemoteMetrics Create(ExtendedActorSystem system)
///
/// INTERNAL API
///
- internal class RemoteMetricsOn : IRemoteMetrics
+ internal sealed class RemoteMetricsOn : IRemoteMetrics
{
private readonly ILoggingAdapter _log;
private readonly long? _logFrameSizeExceeding;
@@ -124,7 +124,7 @@ private void Check(Type type, long payloadBytes, long newMax)
///
/// INTERNAL API
///
- internal class RemoteMetricsOff : IRemoteMetrics
+ internal sealed class RemoteMetricsOff : IRemoteMetrics
{
///
/// TBD
diff --git a/src/core/Akka.Remote/Remoting.cs b/src/core/Akka.Remote/Remoting.cs
index 4c684c5b3fe..71a9b7e8363 100644
--- a/src/core/Akka.Remote/Remoting.cs
+++ b/src/core/Akka.Remote/Remoting.cs
@@ -125,7 +125,7 @@ internal sealed class Remoting : RemoteTransport
// a lazy val
private volatile Address _defaultAddress;
- private IActorRef _transportSupervisor;
+ private readonly IActorRef _transportSupervisor;
private readonly EventPublisher _eventPublisher;
///
@@ -435,7 +435,7 @@ public RegisterTransportActor(Props props, string name)
///
/// Actor responsible for supervising the creation of all transport actors
///
- internal class TransportSupervisor : ReceiveActor
+ internal sealed class TransportSupervisor : ReceiveActor
{
private readonly SupervisorStrategy _strategy = new OneForOneStrategy(_ => Directive.Restart);
///
diff --git a/src/core/Akka.Remote/RemotingLifecycleEvent.cs b/src/core/Akka.Remote/RemotingLifecycleEvent.cs
index e49b121086d..f92de420c3a 100644
--- a/src/core/Akka.Remote/RemotingLifecycleEvent.cs
+++ b/src/core/Akka.Remote/RemotingLifecycleEvent.cs
@@ -394,7 +394,7 @@ public override string ToString()
///
/// Used for publishing remote lifecycle events to the of the provided .
///
- internal class EventPublisher
+ internal sealed class EventPublisher
{
///
/// TBD
diff --git a/src/core/Akka.Remote/Serialization/ExceptionSupport.cs b/src/core/Akka.Remote/Serialization/ExceptionSupport.cs
index c2b3d638e64..d6ff8786385 100644
--- a/src/core/Akka.Remote/Serialization/ExceptionSupport.cs
+++ b/src/core/Akka.Remote/Serialization/ExceptionSupport.cs
@@ -8,7 +8,6 @@
using System;
using System.Collections.Generic;
using System.Reflection;
-using System.Runtime.Serialization.Formatters;
using Akka.Actor;
using Akka.Util;
using Akka.Util.Internal;
@@ -18,7 +17,7 @@
namespace Akka.Remote.Serialization
{
- internal class ExceptionSupport
+ internal sealed class ExceptionSupport
{
private readonly WrappedPayloadSupport _wrappedPayloadSupport;
private const BindingFlags All = BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public;
diff --git a/src/core/Akka.Remote/Serialization/WrappedPayloadSupport.cs b/src/core/Akka.Remote/Serialization/WrappedPayloadSupport.cs
index 664de590a21..8d43705830f 100644
--- a/src/core/Akka.Remote/Serialization/WrappedPayloadSupport.cs
+++ b/src/core/Akka.Remote/Serialization/WrappedPayloadSupport.cs
@@ -6,13 +6,11 @@
//-----------------------------------------------------------------------
using Akka.Actor;
-using Akka.Serialization;
-using Akka.Util;
using Google.Protobuf;
namespace Akka.Remote.Serialization
{
- internal class WrappedPayloadSupport
+ internal sealed class WrappedPayloadSupport
{
private readonly ExtendedActorSystem _system;
diff --git a/src/core/Akka.Remote/Transport/AkkaPduCodec.cs b/src/core/Akka.Remote/Transport/AkkaPduCodec.cs
index dff4eec0a07..8f1cfb072d2 100644
--- a/src/core/Akka.Remote/Transport/AkkaPduCodec.cs
+++ b/src/core/Akka.Remote/Transport/AkkaPduCodec.cs
@@ -301,7 +301,7 @@ public abstract ByteString ConstructMessage(Address localAddress, IActorRef reci
///
/// TBD
///
- internal class AkkaPduProtobuffCodec : AkkaPduCodec
+ internal sealed class AkkaPduProtobuffCodec : AkkaPduCodec
{
///
/// TBD
diff --git a/src/core/Akka.Remote/Transport/AkkaProtocolTransport.cs b/src/core/Akka.Remote/Transport/AkkaProtocolTransport.cs
index 611934892c0..678605653bb 100644
--- a/src/core/Akka.Remote/Transport/AkkaProtocolTransport.cs
+++ b/src/core/Akka.Remote/Transport/AkkaProtocolTransport.cs
@@ -25,7 +25,7 @@ namespace Akka.Remote.Transport
/// this system over the network.
///
///
- internal class ProtocolTransportAddressPair
+ internal sealed class ProtocolTransportAddressPair
{
///
/// Initializes a new instance of the class.
@@ -184,7 +184,7 @@ public async Task Associate(Address remoteAddress, int? refu
///
/// TBD
///
- internal class AkkaProtocolManager : ActorTransportAdapterManager
+ internal sealed class AkkaProtocolManager : ActorTransportAdapterManager
{
///
/// TBD
@@ -290,7 +290,7 @@ private FailureDetector CreateTransportFailureDetector()
///
/// TBD
///
- internal class AssociateUnderlyingRefuseUid : INoSerializationVerificationNeeded
+ internal sealed class AssociateUnderlyingRefuseUid : INoSerializationVerificationNeeded
{
///
/// TBD
@@ -373,7 +373,7 @@ public override int GetHashCode()
///
/// TBD
///
- internal class AkkaProtocolHandle : AbstractTransportAdapterHandle
+ internal sealed class AkkaProtocolHandle : AbstractTransportAdapterHandle
{
///
/// TBD
@@ -444,7 +444,7 @@ public override bool Equals(object obj)
}
///
- protected bool Equals(AkkaProtocolHandle other)
+ private bool Equals(AkkaProtocolHandle other)
{
return base.Equals(other) && Equals(HandshakeInfo, other.HandshakeInfo) && Equals(StateActor, other.StateActor);
}
@@ -484,9 +484,9 @@ internal enum AssociationState
///
/// TBD
///
- internal class HeartbeatTimer : INoSerializationVerificationNeeded { }
+ internal sealed class HeartbeatTimer : INoSerializationVerificationNeeded { }
- internal class HandshakeTimer : INoSerializationVerificationNeeded { }
+ internal sealed class HandshakeTimer : INoSerializationVerificationNeeded { }
///
/// TBD
@@ -689,7 +689,7 @@ public ListenerReady(IHandleEventListener listener, AssociationHandle wrappedHan
///
/// Message sent when a returns false, signaling a transport timeout.
///
- internal class TimeoutReason
+ internal sealed class TimeoutReason
{
///
/// TBD
@@ -715,17 +715,17 @@ public override string ToString()
///
/// TBD
///
- internal class ForbiddenUidReason { }
+ internal sealed class ForbiddenUidReason { }
///
/// INTERNAL API.
///
- internal class ProtocolStateActor : FSM
+ internal sealed class ProtocolStateActor : FSM
{
private readonly ILoggingAdapter _log = Context.GetLogger();
private readonly InitialProtocolStateData _initialData;
private readonly HandshakeInfo _localHandshakeInfo;
- private int? _refuseUid;
+ private readonly int? _refuseUid;
private readonly AkkaProtocolSettings _settings;
private readonly Address _localAddress;
private readonly AkkaPduCodec _codec;
@@ -811,7 +811,7 @@ public ProtocolStateActor(HandshakeInfo handshakeInfo, AssociationHandle wrapped
///
///
///
- protected ProtocolStateActor(InitialProtocolStateData initialData, HandshakeInfo localHandshakeInfo, AkkaProtocolSettings settings, AkkaPduCodec codec, FailureDetector failureDetector, int? refuseUid)
+ private ProtocolStateActor(InitialProtocolStateData initialData, HandshakeInfo localHandshakeInfo, AkkaProtocolSettings settings, AkkaPduCodec codec, FailureDetector failureDetector, int? refuseUid)
{
_initialData = initialData;
_localHandshakeInfo = localHandshakeInfo;
diff --git a/src/core/Akka.Remote/Transport/DotNetty/AkkaLoggingHandler.cs b/src/core/Akka.Remote/Transport/DotNetty/AkkaLoggingHandler.cs
index 8e536e5fd8e..75eda8dd8a6 100644
--- a/src/core/Akka.Remote/Transport/DotNetty/AkkaLoggingHandler.cs
+++ b/src/core/Akka.Remote/Transport/DotNetty/AkkaLoggingHandler.cs
@@ -8,12 +8,10 @@
using System;
using System.Net;
using System.Text;
-using System.Threading;
using System.Threading.Tasks;
using Akka.Event;
using Akka.Util;
using DotNetty.Buffers;
-using DotNetty.Common.Concurrency;
using DotNetty.Transport.Channels;
using ILoggingAdapter = Akka.Event.ILoggingAdapter;
@@ -25,7 +23,7 @@ namespace Akka.Remote.Transport.DotNetty
///
/// Used for adding additional debug logging to the DotNetty transport
///
- internal class AkkaLoggingHandler : ChannelHandlerAdapter
+ internal sealed class AkkaLoggingHandler : ChannelHandlerAdapter
{
private readonly ILoggingAdapter _log;
@@ -127,7 +125,7 @@ public override void Flush(IChannelHandlerContext ctx)
ctx.Flush();
}
- protected string Format(IChannelHandlerContext ctx, string eventName)
+ private string Format(IChannelHandlerContext ctx, string eventName)
{
string chStr = ctx.Channel.ToString();
return new StringBuilder(chStr.Length + 1 + eventName.Length)
@@ -137,7 +135,7 @@ protected string Format(IChannelHandlerContext ctx, string eventName)
.ToString();
}
- protected string Format(IChannelHandlerContext ctx, string eventName, object arg)
+ private string Format(IChannelHandlerContext ctx, string eventName, object arg)
{
if (arg is IByteBuffer buffer)
{
@@ -153,7 +151,7 @@ protected string Format(IChannelHandlerContext ctx, string eventName, object arg
}
}
- protected string Format(IChannelHandlerContext ctx, string eventName, object firstArg, object secondArg)
+ private string Format(IChannelHandlerContext ctx, string eventName, object firstArg, object secondArg)
{
if (secondArg == null)
{
diff --git a/src/core/Akka.Remote/Transport/DotNetty/BatchWriter.cs b/src/core/Akka.Remote/Transport/DotNetty/BatchWriter.cs
index 8cad9592c34..cee9d0fc01d 100644
--- a/src/core/Akka.Remote/Transport/DotNetty/BatchWriter.cs
+++ b/src/core/Akka.Remote/Transport/DotNetty/BatchWriter.cs
@@ -34,7 +34,7 @@ namespace Akka.Remote.Transport.DotNetty
///
/// INTERNAL API
///
- internal class FlushConsolidationHandler : ChannelDuplexHandler
+ internal sealed class FlushConsolidationHandler : ChannelDuplexHandler
{
///
/// The default number of flushes after which a flush will be forwarded to downstream handlers (whether while in a
@@ -209,7 +209,7 @@ private void CancelScheduledFlush()
///
/// Configuration object for
///
- internal class BatchWriterSettings
+ internal sealed class BatchWriterSettings
{
public const int DefaultMaxPendingWrites = 30;
public const long DefaultMaxPendingBytes = 16 * 1024L;
diff --git a/src/core/Akka.Remote/Transport/DotNetty/DotNettyTransport.cs b/src/core/Akka.Remote/Transport/DotNetty/DotNettyTransport.cs
index 2faa0cd0a0b..ae2109acd09 100644
--- a/src/core/Akka.Remote/Transport/DotNetty/DotNettyTransport.cs
+++ b/src/core/Akka.Remote/Transport/DotNetty/DotNettyTransport.cs
@@ -481,7 +481,7 @@ public static EndPoint AddressToSocketAddress(Address address)
#endregion
}
- internal class HeliosBackwardsCompatabilityLengthFramePrepender : LengthFieldPrepender
+ internal sealed class HeliosBackwardsCompatabilityLengthFramePrepender : LengthFieldPrepender
{
private readonly List