diff --git a/src/main/java/org/elasticsearch/license/plugin/core/LicensesService.java b/src/main/java/org/elasticsearch/license/plugin/core/LicensesService.java index a643001e1e1..dcbb17815df 100644 --- a/src/main/java/org/elasticsearch/license/plugin/core/LicensesService.java +++ b/src/main/java/org/elasticsearch/license/plugin/core/LicensesService.java @@ -51,6 +51,11 @@ import static org.elasticsearch.license.core.ESLicenses.reduceAndMap; * - LicensesManagerService - responsible for managing signed and one-time-trial licenses * - LicensesClientService - responsible for feature registration and notification to consumer plugin(s) *

+ * Registration Scheme: + * A consumer plugin (feature) is registered with {@link LicensesClientService#register(String, TrialLicenseOptions, LicensesClientService.Listener)} + * This method can be called at any time during the life-cycle of the consumer plugin. + * + * *

* Notification Scheme: *

@@ -430,6 +435,7 @@ public class LicensesService extends AbstractLifecycleComponent return; } notifyFeaturesAndScheduleNotification(currentLicensesMetaData); + lastObservedLicensesState.set(currentLicensesMetaData); } /** @@ -495,7 +501,6 @@ public class LicensesService extends AbstractLifecycleComponent } } - lastObservedLicensesState.set(currentLicensesMetaData); return nextScheduleFrequency; } diff --git a/src/test/java/org/elasticsearch/license/plugin/LicensesServiceTests.java b/src/test/java/org/elasticsearch/license/plugin/LicensesServiceTests.java index 0ad5558433e..9ea15eeb0ef 100644 --- a/src/test/java/org/elasticsearch/license/plugin/LicensesServiceTests.java +++ b/src/test/java/org/elasticsearch/license/plugin/LicensesServiceTests.java @@ -293,7 +293,7 @@ public class LicensesServiceTests extends AbstractLicensesIntegrationTests { } putAndCheckSignedLicensesAction(masterLicensesManagerService, Arrays.asList(license), LicensesStatus.VALID); } - }, 0, 1, "should trigger onEnable once [signed license]"); + }, 0, 1, "should trigger onEnable for " + feature + " once [signed license]"); } private Action registerWithoutTrialLicense(final LicensesClientService clientService, final LicensesClientService.Listener clientListener, final String feature) { @@ -317,7 +317,7 @@ public class LicensesServiceTests extends AbstractLicensesIntegrationTests { ClusterChangedEvent event = new ClusterChangedEvent("", clusterService().state(), clusterService().state()); licensesService.clusterChanged(event); } - }, 0, 1, "should trigger onEnable once [trial license]"); + }, 0, 1, "should trigger onEnable for " + feature + " once [trial license]"); } private Action assertExpiryAction(String licenseType, TimeValue expiryDuration) {