diff --git a/elasticsearch/x-pack/license-plugin/src/main/java/org/elasticsearch/license/plugin/core/LicensesService.java b/elasticsearch/x-pack/license-plugin/src/main/java/org/elasticsearch/license/plugin/core/LicensesService.java index 55aa1a71139..3f1eb7fde33 100644 --- a/elasticsearch/x-pack/license-plugin/src/main/java/org/elasticsearch/license/plugin/core/LicensesService.java +++ b/elasticsearch/x-pack/license-plugin/src/main/java/org/elasticsearch/license/plugin/core/LicensesService.java @@ -394,11 +394,7 @@ public class LicensesService extends AbstractLifecycleComponent implements Clust @Override protected void doStart() throws ElasticsearchException { clusterService.add(this); - try { - scheduler.start(Collections.emptyList()); - } catch (Exception e) { - logger.warn("failed to start license trigger service", e); - } + scheduler.start(Collections.emptyList()); } @Override @@ -433,16 +429,13 @@ public class LicensesService extends AbstractLifecycleComponent implements Clust logger.debug("current [{}]", currentLicensesMetaData); } // notify all interested plugins - if (previousClusterState.blocks().hasGlobalBlock(GatewayService.STATE_NOT_RECOVERED_BLOCK)) { - onUpdate(currentLicensesMetaData); - } else { - if (prevLicensesMetaData == null) { - if (currentLicensesMetaData != null) { - onUpdate(currentLicensesMetaData); - } - } else if (!prevLicensesMetaData.equals(currentLicensesMetaData)) { + if (previousClusterState.blocks().hasGlobalBlock(GatewayService.STATE_NOT_RECOVERED_BLOCK) + || prevLicensesMetaData == null) { + if (currentLicensesMetaData != null) { onUpdate(currentLicensesMetaData); } + } else if (!prevLicensesMetaData.equals(currentLicensesMetaData)) { + onUpdate(currentLicensesMetaData); } // auto-generate license if no licenses ever existed // this will trigger a subsequent cluster changed event diff --git a/elasticsearch/x-pack/license-plugin/src/test/java/org/elasticsearch/license/plugin/core/LicensesManagerServiceTests.java b/elasticsearch/x-pack/license-plugin/src/test/java/org/elasticsearch/license/plugin/core/LicensesManagerServiceTests.java index 2b604681327..b7d8f75afa2 100644 --- a/elasticsearch/x-pack/license-plugin/src/test/java/org/elasticsearch/license/plugin/core/LicensesManagerServiceTests.java +++ b/elasticsearch/x-pack/license-plugin/src/test/java/org/elasticsearch/license/plugin/core/LicensesManagerServiceTests.java @@ -109,9 +109,7 @@ public class LicensesManagerServiceTests extends ESSingleNodeTestCase { // ensure that the invalid license never made it to cluster state LicensesMetaData licensesMetaData = clusterService.state().metaData().custom(LicensesMetaData.TYPE); - if (licensesMetaData != null) { - assertThat(licensesMetaData.getLicense(), not(equalTo(tamperedLicense))); - } + assertThat(licensesMetaData.getLicense(), not(equalTo(tamperedLicense))); } public void testRemoveLicenses() throws Exception {