ivan1221 commented on a change in pull request #3552: NIFI-6395: Thread-safety 
bug fixed and added new flag property to han…
URL: https://github.com/apache/nifi/pull/3552#discussion_r334074300
 
 

 ##########
 File path: 
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/CountText.java
 ##########
 @@ -213,10 +220,10 @@ public void onTrigger(ProcessContext context, 
ProcessSession processSession) thr
         }
         AtomicBoolean error = new AtomicBoolean();
 
-        lineCount = 0;
-        lineNonEmptyCount = 0;
-        wordCount = 0;
-        characterCount = 0;
+        final int[] lineCount = {0};
+        final int[] lineNonEmptyCount = {0};
+        final int[] wordCount = {0};
+        final int[] characterCount = {0};
 
 Review comment:
   I personally think that a primitive variable is better than a synchronized 
one when we talk about its use in a local context that does not require 
synchronism. But I understand that this can be confusing.

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