sebthom commented on a change in pull request #2592: ARTEMIS-2285 Sorting by
user column in connections view not working
URL: https://github.com/apache/activemq-artemis/pull/2592#discussion_r273799409
##########
File path:
artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/view/ConnectionView.java
##########
@@ -83,12 +83,12 @@ public Object getField(RemotingConnection connection,
String fieldName) {
case "remoteAddress":
return connection.getRemoteAddress();
case "users":
- Set<String> users = new HashSet<>();
+ Set<String> users = new TreeSet<>();
for (ServerSession session : sessions) {
String username = session.getUsername() == null ? "" :
session.getUsername();
users.add(username);
}
- return users;
+ return StringUtil.joinStringList(users, ",");
Review comment:
The returned value is a set of users of a single connection. to sort the
connections by their user(s), these lists need to be comparable with each
other. however treeset does not implement the comparable interface, so you
cannot sort multiple treesets by there values. thus the PR now returns a
comparable/sortable string representation of the set. does that make sense?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services