java.lang.Object
org.elasticsearch.common.component.AbstractLifecycleComponent
org.elasticsearch.license.ClusterStateLicenseService
- All Implemented Interfaces:
Closeable,AutoCloseable,ClusterStateListener,LifecycleComponent,SchedulerEngine.Listener,org.elasticsearch.core.Releasable,MutableLicenseService,LicenseService
public class ClusterStateLicenseService
extends AbstractLifecycleComponent
implements MutableLicenseService, ClusterStateListener, SchedulerEngine.Listener
Service responsible for managing
LicensesMetadata.
On the master node, the service handles updating the cluster state when a new license is registered.
It also listens on all nodes for cluster state updates, and updates XPackLicenseState when
the license changes are detected in the cluster state.
-
Field Summary
FieldsFields inherited from class org.elasticsearch.common.component.AbstractLifecycleComponent
lifecycle -
Constructor Summary
ConstructorsConstructorDescriptionClusterStateLicenseService(Settings settings, ThreadPool threadPool, ClusterService clusterService, Clock clock, XPackLicenseState xPacklicenseState, FeatureService featureService) -
Method Summary
Modifier and TypeMethodDescriptionvoidWhen there is no global block onGatewayService.STATE_NOT_RECOVERED_BLOCKnotify licensees and issue auto-generated license if no license has been installed/issued yet.protected voiddoClose()protected voiddoStart()protected voiddoStop()Get the current license.getLicense(Metadata metadata) voidregisterLicense(PutLicenseRequest request, ActionListener<PutLicenseResponse> listener) Registers new license in the cluster Master only operation.voidremoveLicense(org.elasticsearch.core.TimeValue masterNodeTimeout, org.elasticsearch.core.TimeValue ackTimeout, ActionListener<? extends AcknowledgedResponse> listener) Remove license from the cluster state metadatavoidstartBasicLicense(PostStartBasicRequest request, ActionListener<PostStartBasicResponse> listener) Installs a basic license.voidstartTrialLicense(PostStartTrialRequest request, ActionListener<PostStartTrialResponse> listener) Installs a trial license.voidtriggered(SchedulerEngine.Event event) Methods inherited from class org.elasticsearch.common.component.AbstractLifecycleComponent
addLifecycleListener, close, lifecycleState, start, stopMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.elasticsearch.common.component.LifecycleComponent
addLifecycleListener, lifecycleState, start, stopMethods inherited from interface org.elasticsearch.core.Releasable
close
-
Field Details
-
LICENSE_JOB
- See Also:
-
-
Constructor Details
-
ClusterStateLicenseService
public ClusterStateLicenseService(Settings settings, ThreadPool threadPool, ClusterService clusterService, Clock clock, XPackLicenseState xPacklicenseState, FeatureService featureService)
-
-
Method Details
-
registerLicense
Registers new license in the cluster Master only operation. Installs a new license on the master provided it is VALID- Specified by:
registerLicensein interfaceMutableLicenseService
-
triggered
- Specified by:
triggeredin interfaceSchedulerEngine.Listener
-
removeLicense
public void removeLicense(org.elasticsearch.core.TimeValue masterNodeTimeout, org.elasticsearch.core.TimeValue ackTimeout, ActionListener<? extends AcknowledgedResponse> listener) Remove license from the cluster state metadata- Specified by:
removeLicensein interfaceMutableLicenseService
-
getLicense
Description copied from interface:LicenseServiceGet the current license. Reading the license directly should generally be avoided and license decisions should generally preferXPackLicenseStateand/orLicensedFeature.- Specified by:
getLicensein interfaceLicenseService- Returns:
- the current license, null or
LicensesMetadata.LICENSE_TOMBSTONEif no license is available.
-
startTrialLicense
public void startTrialLicense(PostStartTrialRequest request, ActionListener<PostStartTrialResponse> listener) Description copied from interface:MutableLicenseServiceInstalls a trial license.- Specified by:
startTrialLicensein interfaceMutableLicenseService
-
startBasicLicense
public void startBasicLicense(PostStartBasicRequest request, ActionListener<PostStartBasicResponse> listener) Description copied from interface:MutableLicenseServiceInstalls a basic license.- Specified by:
startBasicLicensein interfaceMutableLicenseService
-
doStart
- Specified by:
doStartin classAbstractLifecycleComponent- Throws:
ElasticsearchException
-
doStop
- Specified by:
doStopin classAbstractLifecycleComponent- Throws:
ElasticsearchException
-
doClose
- Specified by:
doClosein classAbstractLifecycleComponent- Throws:
ElasticsearchException
-
clusterChanged
When there is no global block onGatewayService.STATE_NOT_RECOVERED_BLOCKnotify licensees and issue auto-generated license if no license has been installed/issued yet.- Specified by:
clusterChangedin interfaceClusterStateListener
-
getLicense
-