belugabehr commented on a change in pull request #3915: NIFI-6926: Fixed memory 
leak in NiFiAtlasHook
URL: https://github.com/apache/nifi/pull/3915#discussion_r353801287
 
 

 ##########
 File path: 
nifi-nar-bundles/nifi-atlas-bundle/nifi-atlas-reporting-task/src/main/java/org/apache/nifi/atlas/hook/NiFiAtlasHook.java
 ##########
 @@ -55,14 +55,23 @@ public void addMessage(HookNotificationMessage message) {
     }
 
     public void commitMessages() {
-        final NotificationSender notificationSender = new NotificationSender();
+        final NotificationSender notificationSender = 
createNotificationSender();
         notificationSender.setAtlasClient(atlasClient);
         notificationSender.send(messages, this::notifyEntities);
+        messages.clear();
 
 Review comment:
   The fact that the `send` method accepts a function makes me think that the 
send happens asynchronously.  Are you sure that `send` is a blocking method?  
If not, clearing the messages will cause a ConcurrentModificationException

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to