Class ContainerId
java.lang.Object
org.apache.hadoop.yarn.api.records.ContainerId
- All Implemented Interfaces:
Comparable<ContainerId>
ContainerId represents a globally unique identifier
for a Container in the cluster.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidbuild()intcompareTo(ContainerId other) booleanstatic ContainerIdfromString(String containerIdStr) abstract ApplicationAttemptIdGet theApplicationAttemptIdof the application to which theContainerwas assigned.abstract longGet the identifier of theContainerId.abstract intgetId()Deprecated.inthashCode()static ContainerIdnewContainerId(ApplicationAttemptId appAttemptId, long containerId) static ContainerIdnewInstance(ApplicationAttemptId appAttemptId, int containerId) Deprecated.protected abstract voidsetApplicationAttemptId(ApplicationAttemptId atId) protected abstract voidsetContainerId(long id) toString()
-
Field Details
-
CONTAINER_ID_BITMASK
public static final long CONTAINER_ID_BITMASK- See Also:
-
-
Constructor Details
-
ContainerId
public ContainerId()
-
-
Method Details
-
newContainerId
@Public @Unstable public static ContainerId newContainerId(ApplicationAttemptId appAttemptId, long containerId) -
newInstance
@Private @Deprecated @Unstable public static ContainerId newInstance(ApplicationAttemptId appAttemptId, int containerId) Deprecated. -
getApplicationAttemptId
Get theApplicationAttemptIdof the application to which theContainerwas assigned.Note: If containers are kept alive across application attempts via
ApplicationSubmissionContext.setKeepContainersAcrossApplicationAttempts(boolean)theContainerIddoes not necessarily contain the current running application attempt'sApplicationAttemptIdThis container can be allocated by previously exited application attempt and managed by the current running attempt thus have the previous application attempt'sApplicationAttemptId.- Returns:
ApplicationAttemptIdof the application to which theContainerwas assigned
-
setApplicationAttemptId
-
getId
Deprecated.Get the lower 32 bits of identifier of theContainerId, which doesn't include epoch. Note that this method will be marked as deprecated, so please usegetContainerIdinstead.- Returns:
- lower 32 bits of identifier of the
ContainerId
-
getContainerId
@Public @Unstable public abstract long getContainerId()Get the identifier of theContainerId. Upper 24 bits are reserved as epoch of cluster, and lower 40 bits are reserved as sequential number of containers.- Returns:
- identifier of the
ContainerId
-
setContainerId
@Private @Unstable protected abstract void setContainerId(long id) -
hashCode
public int hashCode() -
equals
-
compareTo
- Specified by:
compareToin interfaceComparable<ContainerId>
-
toString
- Overrides:
toStringin classObject- Returns:
- A string representation of containerId. The format is container_e*epoch*_*clusterTimestamp*_*appId*_*attemptId*_*containerId* when epoch is larger than 0 (e.g. container_e17_1410901177871_0001_01_000005). *epoch* is increased when RM restarts or fails over. When epoch is 0, epoch is omitted (e.g. container_1410901177871_0001_01_000005).
-
fromString
-
build
protected abstract void build()
-