YARN-6979. [Addendum patch] Fixed classname and added javadocs. (Kartheek Muthyala via asuresh)

This commit is contained in:
Arun Suresh 2017-08-20 08:55:13 -07:00
parent 8410d862d3
commit 7a82d7bcea
4 changed files with 28 additions and 19 deletions

View File

@ -21,17 +21,28 @@ package org.apache.hadoop.yarn.server.nodemanager;
import org.apache.hadoop.yarn.api.records.Container;
import java.util.List;
public class CMgrDecreaseContainersResourceEvent extends ContainerManagerEvent {
/**
* Event used by the NodeStatusUpdater to notify the ContainerManager of
* container update commands it received from the RM.
*/
public class CMgrUpdateContainersEvent extends ContainerManagerEvent {
private final List<Container> containersToDecrease;
private final List<Container> containersToUpdate;
public CMgrDecreaseContainersResourceEvent(List<Container>
containersToDecrease) {
super(ContainerManagerEventType.DECREASE_CONTAINERS_RESOURCE);
this.containersToDecrease = containersToDecrease;
/**
* Create event.
* @param containersToUpdate Container to update.
*/
public CMgrUpdateContainersEvent(List<Container> containersToUpdate) {
super(ContainerManagerEventType.UPDATE_CONTAINERS);
this.containersToUpdate = containersToUpdate;
}
public List<Container> getContainersToDecrease() {
return this.containersToDecrease;
/**
* Get containers to update.
* @return List of containers to update.
*/
public List<Container> getContainersToUpdate() {
return this.containersToUpdate;
}
}

View File

@ -21,6 +21,6 @@ package org.apache.hadoop.yarn.server.nodemanager;
public enum ContainerManagerEventType {
FINISH_APPS,
FINISH_CONTAINERS,
DECREASE_CONTAINERS_RESOURCE,
UPDATE_CONTAINERS,
SIGNAL_CONTAINERS
}

View File

@ -1099,12 +1099,10 @@ public class NodeStatusUpdaterImpl extends AbstractService implements
parseCredentials(systemCredentials));
}
List<org.apache.hadoop.yarn.api.records.Container>
containersToDecrease = response.getContainersToUpdate();
if (!containersToDecrease.isEmpty()) {
containersToUpdate = response.getContainersToUpdate();
if (!containersToUpdate.isEmpty()) {
dispatcher.getEventHandler().handle(
new CMgrDecreaseContainersResourceEvent(
containersToDecrease)
);
new CMgrUpdateContainersEvent(containersToUpdate));
}
// SignalContainer request originally comes from end users via

View File

@ -96,7 +96,7 @@ import org.apache.hadoop.yarn.server.api.records.ContainerQueuingLimit;
import org.apache.hadoop.yarn.server.api.records.OpportunisticContainersStatus;
import org.apache.hadoop.yarn.server.nodemanager.CMgrCompletedAppsEvent;
import org.apache.hadoop.yarn.server.nodemanager.CMgrCompletedContainersEvent;
import org.apache.hadoop.yarn.server.nodemanager.CMgrDecreaseContainersResourceEvent;
import org.apache.hadoop.yarn.server.nodemanager.CMgrUpdateContainersEvent;
import org.apache.hadoop.yarn.server.nodemanager.CMgrSignalContainersEvent;
import org.apache.hadoop.yarn.server.nodemanager.ContainerExecutor;
import org.apache.hadoop.yarn.server.nodemanager.ContainerManagerEvent;
@ -1599,11 +1599,11 @@ public class ContainerManagerImpl extends CompositeService implements
"Container Killed by ResourceManager"));
}
break;
case DECREASE_CONTAINERS_RESOURCE:
CMgrDecreaseContainersResourceEvent containersDecreasedEvent =
(CMgrDecreaseContainersResourceEvent) event;
case UPDATE_CONTAINERS:
CMgrUpdateContainersEvent containersDecreasedEvent =
(CMgrUpdateContainersEvent) event;
for (org.apache.hadoop.yarn.api.records.Container container
: containersDecreasedEvent.getContainersToDecrease()) {
: containersDecreasedEvent.getContainersToUpdate()) {
try {
ContainerTokenIdentifier containerTokenIdentifier =
BuilderUtils.newContainerTokenIdentifier(