Component (Apache Hadoop Main 3.5.0 API)
Description: declaration: package: org.apache.hadoop.yarn.service.api.records, class: Component

Package org.apache.hadoop.yarn.service.api.records

# Class Component

java.lang.Object
org.apache.hadoop.yarn.service.api.records.Component

All Implemented Interfaces:
  `Serializable`

@Public @Unstable public class Component extends Object implements Serializable
One or more components of the service. If the service is HBase say, then the component can be a simple role like master or regionserver. If the service is a complex business webapp then a component can be other services say Kafka or Storm. Thereby it opens up the support for complex and nested services.

See Also:
  - Serialized Form

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static enum`
  `Component.RestartPolicyEnum`
  Policy of restart component.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Component()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addContainer(Container container)`
  `void`
  `addDecommissionedInstance(String componentInstanceName)`
  `Component`
  `artifact(Artifact artifact)`
  Artifact of the component (optional).
  `Component`
  `configuration(Configuration configuration)`
  Config properties for this component.
  `Component`
  `decommissionedInstances(List<String> decommissionedInstances)`
  A list of decommissioned component instances.
  `Component`
  `dependencies(List<String> dependencies)`
  An array of service components which should be in READY state (as defined by readiness check), before this component can be started.
  `boolean`
  `equals(Object o)`
  `Artifact`
  `getArtifact()`
  `Container`
  `getComponentInstance(String compInstanceName)`
  `Configuration`
  `getConfiguration()`
  `Container`
  `getContainer(String id)`
  `List<Container>`
  `getContainers()`
  `List<String>`
  `getDecommissionedInstances()`
  `List<String>`
  `getDependencies()`
  `String`
  `getLaunchCommand()`
  `String`
  `getName()`
  `Long`
  `getNumberOfContainers()`
  `PlacementPolicy`
  `getPlacementPolicy()`
  `List<String>`
  `getQuicklinks()`
  `ReadinessCheck`
  `getReadinessCheck()`
  `Resource`
  `getResource()`
  `Component.RestartPolicyEnum`
  `getRestartPolicy()`
  Policy of restart component.
  `Boolean`
  `getRunPrivilegedContainer()`
  `ComponentState`
  `getState()`
  `int`
  `hashCode()`
  `Component`
  `launchCommand(String launchCommand)`
  The custom launch command of this component (optional).
  `void`
  `mergeFrom(Component that)`
  Merge from another component into this component without overwriting.
  `Component`
  `name(String name)`
  Name of the service component (mandatory).
  `Component`
  `numberOfContainers(Long numberOfContainers)`
  Number of containers for this component (optional).
  `void`
  `overwrite(Component that)`
  `Component`
  `placementPolicy(PlacementPolicy placementPolicy)`
  Advanced scheduling and placement policies for all containers of this component.
  `Component`
  `quicklinks(List<String> quicklinks)`
  A list of quicklink keys defined at the service level, and to be resolved by this component.
  `Component`
  `readinessCheck(ReadinessCheck readinessCheck)`
  Readiness check for this component.
  `void`
  `removeContainer(Container container)`
  `Component`
  `resource(Resource resource)`
  Resource of this component (optional).
  `Component`
  `restartPolicy(Component.RestartPolicyEnum restartPolicyEnumVal)`
  `Component`
  `runPrivilegedContainer(Boolean runPrivilegedContainer)`
  Run all containers of this component in privileged mode (YARN-4262).
  `void`
  `setArtifact(Artifact artifact)`
  `void`
  `setConfiguration(Configuration configuration)`
  `void`
  `setContainers(List<Container> containers)`
  `void`
  `setDecommissionedInstances(List<String> decommissionedInstances)`
  `void`
  `setDependencies(List<String> dependencies)`
  `void`
  `setLaunchCommand(String launchCommand)`
  `void`
  `setName(String name)`
  `void`
  `setNumberOfContainers(Long numberOfContainers)`
  `void`
  `setPlacementPolicy(PlacementPolicy placementPolicy)`
  `void`
  `setQuicklinks(List<String> quicklinks)`
  `void`
  `setReadinessCheck(ReadinessCheck readinessCheck)`
  `void`
  `setResource(Resource resource)`
  `void`
  `setRestartPolicy(Component.RestartPolicyEnum restartPolicy)`
  `void`
  `setRunPrivilegedContainer(Boolean runPrivilegedContainer)`
  `void`
  `setState(ComponentState state)`
  `Component`
  `state(ComponentState state)`
  `String`
  `toString()`

  ### Methods inherited from class java.lang.Object

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### Component

    public Component()

