Package org.elasticsearch.license
Class LicenseService
- java.lang.Object
-
- org.elasticsearch.common.component.AbstractLifecycleComponent
-
- org.elasticsearch.license.LicenseService
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,ClusterStateListener,LifecycleComponent,Releasable,SchedulerEngine.Listener
public class LicenseService extends AbstractLifecycleComponent implements ClusterStateListener, SchedulerEngine.Listener
Service responsible for managingLicensesMetaData.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
XPackLicenseStatewhen the license changes are detected in the cluster state.
-
-
Field Summary
Fields Modifier and Type Field Description static longBASIC_SELF_GENERATED_LICENSE_EXPIRATION_MILLISstatic java.lang.StringLICENSE_JOBstatic Setting<java.lang.String>SELF_GENERATED_LICENSE_TYPE-
Fields inherited from class org.elasticsearch.common.component.AbstractLifecycleComponent
lifecycle
-
-
Constructor Summary
Constructors Constructor Description LicenseService(Settings settings, ClusterService clusterService, java.time.Clock clock, Environment env, ResourceWatcherService resourceWatcherService, XPackLicenseState licenseState)
-
Method Summary
Modifier and Type Method Description voidclusterChanged(ClusterChangedEvent event)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.protected voiddoClose()protected voiddoStart()protected voiddoStop()static java.util.Map<java.lang.String,java.lang.String[]>getAckMessages(License newLicense, License currentLicense)LicensegetLicense()static LicensegetLicense(MetaData metaData)voidregisterLicense(PutLicenseRequest request, ActionListener<PutLicenseResponse> listener)Registers new license in the cluster Master only operation.voidremoveLicense(DeleteLicenseRequest request, ActionListener<ClusterStateUpdateResponse> listener)Remove license from the cluster state metadatavoidtriggered(SchedulerEngine.Event event)protected voidupdateLicenseState(License license, Version mostRecentTrialVersion)-
Methods inherited from class org.elasticsearch.common.component.AbstractLifecycleComponent
addLifecycleListener, close, lifecycleState, removeLifecycleListener, start, stop
-
-
-
-
Field Detail
-
SELF_GENERATED_LICENSE_TYPE
public static final Setting<java.lang.String> SELF_GENERATED_LICENSE_TYPE
-
BASIC_SELF_GENERATED_LICENSE_EXPIRATION_MILLIS
public static final long BASIC_SELF_GENERATED_LICENSE_EXPIRATION_MILLIS
-
LICENSE_JOB
public static final java.lang.String LICENSE_JOB
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
LicenseService
public LicenseService(Settings settings, ClusterService clusterService, java.time.Clock clock, Environment env, ResourceWatcherService resourceWatcherService, XPackLicenseState licenseState)
-
-
Method Detail
-
registerLicense
public void registerLicense(PutLicenseRequest request, ActionListener<PutLicenseResponse> listener)
Registers new license in the cluster Master only operation. Installs a new license on the master provided it is VALID
-
getAckMessages
public static java.util.Map<java.lang.String,java.lang.String[]> getAckMessages(License newLicense, License currentLicense)
-
triggered
public void triggered(SchedulerEngine.Event event)
- Specified by:
triggeredin interfaceSchedulerEngine.Listener
-
removeLicense
public void removeLicense(DeleteLicenseRequest request, ActionListener<ClusterStateUpdateResponse> listener)
Remove license from the cluster state metadata
-
getLicense
public License getLicense()
-
doStart
protected void doStart() throws ElasticsearchException- Specified by:
doStartin classAbstractLifecycleComponent- Throws:
ElasticsearchException
-
doStop
protected void doStop() throws ElasticsearchException- Specified by:
doStopin classAbstractLifecycleComponent- Throws:
ElasticsearchException
-
doClose
protected void doClose() throws ElasticsearchException- Specified by:
doClosein classAbstractLifecycleComponent- Throws:
ElasticsearchException
-
clusterChanged
public void clusterChanged(ClusterChangedEvent event)
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
-
updateLicenseState
protected void updateLicenseState(License license, Version mostRecentTrialVersion)
-
-