[FIX] Do not emit feature license status on shutdown

closes elastic/elasticsearch#33

Original commit: elastic/x-pack-elasticsearch@caa49a52c5
This commit is contained in:
Areek Zillur 2014-12-05 11:29:28 -05:00
parent 108bb149bd
commit fd1011b32a
1 changed files with 6 additions and 4 deletions

View File

@ -354,7 +354,7 @@ public class LicensesService extends AbstractLifecycleComponent<LicensesService>
// notify features to be disabled // notify features to be disabled
for (ListenerHolder holder : registeredListeners) { for (ListenerHolder holder : registeredListeners) {
holder.disableFeatureIfNeeded(); holder.disableFeatureIfNeeded(false);
} }
// clear all handlers // clear all handlers
registeredListeners.clear(); registeredListeners.clear();
@ -468,7 +468,7 @@ public class LicensesService extends AbstractLifecycleComponent<LicensesService>
nextScheduleFrequency = Math.min(expiryDuration, nextScheduleFrequency); nextScheduleFrequency = Math.min(expiryDuration, nextScheduleFrequency);
} }
} else { } else {
listenerHolder.disableFeatureIfNeeded(); listenerHolder.disableFeatureIfNeeded(true);
} }
if (logger.isDebugEnabled()) { if (logger.isDebugEnabled()) {
@ -740,10 +740,12 @@ public class LicensesService extends AbstractLifecycleComponent<LicensesService>
} }
} }
private void disableFeatureIfNeeded() { private void disableFeatureIfNeeded(boolean log) {
if (enabled.compareAndSet(true, false)) { if (enabled.compareAndSet(true, false)) {
listener.onDisabled(); listener.onDisabled();
logger.info("license for [" + feature + "] - expired"); if (log) {
logger.info("license for [" + feature + "] - expired");
}
} }
} }