improved logging on Netty Acceptor

This commit is contained in:
Andy Taylor 2015-02-26 15:22:52 +00:00 committed by Martyn Taylor
parent a895bf3344
commit 695c1cd46c
2 changed files with 24 additions and 3 deletions

View File

@ -96,6 +96,8 @@ public class NettyAcceptor implements Acceptor
// Disable resource leak detection for performance reasons by default
ResourceLeakDetector.setLevel(ResourceLeakDetector.Level.DISABLED);
}
//just for debug
private final String protocolsString;
private final String name;
@ -206,6 +208,8 @@ public class NettyAcceptor implements Acceptor
this.protocolHandler = new ProtocolHandler(protocolMap, this, configuration, scheduledThreadPool);
this.protocolsString = getProtocols(protocolMap);
host = ConfigurationHelper.getStringProperty(TransportConstants.HOST_PROP_NAME,
TransportConstants.DEFAULT_HOST,
configuration);
@ -478,7 +482,7 @@ public class NettyAcceptor implements Acceptor
TimeUnit.MILLISECONDS);
}
ActiveMQServerLogger.LOGGER.startedNettyAcceptor(TransportConstants.NETTY_VERSION, host, port);
ActiveMQServerLogger.LOGGER.startedNettyAcceptor(TransportConstants.NETTY_VERSION, host, port, protocolsString);
}
}
@ -666,6 +670,23 @@ public class NettyAcceptor implements Acceptor
return new ActiveMQServerChannelHandler(channelGroup, handler, new Listener());
}
private static String getProtocols(Map<String, ProtocolManager> protocolManager)
{
StringBuilder sb = new StringBuilder();
if (protocolManager != null)
{
Set<String> strings = protocolManager.keySet();
for (String string : strings)
{
if (sb.length() > 0)
{
sb.append(",");
}
sb.append(string);
}
}
return sb.toString();
}
// Inner classes -----------------------------------------------------------------------------
private final class ActiveMQServerChannelHandler extends ActiveMQChannelHandler implements ConnectionCreator

View File

@ -167,8 +167,8 @@ public interface ActiveMQServerLogger extends BasicLogger
void journalUnreferencedMessage(Long messageID);
@LogMessage(level = Logger.Level.INFO)
@Message(id = 221020, value = "Started Netty Acceptor version {0} {1}:{2,number,#}", format = Message.Format.MESSAGE_FORMAT)
void startedNettyAcceptor(String id, String host, Integer port);
@Message(id = 221020, value = "Started Netty Acceptor version {0} {1}:{2,number,#} for protocols [{3}]", format = Message.Format.MESSAGE_FORMAT)
void startedNettyAcceptor(String id, String host, Integer port, String enabledProtocols);
@LogMessage(level = Logger.Level.INFO)
@Message(id = 221021, value = "failed to remove connection", format = Message.Format.MESSAGE_FORMAT)