averma21 commented on a change in pull request #383:
URL: https://github.com/apache/jackrabbit-oak/pull/383#discussion_r727903237



##########
File path: 
oak-run-commons/src/main/java/org/apache/jackrabbit/oak/index/indexer/document/flatfile/DefaultMemoryManager.java
##########
@@ -209,11 +211,15 @@ public void handleNotification(Notification notification,
                     .getType()
                     
.equals(MemoryNotificationInfo.MEMORY_COLLECTION_THRESHOLD_EXCEEDED)) {
                 if (sufficientMemory.get()) {
-                    CompositeData cd = (CompositeData) notification
-                            .getUserData();
-                    MemoryNotificationInfo info = MemoryNotificationInfo
-                            .from(cd);
-                    checkMemory(info.getUsage());
+                    synchronized (sufficientMemory) {
+                        if (sufficientMemory.get()) {

Review comment:
       As per the current code, we don't want to call checkMemory again, if 
sufficientMemory is already false, hence this approach.




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