mirror of https://github.com/apache/nifi.git
Merge branch 'NIFI-1414'
This commit is contained in:
commit
348831b20c
|
@ -535,21 +535,22 @@ public class TailFile extends AbstractProcessor {
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<File> rolledOffFiles = new ArrayList<>();
|
final List<File> rolledOffFiles = new ArrayList<>();
|
||||||
final DirectoryStream<Path> dirStream = Files.newDirectoryStream(directory.toPath(), rollingPattern);
|
try (final DirectoryStream<Path> dirStream = Files.newDirectoryStream(directory.toPath(), rollingPattern)) {
|
||||||
for (final Path path : dirStream) {
|
for (final Path path : dirStream) {
|
||||||
final File file = path.toFile();
|
final File file = path.toFile();
|
||||||
final long lastMod = file.lastModified();
|
final long lastMod = file.lastModified();
|
||||||
|
|
||||||
if (file.lastModified() < minTimestamp) {
|
if (file.lastModified() < minTimestamp) {
|
||||||
getLogger().debug("Found rolled off file {} but its last modified timestamp is before the cutoff (Last Mod = {}, Cutoff = {}) so will not consume it",
|
getLogger().debug("Found rolled off file {} but its last modified timestamp is before the cutoff (Last Mod = {}, Cutoff = {}) so will not consume it",
|
||||||
new Object[] {file, lastMod, minTimestamp});
|
new Object[] {file, lastMod, minTimestamp});
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
} else if (file.equals(tailFile)) {
|
} else if (file.equals(tailFile)) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
rolledOffFiles.add(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
rolledOffFiles.add(file);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sort files based on last modified timestamp. If same timestamp, use filename as a secondary sort, as often
|
// Sort files based on last modified timestamp. If same timestamp, use filename as a secondary sort, as often
|
||||||
|
|
Loading…
Reference in New Issue