Package com.yahoo.vespa.model.container
Class Container
java.lang.Object
com.yahoo.config.model.producer.AnyConfigProducer
com.yahoo.config.model.producer.TreeConfigProducer<AnyConfigProducer>
com.yahoo.vespa.model.AbstractService
com.yahoo.vespa.model.container.Container
- All Implemented Interfaces:
com.yahoo.config.ConfigInstance.Producer,com.yahoo.container.ComponentsConfig.Producer,com.yahoo.container.core.ContainerHttpConfig.Producer,com.yahoo.container.jdisc.ContainerMbusConfig.Producer,com.yahoo.container.jdisc.JdiscBindingsConfig.Producer,com.yahoo.container.QrConfig.Producer,ConfigProducer,NetworkPortRequestor,Service,Serializable
- Direct Known Subclasses:
ApplicationContainer,ClusterControllerContainer,LogserverContainer,MetricsProxyContainer
public abstract class Container
extends AbstractService
implements com.yahoo.container.QrConfig.Producer, com.yahoo.container.ComponentsConfig.Producer, com.yahoo.container.jdisc.JdiscBindingsConfig.Producer, com.yahoo.container.core.ContainerHttpConfig.Producer, com.yahoo.container.jdisc.ContainerMbusConfig.Producer
Note about components: In general, all components should belong to the cluster and not the container. However,
components that need node specific config must be added at the container level, along with the node-specific
parts of the config generation (getConfig).
- Author:
- gjoranv, Einar M R Rosenvinge, Tony Vaagenes
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intprotected intprotected intstatic final intprotected final TreeConfigProducer<?>static final StringFields inherited from class com.yahoo.vespa.model.AbstractService
portsMetaFields inherited from class com.yahoo.config.model.producer.AnyConfigProducer
log -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedContainer(TreeConfigProducer<?> parent, String name, boolean retired, int index, DeployState deployState) protectedContainer(TreeConfigProducer<?> parent, String name, int index, DeployState deployState) -
Method Summary
Modifier and TypeMethodDescriptionvoidfinal voidfinal voidfinal voidaddSimpleComponent(String idSpec, String classSpec, String bundleSpec) voidallocatePorts(int start, PortAllocBridge from) allocate the ports you needprotected Optional<ContainerCluster>Returns the jvm args set explicitly for this nodevoidgetConfig(com.yahoo.container.ComponentsConfig.Builder builder) voidgetConfig(com.yahoo.container.core.ContainerHttpConfig.Builder builder) voidgetConfig(com.yahoo.container.jdisc.ContainerMbusConfig.Builder builder) final voidgetConfig(com.yahoo.container.jdisc.JdiscBindingsConfig.Builder builder) voidgetConfig(com.yahoo.container.QrConfig.Builder builder) Overridden by subclasses.intThe service HTTP port for health statusgetHttp()intReturns the number of ports needed by this service.protected intintfinal StringSubclasses must implementmyServiceType()for a custom service name.Must be overridden by services that should be started by config-sentinel.intReturns the desired base port for the first instance of the service type.final intindex()Returns the index of this node.voidinitService(DeployState deployState) Called by builder class which has not given the host or port in a constructor, hence initService is not yet run for this.booleanTrue if this container is retired (slated for removal)protected abstract com.yahoo.config.model.api.container.ContainerServiceTypeSubclasses must implement this for a custom service name.protected intprotected intprotected StringprepareStopCommand(Duration timeout) booleanFirst container must run on ports familiar to the user.voidsetClusterName(String name) voidsetHostResponseHeaderKey(Optional<String> hostResponseheaderKey) If present, this container should emit this header key with the value set to the local hostname in HTTP responsesvoidinstance can use any port number for its default HTTP serverMethods inherited from class com.yahoo.vespa.model.AbstractService
addEnvironmentVariable, addEnvironmentVariable, appendJvmOptions, defaultPreload, distributeCpuSocketAffinity, getAffinity, getEnvStringForTesting, getEnvVars, getHost, getHostName, getHostResource, getId, getIndex, getJvmOptions, getNumPortsAllocated, getPortsMeta, getPreLoad, getPreShutdownCommand, getRelativePort, getServiceInfo, getServiceName, getServicePropertyString, getServicePropertyString, isInitialized, prependJvmOptions, remove, setAffinity, setBasePort, setCoreOnOOM, setHostResource, setJvmOptions, setMMapNoCoreLimit, setNoVespaMalloc, setPreLoad, setProp, setProp, setVespaMalloc, setVespaMallocDebug, setVespaMallocDebugStackTrace, toStringMethods inherited from class com.yahoo.config.model.producer.TreeConfigProducer
addChild, addDescendantService, getChildren, getChildrenByTypeRecursive, getConfigClassLoader, getDescendantServices, removeChild, validateMethods inherited from class com.yahoo.config.model.producer.AnyConfigProducer
addConfigId, addUserConfig, cascadeConfig, currentConfigId, findInheritedClassLoader, getConfigId, getMonitoringService, getParent, getRoot, getSubId, getUserConfigs, hostSystem, mergeUserConfigs, setParent, setUserConfigs, stateIsHostedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.yahoo.vespa.model.ConfigProducer
addUserConfig, cascadeConfig, dump, getChildren, getConfigId, getDescendantServices, getUserConfigs, hostSystem, validateMethods inherited from interface com.yahoo.vespa.model.NetworkPortRequestor
getConfigId
-
Field Details
-
BASEPORT
public static final int BASEPORT -
SINGLENODE_CONTAINER_SERVICESPEC
- See Also:
-
parent
-
allocatedSearchPort
protected int allocatedSearchPort -
allocatedRpcPort
protected int allocatedRpcPort -
allocatedMessagingPort
protected int allocatedMessagingPort
-
-
Constructor Details
-
Container
-
Container
protected Container(TreeConfigProducer<?> parent, String name, boolean retired, int index, DeployState deployState)
-
-
Method Details
-
isRetired
public boolean isRetired()True if this container is retired (slated for removal) -
getHandlers
-
getComponents
-
addComponent
-
addSimpleComponent
-
addHandler
-
setHostResponseHeaderKey
If present, this container should emit this header key with the value set to the local hostname in HTTP responses -
getHttp
-
getDefaultHttpServer
-
index
public final int index()Returns the index of this node. The index of a given node is stable through changes with best effort. -
addBuiltinHandlers
public void addBuiltinHandlers() -
initService
Description copied from class:AbstractServiceCalled by builder class which has not given the host or port in a constructor, hence initService is not yet run for this.- Overrides:
initServicein classAbstractService
-
getServiceType
Subclasses must implementmyServiceType()for a custom service name.- Specified by:
getServiceTypein interfaceNetworkPortRequestor- Overrides:
getServiceTypein classAbstractService
-
myServiceType
protected abstract com.yahoo.config.model.api.container.ContainerServiceType myServiceType()Subclasses must implement this for a custom service name. -
setClusterName
-
getWantedPort
public int getWantedPort()Description copied from class:AbstractServiceReturns the desired base port for the first instance of the service type. Returns '0' as default, which means that the service type should use the default port allocation mechanism.- Specified by:
getWantedPortin interfaceNetworkPortRequestor- Overrides:
getWantedPortin classAbstractService- Returns:
- The desired base port for the first instance of the service type.
-
useDynamicPorts
public void useDynamicPorts()instance can use any port number for its default HTTP server -
requiresWantedPort
public boolean requiresWantedPort()First container must run on ports familiar to the user.- Specified by:
requiresWantedPortin interfaceNetworkPortRequestor- Overrides:
requiresWantedPortin classAbstractService- Returns:
- false by default
-
getPortCount
public int getPortCount()Description copied from interface:NetworkPortRequestorReturns the number of ports needed by this service. User-defined ports for container http servers should not be counted, as those ports are required to be outside Vespa's port range.- Specified by:
getPortCountin interfaceNetworkPortRequestor- Returns:
- the number of ports needed by the Container
-
allocatePorts
Description copied from interface:NetworkPortRequestorallocate the ports you need- Specified by:
allocatePortsin interfaceNetworkPortRequestor
-
getSearchPort
public int getSearchPort()- Returns:
- the actual search port
TODO: Remove. Use
AbstractService.getPortsMeta()and check tags in conjunction withAbstractService.getRelativePort(int).
-
getRpcPort
protected int getRpcPort() -
numRpcPorts
protected int numRpcPorts() -
numMessageBusPorts
protected int numMessageBusPorts() -
getHealthPort
public int getHealthPort()Description copied from class:AbstractServiceThe service HTTP port for health status- Specified by:
getHealthPortin interfaceService- Overrides:
getHealthPortin classAbstractService
-
getStartupCommand
Description copied from class:AbstractServiceMust be overridden by services that should be started by config-sentinel. The returned value will be used in config-sentinel configuration. Returns empty by default.- Specified by:
getStartupCommandin interfaceService- Overrides:
getStartupCommandin classAbstractService- Returns:
- empty by default.
-
getConfig
public void getConfig(com.yahoo.container.QrConfig.Builder builder) - Specified by:
getConfigin interfacecom.yahoo.container.QrConfig.Producer
-
getAssignedJvmOptions
Returns the jvm args set explicitly for this node -
getConfig
public void getConfig(com.yahoo.container.ComponentsConfig.Builder builder) - Specified by:
getConfigin interfacecom.yahoo.container.ComponentsConfig.Producer
-
getConfig
public final void getConfig(com.yahoo.container.jdisc.JdiscBindingsConfig.Builder builder) - Specified by:
getConfigin interfacecom.yahoo.container.jdisc.JdiscBindingsConfig.Producer
-
getConfig
public void getConfig(com.yahoo.container.core.ContainerHttpConfig.Builder builder) - Specified by:
getConfigin interfacecom.yahoo.container.core.ContainerHttpConfig.Producer
-
getConfig
public void getConfig(com.yahoo.container.jdisc.ContainerMbusConfig.Builder builder) - Specified by:
getConfigin interfacecom.yahoo.container.jdisc.ContainerMbusConfig.Producer
-
getDefaultMetricDimensions
Description copied from class:AbstractServiceOverridden by subclasses. List of default dimensions to be added to this services metrics- Specified by:
getDefaultMetricDimensionsin interfaceService- Overrides:
getDefaultMetricDimensionsin classAbstractService- Returns:
- the default dimensions for this service
-
prepareStopCommand
-
containerCluster
-
getLogctlSpecs
- Specified by:
getLogctlSpecsin interfaceService
-