Skip to content

Commit 67173b0

Browse files
committed
Update MaxOpenConnectionsHandler to ensure a channelName is available for the warning message
1 parent 8fa9d8c commit 67173b0

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

dev/io.openliberty.netty.internal.impl/src/io/openliberty/netty/internal/tcp/MaxOpenConnectionsHandler.java

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2021, 2022 IBM Corporation and others.
2+
* Copyright (c) 2021, 2025 IBM Corporation and others.
33
* All rights reserved. This program and the accompanying materials
44
* are made available under the terms of the Eclipse Public License 2.0
55
* which accompanies this distribution, and is available at
@@ -14,6 +14,7 @@
1414
import com.ibm.websphere.ras.Tr;
1515
import com.ibm.websphere.ras.TraceComponent;
1616

17+
import io.netty.channel.Channel;
1718
import io.netty.channel.ChannelHandler.Sharable;
1819
import io.netty.channel.ChannelHandlerContext;
1920
import io.netty.channel.ChannelInboundHandlerAdapter;
@@ -47,6 +48,15 @@ public void channelActive(ChannelHandlerContext ctx) throws Exception {
4748
long currentTime = System.currentTimeMillis();
4849
if (currentTime > (lastConnExceededTime + 600000L)) {
4950
String channelName = ctx.channel().attr(ConfigConstants.NAME_KEY).get();
51+
52+
// If the channelName is null check the parent for a name.
53+
if (channelName == null) {
54+
Channel parentChannel = ctx.channel().parent();
55+
if (parentChannel != null) {
56+
channelName = parentChannel.attr(ConfigConstants.NAME_KEY).get();
57+
}
58+
}
59+
5060
Tr.warning(tc, TCPMessageConstants.MAX_CONNS_EXCEEDED, channelName, maxConnections);
5161
lastConnExceededTime = currentTime;
5262
}

0 commit comments

Comments
 (0)