@Override
public void registerTaskAttempt(TezTaskAttemptID attemptId,
ContainerId containerId) {
ContainerInfo containerInfo = registeredContainers.get(containerId);
if(containerInfo == null) {
throw new TezUncheckedException("Registering task attempt: "
+ attemptId + " to unknown container: " + containerId);
}
synchronized (containerInfo) {
if(containerInfo.currentAttemptId != null) {
throw new TezUncheckedException("Registering task attempt: "
+ attemptId + " to container: " + containerId
+ " with existing assignment to: " + containerInfo.currentAttemptId);
}
containerInfo.currentAttemptId = attemptId;
ContainerId containerIdFromMap = attemptToInfoMap.put(attemptId, containerId);
if(containerIdFromMap != null) {
throw new TezUncheckedException("Registering task attempt: "
+ attemptId + " to container: " + containerId
+ " when already assigned to: " + containerIdFromMap);
}
}
}