tolbertam commented on code in PR #3085:
URL: https://github.com/apache/cassandra/pull/3085#discussion_r1481909307
##########
src/java/org/apache/cassandra/transport/Server.java:
##########
@@ -306,6 +315,24 @@ int countConnectedClients()
return allChannels.size() != 0 ? allChannels.size() - 1 : 0;
}
+ int countConnectedClients(Predicate<ServerConnection> predicate)
+ {
+ int count = 0;
+ for (Channel c : allChannels)
Review Comment:
Added `ConnectionTrackerTest` that includes:
* Validate that `Channel` lacking a `Connection.attributeKey` get skipped
over.
* Validate that `Channel` having a `Connection.attributeKey` that is not a
`ServerConnection` get skipped.
* Validate that if `c.attr(Connection.attributeKey).get()` throws an
unhandled exception it gets propagated up to the caller (ultimately preventing
the calculation from working, which I think is the behavior we want, but let me
know if you think that should be different).
* Also added tests that validate the expected basic functionality of
`countConnectedClients(predicate)` and `countConnectedClientsByUser` (which I
didn't change in this PR but figured would be nice to have at a unit level).
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]