brusdev commented on a change in pull request #3863:
URL: https://github.com/apache/activemq-artemis/pull/3863#discussion_r759091887



##########
File path: 
artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingStoreImpl.java
##########
@@ -1153,6 +1161,31 @@ public boolean isFull() {
       return maxSize > 0 && getAddressSize() > maxSize || 
pagingManager.isGlobalFull();
    }
 
+
+   @Override
+   public int getAddressLimitPercent() {
+      final long currentUsage = getAddressSize();
+      if (currentUsage != 0) {
+         if (maxSize > 0) {
+            return Math.toIntExact((currentUsage / maxSize) * 100);
+         } else if (pagingManager.isUsingGlobalSize()) {
+            return Math.toIntExact((currentUsage / 
pagingManager.getGlobalSize()) * 100);

Review comment:
       Same as previous comment dividing currentUsage by 
pagingManager.getGlobalSize() should always return 0

##########
File path: 
artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingStoreImpl.java
##########
@@ -1153,6 +1161,31 @@ public boolean isFull() {
       return maxSize > 0 && getAddressSize() > maxSize || 
pagingManager.isGlobalFull();
    }
 
+
+   @Override
+   public int getAddressLimitPercent() {
+      final long currentUsage = getAddressSize();
+      if (currentUsage != 0) {
+         if (maxSize > 0) {
+            return Math.toIntExact((currentUsage / maxSize) * 100);

Review comment:
       Dividing currentUsage by maxSize should always return 0




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