ARTEMIS-3121 Avoid creation of unnecessary StringBuilder instance in

Netty#getProtocols() and simplify implementation
This commit is contained in:
sebthom 2021-02-16 18:36:11 +01:00 committed by Clebert Suconic
parent 3cbc225ee1
commit f9e23def8d
1 changed files with 5 additions and 11 deletions

View File

@ -862,18 +862,12 @@ public class NettyAcceptor extends AbstractAcceptor {
return this;
}
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);
}
private static String getProtocols(final Map<String, ProtocolManager> protocolManagers) {
if (protocolManagers == null || protocolManagers.isEmpty()) {
return "";
}
return sb.toString();
return String.join(",", protocolManagers.keySet());
}
// Inner classes -----------------------------------------------------------------------------