- ## Method Details

  - ### restartPolicy

    public Component restartPolicy(Component.RestartPolicyEnum restartPolicyEnumVal)

  - ### getRestartPolicy

    public Component.RestartPolicyEnum getRestartPolicy()
    Policy of restart component. Including ALWAYS (Always restart component instance even if instance exit code = 0); ON_FAILURE (Only restart component instance if instance exit code != 0); NEVER (Do not restart in any cases)
    Returns:
      restartPolicy

  - ### setRestartPolicy

    public void setRestartPolicy(Component.RestartPolicyEnum restartPolicy)

  - ### name

    public Component name(String name)
    Name of the service component (mandatory).

  - ### getName

    public String getName()

  - ### setName

    public void setName(String name)

  - ### dependencies

    public Component dependencies(List<String> dependencies)
    An array of service components which should be in READY state (as defined by readiness check), before this component can be started. The dependencies across all components of a service should be represented as a DAG.

  - ### getDependencies

    public List<String> getDependencies()

  - ### setDependencies

    public void setDependencies(List<String> dependencies)

  - ### readinessCheck

    public Component readinessCheck(ReadinessCheck readinessCheck)
    Readiness check for this component.

  - ### getReadinessCheck

    public ReadinessCheck getReadinessCheck()

  - ### setReadinessCheck

    public void setReadinessCheck(ReadinessCheck readinessCheck)

  - ### artifact

    public Component artifact(Artifact artifact)
    Artifact of the component (optional). If not specified, the service level global artifact takes effect.

  - ### getArtifact

    public Artifact getArtifact()

  - ### setArtifact

    public void setArtifact(Artifact artifact)

  - ### launchCommand

    public Component launchCommand(String launchCommand)
    The custom launch command of this component (optional). When specified at the component level, it overrides the value specified at the global level (if any).

  - ### getLaunchCommand

    public String getLaunchCommand()

  - ### setLaunchCommand

    public void setLaunchCommand(String launchCommand)

  - ### resource

    public Component resource(Resource resource)
    Resource of this component (optional). If not specified, the service level global resource takes effect.

  - ### getResource

    public Resource getResource()

  - ### setResource

    public void setResource(Resource resource)

  - ### numberOfContainers

    public Component numberOfContainers(Long numberOfContainers)
    Number of containers for this component (optional). If not specified, the service level global number_of_containers takes effect.

  - ### getNumberOfContainers

    public Long getNumberOfContainers()

  - ### setNumberOfContainers

    public void setNumberOfContainers(Long numberOfContainers)

  - ### decommissionedInstances

    public Component decommissionedInstances(List<String> decommissionedInstances)
    A list of decommissioned component instances.

  - ### getDecommissionedInstances

    public List<String> getDecommissionedInstances()

  - ### setDecommissionedInstances

    public void setDecommissionedInstances(List<String> decommissionedInstances)

  - ### addDecommissionedInstance

    public void addDecommissionedInstance(String componentInstanceName)

  - ### getContainers

    public List<Container> getContainers()

  - ### setContainers

    public void setContainers(List<Container> containers)

  - ### addContainer

    public void addContainer(Container container)

  - ### removeContainer

    public void removeContainer(Container container)

  - ### getContainer

    public Container getContainer(String id)

  - ### getComponentInstance

    public Container getComponentInstance(String compInstanceName)

  - ### runPrivilegedContainer

    public Component runPrivilegedContainer(Boolean runPrivilegedContainer)
    Run all containers of this component in privileged mode (YARN-4262).

  - ### getRunPrivilegedContainer

    public Boolean getRunPrivilegedContainer()

  - ### setRunPrivilegedContainer

    public void setRunPrivilegedContainer(Boolean runPrivilegedContainer)

  - ### placementPolicy

    public Component placementPolicy(PlacementPolicy placementPolicy)
    Advanced scheduling and placement policies for all containers of this component.

  - ### getPlacementPolicy

    public PlacementPolicy getPlacementPolicy()

  - ### setPlacementPolicy

    public void setPlacementPolicy(PlacementPolicy placementPolicy)

  - ### configuration

    public Component configuration(Configuration configuration)
    Config properties for this component.

  - ### getConfiguration

    public Configuration getConfiguration()

  - ### setConfiguration

    public void setConfiguration(Configuration configuration)

  - ### quicklinks

    public Component quicklinks(List<String> quicklinks)
    A list of quicklink keys defined at the service level, and to be resolved by this component.

  - ### getQuicklinks

    public List<String> getQuicklinks()

  - ### setQuicklinks

    public void setQuicklinks(List<String> quicklinks)

  - ### state

    public Component state(ComponentState state)

  - ### getState

    public ComponentState getState()

  - ### setState

    public void setState(ComponentState state)

  - ### equals

    public boolean equals(Object o)
    Overrides:
      `equals` in class `Object`

  - ### hashCode

    public int hashCode()
    Overrides:
      `hashCode` in class `Object`

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`

  - ### mergeFrom

    public void mergeFrom(Component that)
    Merge from another component into this component without overwriting.

  - ### overwrite

    public void overwrite(Component that)