Github user markap14 commented on a diff in the pull request:
https://github.com/apache/nifi/pull/2733#discussion_r190229672
--- Diff:
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ListFile.java
---
@@ -255,43 +262,47 @@ public void onScheduled(final ProcessContext context)
{
final Path absPath = filePath.toAbsolutePath();
final String absPathString = absPath.getParent().toString() +
File.separator;
+ final DateFormat formatter = new
SimpleDateFormat(FILE_MODIFY_DATE_ATTR_FORMAT, Locale.US);
--- End diff --
We don't recommend ever using ThreadLocal for processors in NiFi. This is
because each time a Processor is run, it is done in a potentially different
thread. For a large deployment you could have hundreds of threads, and the
threads stay around for the life of the instance, so the cleanup is a little
awkward. The pattern that we commonly follow is to use a BlockingQueue and poll
from that, then create if necessary, and put back. I.e., a simple Object Pool.
And I did consider it but decided that the complexity that it adds to the code
was not worth it, given the cost of creating the DateFormat.
---