incorporate feedback

Original commit: elastic/x-pack-elasticsearch@f10ea80143
This commit is contained in:
Areek Zillur 2016-07-07 16:22:42 -04:00
parent 7e3fac9b35
commit 57544b8688
2 changed files with 7 additions and 16 deletions

View File

@ -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

View File

@ -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 {