ARTEMIS-2441 Avoiding NPE on FileLockNodeManager

This commit is contained in:
Clebert Suconic 2019-08-06 10:34:55 -04:00
parent 7fa4d5fa70
commit e2d6d07298
1 changed files with 8 additions and 6 deletions

View File

@ -106,12 +106,14 @@ public class FileLockNodeManager extends NodeManager {
@Override
public synchronized void stop() throws Exception {
for (FileChannel channel : lockChannels) {
try {
channel.close();
} catch (Throwable e) {
// I do not want to interrupt a shutdown. If anything is wrong here, just log it
// it could be a critical error or something like that throwing the system down
logger.warn(e.getMessage(), e);
if (channel != null && channel.isOpen()) {
try {
channel.close();
} catch (Throwable e) {
// I do not want to interrupt a shutdown. If anything is wrong here, just log it
// it could be a critical error or something like that throwing the system down
logger.warn(e.getMessage(), e);
}
}
}