SOLR-10996: Log the right listener config on exception and added a null check before init

This commit is contained in:
Shalin Shekhar Mangar 2017-08-14 17:20:59 +05:30
parent 5e5462e408
commit 5c691d4542
1 changed files with 8 additions and 10 deletions

View File

@ -417,7 +417,7 @@ public class ScheduledTriggers implements Closeable {
try {
oldListener.close();
} catch (Exception e) {
log.warn("Exception closing old listener " + listener.getConfig(), e);
log.warn("Exception closing old listener " + oldListener.getConfig(), e);
}
} else {
listener = oldListener; // reuse
@ -430,17 +430,15 @@ public class ScheduledTriggers implements Closeable {
} catch (Exception e) {
log.warn("Invalid TriggerListener class name '" + clazz + "', skipping...", e);
}
try {
listener.init(coreContainer, config);
listenersPerName.put(config.name, listener);
} catch (Exception e) {
log.warn("Error initializing TriggerListener " + config, e);
if (listener != null) {
try {
listener.close();
} catch (Exception e1) {
// ignore
listener.init(coreContainer, config);
listenersPerName.put(config.name, listener);
} catch (Exception e) {
log.warn("Error initializing TriggerListener " + config, e);
IOUtils.closeQuietly(listener);
listener = null;
}
listener = null;
}
}
if (listener == null) {