org.apache.hadoop.yarn.api.records
Class ContainerId

java.lang.Object
  extended by org.apache.hadoop.yarn.api.records.ContainerId
All Implemented Interfaces:
Comparable<ContainerId>

@InterfaceAudience.Public
@InterfaceStability.Stable
public abstract class ContainerId
extends Object
implements Comparable<ContainerId>

ContainerId represents a globally unique identifier for a Container in the cluster.


Field Summary
static long CONTAINER_ID_BITMASK
           
 
Constructor Summary
ContainerId()
           
 
Method Summary
protected abstract  void build()
           
 int compareTo(ContainerId other)
           
 boolean equals(Object obj)
           
static ContainerId fromString(String containerIdStr)
           
abstract  ApplicationAttemptId getApplicationAttemptId()
          Get the ApplicationAttemptId of the application to which the Container was assigned.
abstract  long getContainerId()
          Get the identifier of the ContainerId.
abstract  int getId()
          Deprecated. 
 int hashCode()
           
static ContainerId newContainerId(ApplicationAttemptId appAttemptId, long containerId)
           
static ContainerId newInstance(ApplicationAttemptId appAttemptId, int containerId)
          Deprecated. 
protected abstract  void setApplicationAttemptId(ApplicationAttemptId atId)
           
protected abstract  void setContainerId(long id)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

CONTAINER_ID_BITMASK

public static final long CONTAINER_ID_BITMASK
See Also:
Constant Field Values
Constructor Detail

ContainerId

public ContainerId()
Method Detail

newContainerId

@InterfaceAudience.Private
@InterfaceStability.Unstable
public static ContainerId newContainerId(ApplicationAttemptId appAttemptId,
                                                                                               long containerId)

newInstance

@InterfaceAudience.Private
@Deprecated
@InterfaceStability.Unstable
public static ContainerId newInstance(ApplicationAttemptId appAttemptId,
                                                                                                       int containerId)
Deprecated. 


getApplicationAttemptId

@InterfaceAudience.Public
@InterfaceStability.Stable
public abstract ApplicationAttemptId getApplicationAttemptId()
Get the ApplicationAttemptId of the application to which the Container was assigned.

Note: If containers are kept alive across application attempts via ApplicationSubmissionContext.setKeepContainersAcrossApplicationAttempts(boolean) the ContainerId does not necessarily contain the current running application attempt's ApplicationAttemptId This container can be allocated by previously exited application attempt and managed by the current running attempt thus have the previous application attempt's ApplicationAttemptId.

Returns:
ApplicationAttemptId of the application to which the Container was assigned

setApplicationAttemptId

@InterfaceAudience.Private
@InterfaceStability.Unstable
protected abstract void setApplicationAttemptId(ApplicationAttemptId atId)

getId

@InterfaceAudience.Public
@Deprecated
@InterfaceStability.Stable
public abstract int getId()
Deprecated. 

Get the lower 32 bits of identifier of the ContainerId, which doesn't include epoch. Note that this method will be marked as deprecated, so please use getContainerId instead.

Returns:
lower 32 bits of identifier of the ContainerId

getContainerId

@InterfaceAudience.Public
@InterfaceStability.Unstable
public abstract long getContainerId()
Get the identifier of the ContainerId. 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

@InterfaceAudience.Private
@InterfaceStability.Unstable
protected abstract void setContainerId(long id)

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

compareTo

public int compareTo(ContainerId other)
Specified by:
compareTo in interface Comparable<ContainerId>

toString

public String toString()
Overrides:
toString in class Object
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

@InterfaceAudience.Public
@InterfaceStability.Unstable
public static ContainerId fromString(String containerIdStr)

build

protected abstract void build()


Copyright © 2014 Apache Software Foundation. All Rights Reserved.