RexXiong commented on code in PR #3346:
URL: https://github.com/apache/celeborn/pull/3346#discussion_r2165259173


##########
common/src/main/scala/org/apache/celeborn/common/metrics/source/AbstractSource.scala:
##########
@@ -224,11 +227,11 @@ abstract class AbstractSource(conf: CelebornConf, role: 
String)
 
   def getAndClearTimerMetrics(): List[String] = {
     timerMetrics.synchronized {
-      var timerMetricsSize = timerMetrics.size()
       val timerMetricsList = ArrayBuffer[String]()
-      while (timerMetricsSize > 0) {
-        timerMetricsList.append(timerMetrics.poll())
-        timerMetricsSize = timerMetricsSize - 1
+      var elem = timerMetrics.poll()
+      while (elem != null) {

Review Comment:
   IMO the while loop can be terminated when `timerMetrics.size() > 0 && elem 
!=null`



-- 
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]

Reply via email to