NIFI-450: Catch Throwable from all implementations of Runnable in the FileSystemRepository; these are expected to always be running, so if anything odd like an OutOfMemoryError occurs, this needs to be caught rather than allowing the thread to die

This commit is contained in:
Mark Payne 2015-03-23 15:19:18 -04:00
parent d6408046bc
commit 54f3476a4c

View File

@ -791,6 +791,7 @@ public class FileSystemRepository implements ContentRepository {
@Override
public void run() {
try {
// Get all of the Destructable Claims and bin them based on their Container. We do this
// because the Container generally maps to a physical partition on the disk, so we want a few
// different threads hitting the different partitions but don't want multiple threads hitting
@ -820,6 +821,9 @@ public class FileSystemRepository implements ContentRepository {
}
}
}
} catch (final Throwable t) {
LOG.error("Failed to cleanup content claims due to {}", t);
}
}
}
@ -1198,6 +1202,7 @@ public class FileSystemRepository implements ContentRepository {
@Override
public void run() {
try {
if (oldestArchiveDate.get() > (System.currentTimeMillis() - maxArchiveMillis)) {
final Long minRequiredSpace = minUsableContainerBytesForArchive.get(containerName);
if (minRequiredSpace == null) {
@ -1214,7 +1219,6 @@ public class FileSystemRepository implements ContentRepository {
}
}
try {
Thread.currentThread().setName("Cleanup Archive for " + containerName);
final long oldestContainerArchive;