[
https://issues.apache.org/jira/browse/NIFI-4144?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16073773#comment-16073773
]
ASF GitHub Bot commented on NIFI-4144:
--------------------------------------
Github user pvillard31 commented on a diff in the pull request:
https://github.com/apache/nifi/pull/1966#discussion_r125489189
--- Diff:
nifi-nar-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/main/java/org/apache/nifi/processors/hadoop/ListHDFS.java
---
@@ -171,18 +211,29 @@ public void onPropertyModified(final
PropertyDescriptor descriptor, final String
* Determines which of the given FileStatus's describes a File that
should be listed.
*
* @param statuses the eligible FileStatus objects that we could
potentially list
+ * @param context processor context with properties values
* @return a Set containing only those FileStatus objects that we want
to list
*/
- Set<FileStatus> determineListable(final Set<FileStatus> statuses) {
+ Set<FileStatus> determineListable(final Set<FileStatus> statuses,
ProcessContext context) {
final long minTimestamp = this.latestTimestampListed;
final TreeMap<Long, List<FileStatus>> orderedEntries = new
TreeMap<>();
+ final Long minAgeProp =
context.getProperty(MIN_AGE).asTimePeriod(TimeUnit.MILLISECONDS);
+ final long minimumAge = (minAgeProp == null) ? 0L : minAgeProp;
+ final Long maxAgeProp =
context.getProperty(MAX_AGE).asTimePeriod(TimeUnit.MILLISECONDS);
+ final long maximumAge = (maxAgeProp == null) ? Long.MAX_VALUE :
maxAgeProp;
+
// Build a sorted map to determine the latest possible entries
for (final FileStatus status : statuses) {
if (status.getPath().getName().endsWith("_COPYING_")) {
continue;
}
+ final long fileAge = System.currentTimeMillis() -
status.getModificationTime();
--- End diff --
Oh right, good catch! I'll fix that.
> Add minimum/maximum file age properties to ListHDFS
> ---------------------------------------------------
>
> Key: NIFI-4144
> URL: https://issues.apache.org/jira/browse/NIFI-4144
> Project: Apache NiFi
> Issue Type: Improvement
> Components: Extensions
> Reporter: Pierre Villard
> Assignee: Pierre Villard
> Priority: Minor
>
> In some situations it would be interesting to have the minimum/maximum file
> age properties in ListHDFS as we have in GetHDFS.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)