Skip to content

Commit 5fd1b81

Browse files
committed
consolidate DotNetty to use single threadpool
part of akkadotnet#4636
1 parent d14bb5b commit 5fd1b81

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/core/Akka.Remote/Transport/DotNetty/DotNettyTransport.cs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,7 @@ internal abstract class DotNettyTransport : Transport
125125
protected volatile Address LocalAddress;
126126
protected internal volatile IChannel ServerChannel;
127127

128-
private readonly IEventLoopGroup _serverEventLoopGroup;
129-
private readonly IEventLoopGroup _clientEventLoopGroup;
128+
private readonly IEventLoopGroup _eventLoopGroup;
130129

131130
protected DotNettyTransport(ActorSystem system, Config config)
132131
{
@@ -141,8 +140,7 @@ protected DotNettyTransport(ActorSystem system, Config config)
141140

142141
Settings = DotNettyTransportSettings.Create(config);
143142
Log = Logging.GetLogger(System, GetType());
144-
_serverEventLoopGroup = new MultithreadEventLoopGroup(Settings.ServerSocketWorkerPoolSize);
145-
_clientEventLoopGroup = new MultithreadEventLoopGroup(Settings.ClientSocketWorkerPoolSize);
143+
_eventLoopGroup = new MultithreadEventLoopGroup(Settings.ServerSocketWorkerPoolSize);
146144
ConnectionGroup = new ConcurrentSet<IChannel>();
147145
AssociationListenerPromise = new TaskCompletionSource<IAssociationEventListener>();
148146

@@ -255,8 +253,7 @@ public override async Task<bool> Shutdown()
255253
// free all of the connection objects we were holding onto
256254
ConnectionGroup.Clear();
257255
#pragma warning disable 4014 // shutting down the worker groups can take up to 10 seconds each. Let that happen asnychronously.
258-
_clientEventLoopGroup.ShutdownGracefullyAsync();
259-
_serverEventLoopGroup.ShutdownGracefullyAsync();
256+
_eventLoopGroup.ShutdownGracefullyAsync();
260257
#pragma warning restore 4014
261258
}
262259
}
@@ -269,7 +266,7 @@ protected Bootstrap ClientFactory(Address remoteAddress)
269266
var addressFamily = Settings.DnsUseIpv6 ? AddressFamily.InterNetworkV6 : AddressFamily.InterNetwork;
270267

271268
var client = new Bootstrap()
272-
.Group(_clientEventLoopGroup)
269+
.Group(_eventLoopGroup)
273270
.Option(ChannelOption.SoReuseaddr, Settings.TcpReuseAddr)
274271
.Option(ChannelOption.SoKeepalive, Settings.TcpKeepAlive)
275272
.Option(ChannelOption.TcpNodelay, Settings.TcpNoDelay)
@@ -381,7 +378,7 @@ private ServerBootstrap ServerFactory()
381378
var addressFamily = Settings.DnsUseIpv6 ? AddressFamily.InterNetworkV6 : AddressFamily.InterNetwork;
382379

383380
var server = new ServerBootstrap()
384-
.Group(_serverEventLoopGroup)
381+
.Group(_eventLoopGroup)
385382
.Option(ChannelOption.SoReuseaddr, Settings.TcpReuseAddr)
386383
.Option(ChannelOption.SoKeepalive, Settings.TcpKeepAlive)
387384
.Option(ChannelOption.TcpNodelay, Settings.TcpNoDelay)

0 commit comments

Comments
 (0)