csudharsanan commented on code in PR #2804: URL: https://github.com/apache/helix/pull/2804#discussion_r1624896112
########## helix-core/src/main/java/org/apache/helix/monitoring/mbeans/ResourceMonitor.java: ########## @@ -274,13 +275,22 @@ public void updateResourceState(ExternalView externalView, IdealState idealState Set<String> partitions = idealState.getPartitionSet(); int replica; try { - replica = Integer.valueOf(idealState.getReplicas()); - } catch (NumberFormatException e) { - _logger.info("Unspecified replica count for {}, skip updating the ResourceMonitor Mbean: {}", _resourceName, - idealState.getReplicas()); - return; + String replicaCount = idealState.getReplicas(); + if (!replicaCount.equals(ResourceConfig.ResourceConfigConstants.ANY_LIVEINSTANCE.name())) { + try { + replica = Integer.parseInt(replicaCount); + } catch (NumberFormatException ex) { + _logger.info( + "Unspecified replica count for {}, skip updating the ResourceMonitor Mbean: {}", + _resourceName, idealState.getReplicas()); + return; + } + } else { + replica = -1; + } Review Comment: @junkaixue I've updated the code to use an existing IdealState method (getReplicaCount mentioned above by komal) that sets it to -1 when replica is ANY_LIVEINSTANCE. are you referring to the same ? -- 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: reviews-unsubscr...@helix.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@helix.apache.org For additional commands, e-mail: reviews-h...@helix.apache.org