short-circuit master notification when registering trial license

Original commit: elastic/x-pack-elasticsearch@877df7705b
This commit is contained in:
Areek Zillur 2014-11-04 16:45:24 -05:00
parent 8007136e63
commit 73754767dd

View File

@ -392,6 +392,7 @@ public class LicensesService extends AbstractLifecycleComponent<LicensesService>
logLicenseMetaDataStats("old", oldLicensesMetaData); logLicenseMetaDataStats("old", oldLicensesMetaData);
logLicenseMetaDataStats("new", currentLicensesMetaData); logLicenseMetaDataStats("new", currentLicensesMetaData);
// register any pending listeners
if (!pendingListeners.isEmpty()) { if (!pendingListeners.isEmpty()) {
ListenerHolder pendingRegistrationListener; ListenerHolder pendingRegistrationListener;
while ((pendingRegistrationListener = pendingListeners.poll()) != null) { while ((pendingRegistrationListener = pendingListeners.poll()) != null) {
@ -563,21 +564,18 @@ public class LicensesService extends AbstractLifecycleComponent<LicensesService>
return false; return false;
} }
} }
registeredListeners.add(listenerHolder);
} else { } else {
// notify feature as clusterChangedEvent may not happen // notify feature as clusterChangedEvent may not happen
// as no trial or signed license has been found for feature // as no trial or signed license has been found for feature
logger.debug("Calling notifyFeaturesAndScheduleNotification [no trial license spec provided]"); logger.debug("Calling notifyFeaturesAndScheduleNotification [no trial license spec provided]");
registeredListeners.add(listenerHolder);
notifyFeaturesAndScheduleNotification(currentMetaData);
} }
} else { } else {
// signed license already found for the new registered // signed license already found for the new registered
// feature, notify feature on registration // feature, notify feature on registration
logger.debug("Calling notifyFeaturesAndScheduleNotification [signed/trial license available]"); logger.debug("Calling notifyFeaturesAndScheduleNotification [signed/trial license available]");
registeredListeners.add(listenerHolder);
notifyFeaturesAndScheduleNotification(currentMetaData);
} }
registeredListeners.add(listenerHolder);
notifyFeaturesAndScheduleNotification(currentMetaData);
return true; return true;
} }