Skip to content

Commit

Permalink
ARTEMIS-3121 Avoid creation of unnecessary StringBuilder instance in
Browse files Browse the repository at this point in the history
Netty#getProtocols() and simplify implementation
  • Loading branch information
sebthom authored and clebertsuconic committed Feb 19, 2021
1 parent 3cbc225 commit f9e23de
Showing 1 changed file with 5 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -862,18 +862,12 @@ public NettyAcceptor setShutdownTimeout(int shutdownTimeout) {
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 -----------------------------------------------------------------------------
Expand Down

0 comments on commit f9e23de

Please sign in to comment.