clebertsuconic commented on a change in pull request #3983:
URL: https://github.com/apache/activemq-artemis/pull/3983#discussion_r829127933



##########
File path: 
artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingStoreImpl.java
##########
@@ -189,13 +198,45 @@ public PagingStoreImpl(final SimpleString address,
       this.usingGlobalMaxSize = pagingManager.isUsingGlobalSize();
    }
 
+   private static SizeAwareMetric getGlobalMetric(PagingManager manager) {
+      if (manager instanceof PagingManagerImpl) {
+         return ((PagingManagerImpl) manager).getSizeAwareMetric();
+      } else {
+         // for unit / mock tests
+         SizeAwareMetric metric = new SizeAwareMetric(-1, -1, -1, -1, -1, 1, 
1, 0, 0);
+         metric.addOnSizeCallback(manager::addSize, false);
+         metric.addOnSizeCallback((l) -> manager.addSize(l, true), true);
+         return metric;
+      }
+   }

Review comment:
       I did not want to add SizeAwareMetric to the interface... I wanted it to 
be an internal implementation detail.
   
   if the implementation (PagingManagerImpl) is using it, it could use it on a 
parent call for the metric. Otherwise the proxy Metric would use the already 
existing API.
   
   I'm adding it to the interface now with a default implementation returning 
the proxy. I didn't want to do it.. but I will do it just to settle this.




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