Joscorbe commented on code in PR #2792:
URL: https://github.com/apache/jackrabbit-oak/pull/2792#discussion_r2907681840


##########
oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/LeaseCheckDocumentStoreWrapper.java:
##########
@@ -253,6 +256,24 @@ public int getNodeNameLimit() {
      */
     @Override
     public Throttler throttler() {
-        return delegate.throttler();
+        return leaseChecking(() ->
+                delegate.throttler());
+    }
+
+    private <T> T leaseChecking(Supplier<T> operation) {
+        performLeaseCheck();
+        try {
+            return operation.get();
+        } finally {
+            performLeaseCheck();
+        }
+    }
+    private void leaseChecking(Runnable operation) {
+        performLeaseCheck();
+        try {
+            operation.run();
+        } finally {
+            performLeaseCheck();

Review Comment:
   Haven't tested this, but isn't it possible that the operation throws an 
exception and the lease check in **finally** also fails, so the 
DocumentStoreException from the lease check would mask the exception thrown by 
the operation?



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