ni-ze commented on code in PR #6669:
URL: https://github.com/apache/rocketmq/pull/6669#discussion_r1190580822


##########
client/src/main/java/org/apache/rocketmq/client/impl/consumer/ProcessQueue.java:
##########
@@ -404,30 +404,31 @@ public void incTryUnlockTimes() {
     public void fillProcessQueueInfo(final ProcessQueueInfo info) {
         try {
             this.treeMapLock.readLock().lockInterruptibly();
+            try {
+                if (!this.msgTreeMap.isEmpty()) {
+                    info.setCachedMsgMinOffset(this.msgTreeMap.firstKey());
+                    info.setCachedMsgMaxOffset(this.msgTreeMap.lastKey());
+                    info.setCachedMsgCount(this.msgTreeMap.size());
+                    info.setCachedMsgSizeInMiB((int) (this.msgSize.get() / 
(1024 * 1024)));
+                }
 
-            if (!this.msgTreeMap.isEmpty()) {
-                info.setCachedMsgMinOffset(this.msgTreeMap.firstKey());
-                info.setCachedMsgMaxOffset(this.msgTreeMap.lastKey());
-                info.setCachedMsgCount(this.msgTreeMap.size());
-                info.setCachedMsgSizeInMiB((int) (this.msgSize.get() / (1024 * 
1024)));
-            }
-
-            if (!this.consumingMsgOrderlyTreeMap.isEmpty()) {
-                
info.setTransactionMsgMinOffset(this.consumingMsgOrderlyTreeMap.firstKey());
-                
info.setTransactionMsgMaxOffset(this.consumingMsgOrderlyTreeMap.lastKey());
-                
info.setTransactionMsgCount(this.consumingMsgOrderlyTreeMap.size());
-            }
+                if (!this.consumingMsgOrderlyTreeMap.isEmpty()) {
+                    
info.setTransactionMsgMinOffset(this.consumingMsgOrderlyTreeMap.firstKey());
+                    
info.setTransactionMsgMaxOffset(this.consumingMsgOrderlyTreeMap.lastKey());
+                    
info.setTransactionMsgCount(this.consumingMsgOrderlyTreeMap.size());
+                }
 
-            info.setLocked(this.locked);
-            info.setTryUnlockTimes(this.tryUnlockTimes.get());
-            info.setLastLockTimestamp(this.lastLockTimestamp);
+                info.setLocked(this.locked);
+                info.setTryUnlockTimes(this.tryUnlockTimes.get());
+                info.setLastLockTimestamp(this.lastLockTimestamp);
 
-            info.setDroped(this.dropped);
-            info.setLastPullTimestamp(this.lastPullTimestamp);
-            info.setLastConsumeTimestamp(this.lastConsumeTimestamp);
+                info.setDroped(this.dropped);
+                info.setLastPullTimestamp(this.lastPullTimestamp);
+                info.setLastConsumeTimestamp(this.lastConsumeTimestamp);
+            } finally {
+                this.treeMapLock.readLock().unlock();
+            }
         } catch (Exception e) {
-        } finally {
-            this.treeMapLock.readLock().unlock();

Review Comment:
   the catch-ignored block can be removed.



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