wxbty commented on code in PR #13104:
URL: https://github.com/apache/dubbo/pull/13104#discussion_r1340358256


##########
dubbo-metrics/dubbo-metrics-api/src/main/java/org/apache/dubbo/metrics/data/BaseStatComposite.java:
##########
@@ -133,4 +133,14 @@ public ApplicationStatComposite 
getApplicationStatComposite() {
     public RtStatComposite getRtStatComposite() {
         return rtStatComposite;
     }
+
+    @Override
+    public boolean calSamplesChanged() {
+        // Should ensure that all the composite's samplesChanged have been 
compareAndSet, and cannot flip the `or` logic
+        boolean changed = applicationStatComposite.calSamplesChanged();
+        changed = rtStatComposite.calSamplesChanged() || changed;
+        changed = serviceStatComposite.calSamplesChanged() || changed;
+        changed = methodStatComposite.calSamplesChanged() || changed;
+        return changed;
+    }

Review Comment:
   changed = changed || rtStatComposite.calSamplesChanged() ; 
   This would be better,Similar in other places.



##########
dubbo-metrics/dubbo-metrics-api/src/main/java/org/apache/dubbo/metrics/data/BaseStatComposite.java:
##########
@@ -133,4 +133,14 @@ public ApplicationStatComposite 
getApplicationStatComposite() {
     public RtStatComposite getRtStatComposite() {
         return rtStatComposite;
     }
+
+    @Override
+    public boolean calSamplesChanged() {
+        // Should ensure that all the composite's samplesChanged have been 
compareAndSet, and cannot flip the `or` logic
+        boolean changed = applicationStatComposite.calSamplesChanged();
+        changed = rtStatComposite.calSamplesChanged() || changed;
+        changed = serviceStatComposite.calSamplesChanged() || changed;
+        changed = methodStatComposite.calSamplesChanged() || changed;
+        return changed;
+    }

Review Comment:
   changed = changed || rtStatComposite.calSamplesChanged() ; 
   This would be better,Similar in other places.



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

Reply via email to