DomGarguilo commented on code in PR #5055:
URL: https://github.com/apache/accumulo/pull/5055#discussion_r1840753115
##########
core/src/main/java/org/apache/accumulo/core/clientImpl/InstanceOperationsImpl.java:
##########
@@ -501,6 +501,20 @@ public ServerId getServer(ServerId.Type type, String
resourceGroup, String host,
} else {
return managers.iterator().next();
}
+ case MONITOR:
+ Set<ServerId> monitors = getServers(type, rg2 -> true, hp);
+ if (monitors.isEmpty()) {
+ return null;
+ } else {
+ return monitors.iterator().next();
+ }
+ case GARBAGE_COLLECTOR:
+ Set<ServerId> gc = getServers(type, rg2 -> true, hp);
+ if (gc.isEmpty()) {
+ return null;
+ } else {
+ return gc.iterator().next();
+ }
Review Comment:
```suggestion
case MANAGER:
case MONITOR:
case GARBAGE_COLLECTOR:
Set<ServerId> server = getServers(type, rg2 -> true, hp);
if (server.isEmpty()) {
return null;
} else {
return server.stream().collect(MoreCollectors.onlyElement());
}
```
Looks like these three cases can be combined. Also added the use of
`.collect(MoreCollectors.onlyElement())` since we are only expecting one of
each of these servers but I am not sure if we want to include that here.
--
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]