hadoop-mapreduce-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acmur...@apache.org
Subject svn commit: r1087462 [14/20] - in /hadoop/mapreduce/branches/MR-279: ./ mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapred/ mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/jobhistory/ mr-client/...
Date Thu, 31 Mar 2011 22:23:34 GMT
Added: hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/impl/pb/NodeHeartbeatRequestPBImpl.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/impl/pb/NodeHeartbeatRequestPBImpl.java?rev=1087462&view=auto
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/impl/pb/NodeHeartbeatRequestPBImpl.java (added)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/impl/pb/NodeHeartbeatRequestPBImpl.java Thu Mar 31 22:23:22 2011
@@ -0,0 +1,91 @@
+package org.apache.hadoop.yarn.server.api.protocolrecords.impl.pb;
+
+
+import org.apache.hadoop.yarn.api.records.ProtoBase;
+import org.apache.hadoop.yarn.proto.YarnServerCommonProtos.NodeStatusProto;
+import org.apache.hadoop.yarn.proto.YarnServerCommonServiceProtos.NodeHeartbeatRequestProto;
+import org.apache.hadoop.yarn.proto.YarnServerCommonServiceProtos.NodeHeartbeatRequestProtoOrBuilder;
+import org.apache.hadoop.yarn.server.api.protocolrecords.NodeHeartbeatRequest;
+import org.apache.hadoop.yarn.server.api.records.NodeStatus;
+import org.apache.hadoop.yarn.server.api.records.impl.pb.NodeStatusPBImpl;
+
+
+    
+public class NodeHeartbeatRequestPBImpl extends ProtoBase<NodeHeartbeatRequestProto> implements NodeHeartbeatRequest {
+  NodeHeartbeatRequestProto proto = NodeHeartbeatRequestProto.getDefaultInstance();
+  NodeHeartbeatRequestProto.Builder builder = null;
+  boolean viaProto = false;
+  
+  private NodeStatus nodeStatus = null;
+  
+  
+  public NodeHeartbeatRequestPBImpl() {
+    builder = NodeHeartbeatRequestProto.newBuilder();
+  }
+
+  public NodeHeartbeatRequestPBImpl(NodeHeartbeatRequestProto proto) {
+    this.proto = proto;
+    viaProto = true;
+  }
+  
+  public NodeHeartbeatRequestProto getProto() {
+      mergeLocalToProto();
+    proto = viaProto ? proto : builder.build();
+    viaProto = true;
+    return proto;
+  }
+
+  private void mergeLocalToBuilder() {
+    if (this.nodeStatus != null) {
+      builder.setNodeStatus(convertToProtoFormat(this.nodeStatus));
+    }
+  }
+
+  private void mergeLocalToProto() {
+    if (viaProto) 
+      maybeInitBuilder();
+    mergeLocalToBuilder();
+    proto = builder.build();
+    viaProto = true;
+  }
+
+  private void maybeInitBuilder() {
+    if (viaProto || builder == null) {
+      builder = NodeHeartbeatRequestProto.newBuilder(proto);
+    }
+    viaProto = false;
+  }
+    
+  
+  @Override
+  public NodeStatus getNodeStatus() {
+    NodeHeartbeatRequestProtoOrBuilder p = viaProto ? proto : builder;
+    if (this.nodeStatus != null) {
+      return this.nodeStatus;
+    }
+    if (!p.hasNodeStatus()) {
+      return null;
+    }
+    this.nodeStatus = convertFromProtoFormat(p.getNodeStatus());
+    return this.nodeStatus;
+  }
+
+  @Override
+  public void setNodeStatus(NodeStatus nodeStatus) {
+    maybeInitBuilder();
+    if (nodeStatus == null) 
+      builder.clearNodeStatus();
+    this.nodeStatus = nodeStatus;
+  }
+
+  private NodeStatusPBImpl convertFromProtoFormat(NodeStatusProto p) {
+    return new NodeStatusPBImpl(p);
+  }
+
+  private NodeStatusProto convertToProtoFormat(NodeStatus t) {
+    return ((NodeStatusPBImpl)t).getProto();
+  }
+
+
+
+}  

Added: hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/impl/pb/NodeHeartbeatResponsePBImpl.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/impl/pb/NodeHeartbeatResponsePBImpl.java?rev=1087462&view=auto
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/impl/pb/NodeHeartbeatResponsePBImpl.java (added)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/impl/pb/NodeHeartbeatResponsePBImpl.java Thu Mar 31 22:23:22 2011
@@ -0,0 +1,91 @@
+package org.apache.hadoop.yarn.server.api.protocolrecords.impl.pb;
+
+
+import org.apache.hadoop.yarn.api.records.ProtoBase;
+import org.apache.hadoop.yarn.proto.YarnServerCommonProtos.HeartbeatResponseProto;
+import org.apache.hadoop.yarn.proto.YarnServerCommonServiceProtos.NodeHeartbeatResponseProto;
+import org.apache.hadoop.yarn.proto.YarnServerCommonServiceProtos.NodeHeartbeatResponseProtoOrBuilder;
+import org.apache.hadoop.yarn.server.api.protocolrecords.NodeHeartbeatResponse;
+import org.apache.hadoop.yarn.server.api.records.HeartbeatResponse;
+import org.apache.hadoop.yarn.server.api.records.impl.pb.HeartbeatResponsePBImpl;
+
+
+    
+public class NodeHeartbeatResponsePBImpl extends ProtoBase<NodeHeartbeatResponseProto> implements NodeHeartbeatResponse {
+  NodeHeartbeatResponseProto proto = NodeHeartbeatResponseProto.getDefaultInstance();
+  NodeHeartbeatResponseProto.Builder builder = null;
+  boolean viaProto = false;
+  
+  private HeartbeatResponse heartbeatResponse = null;
+  
+  
+  public NodeHeartbeatResponsePBImpl() {
+    builder = NodeHeartbeatResponseProto.newBuilder();
+  }
+
+  public NodeHeartbeatResponsePBImpl(NodeHeartbeatResponseProto proto) {
+    this.proto = proto;
+    viaProto = true;
+  }
+  
+  public NodeHeartbeatResponseProto getProto() {
+      mergeLocalToProto();
+    proto = viaProto ? proto : builder.build();
+    viaProto = true;
+    return proto;
+  }
+
+  private void mergeLocalToBuilder() {
+    if (this.heartbeatResponse != null) {
+      builder.setHeartbeatResponse(convertToProtoFormat(this.heartbeatResponse));
+    }
+  }
+
+  private void mergeLocalToProto() {
+    if (viaProto) 
+      maybeInitBuilder();
+    mergeLocalToBuilder();
+    proto = builder.build();
+    viaProto = true;
+  }
+
+  private void maybeInitBuilder() {
+    if (viaProto || builder == null) {
+      builder = NodeHeartbeatResponseProto.newBuilder(proto);
+    }
+    viaProto = false;
+  }
+    
+  
+  @Override
+  public HeartbeatResponse getHeartbeatResponse() {
+    NodeHeartbeatResponseProtoOrBuilder p = viaProto ? proto : builder;
+    if (this.heartbeatResponse != null) {
+      return this.heartbeatResponse;
+    }
+    if (!p.hasHeartbeatResponse()) {
+      return null;
+    }
+    this.heartbeatResponse = convertFromProtoFormat(p.getHeartbeatResponse());
+    return this.heartbeatResponse;
+  }
+
+  @Override
+  public void setHeartbeatResponse(HeartbeatResponse heartbeatResponse) {
+    maybeInitBuilder();
+    if (heartbeatResponse == null) 
+      builder.clearHeartbeatResponse();
+    this.heartbeatResponse = heartbeatResponse;
+  }
+
+  private HeartbeatResponsePBImpl convertFromProtoFormat(HeartbeatResponseProto p) {
+    return new HeartbeatResponsePBImpl(p);
+  }
+
+  private HeartbeatResponseProto convertToProtoFormat(HeartbeatResponse t) {
+    return ((HeartbeatResponsePBImpl)t).getProto();
+  }
+
+
+
+}  

Added: hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/impl/pb/RegisterNodeManagerRequestPBImpl.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/impl/pb/RegisterNodeManagerRequestPBImpl.java?rev=1087462&view=auto
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/impl/pb/RegisterNodeManagerRequestPBImpl.java (added)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/impl/pb/RegisterNodeManagerRequestPBImpl.java Thu Mar 31 22:23:22 2011
@@ -0,0 +1,107 @@
+package org.apache.hadoop.yarn.server.api.protocolrecords.impl.pb;
+
+
+import org.apache.hadoop.yarn.api.records.ProtoBase;
+import org.apache.hadoop.yarn.api.records.Resource;
+import org.apache.hadoop.yarn.api.records.impl.pb.ResourcePBImpl;
+import org.apache.hadoop.yarn.proto.YarnProtos.ResourceProto;
+import org.apache.hadoop.yarn.proto.YarnServerCommonServiceProtos.RegisterNodeManagerRequestProto;
+import org.apache.hadoop.yarn.proto.YarnServerCommonServiceProtos.RegisterNodeManagerRequestProtoOrBuilder;
+import org.apache.hadoop.yarn.server.api.protocolrecords.RegisterNodeManagerRequest;
+
+
+    
+public class RegisterNodeManagerRequestPBImpl extends ProtoBase<RegisterNodeManagerRequestProto> implements RegisterNodeManagerRequest {
+  RegisterNodeManagerRequestProto proto = RegisterNodeManagerRequestProto.getDefaultInstance();
+  RegisterNodeManagerRequestProto.Builder builder = null;
+  boolean viaProto = false;
+  
+  private Resource resource = null;
+  
+  
+  public RegisterNodeManagerRequestPBImpl() {
+    builder = RegisterNodeManagerRequestProto.newBuilder();
+  }
+
+  public RegisterNodeManagerRequestPBImpl(RegisterNodeManagerRequestProto proto) {
+    this.proto = proto;
+    viaProto = true;
+  }
+  
+  public RegisterNodeManagerRequestProto getProto() {
+      mergeLocalToProto();
+    proto = viaProto ? proto : builder.build();
+    viaProto = true;
+    return proto;
+  }
+
+  private void mergeLocalToBuilder() {
+    if (this.resource != null) {
+      builder.setResource(convertToProtoFormat(this.resource));
+    }
+  }
+
+  private void mergeLocalToProto() {
+    if (viaProto) 
+      maybeInitBuilder();
+    mergeLocalToBuilder();
+    proto = builder.build();
+    viaProto = true;
+  }
+
+  private void maybeInitBuilder() {
+    if (viaProto || builder == null) {
+      builder = RegisterNodeManagerRequestProto.newBuilder(proto);
+    }
+    viaProto = false;
+  }
+    
+  
+  @Override
+  public Resource getResource() {
+    RegisterNodeManagerRequestProtoOrBuilder p = viaProto ? proto : builder;
+    if (this.resource != null) {
+      return this.resource;
+    }
+    if (!p.hasResource()) {
+      return null;
+    }
+    this.resource = convertFromProtoFormat(p.getResource());
+    return this.resource;
+  }
+
+  @Override
+  public void setResource(Resource resource) {
+    maybeInitBuilder();
+    if (resource == null) 
+      builder.clearResource();
+    this.resource = resource;
+  }
+  @Override
+  public String getNode() {
+    RegisterNodeManagerRequestProtoOrBuilder p = viaProto ? proto : builder;
+    if (!p.hasNode()) {
+      return null;
+    }
+    return (p.getNode());
+  }
+
+  @Override
+  public void setNode(String node) {
+    maybeInitBuilder();
+    if (node == null) 
+      builder.clearNode();
+    builder.setNode((node));
+  }
+
+  private ResourcePBImpl convertFromProtoFormat(ResourceProto p) {
+    return new ResourcePBImpl(p);
+  }
+
+  private ResourceProto convertToProtoFormat(Resource t) {
+    return ((ResourcePBImpl)t).getProto();
+  }
+
+
+
+}  

Added: hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/impl/pb/RegisterNodeManagerResponsePBImpl.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/impl/pb/RegisterNodeManagerResponsePBImpl.java?rev=1087462&view=auto
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/impl/pb/RegisterNodeManagerResponsePBImpl.java (added)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/impl/pb/RegisterNodeManagerResponsePBImpl.java Thu Mar 31 22:23:22 2011
@@ -0,0 +1,97 @@
+package org.apache.hadoop.yarn.server.api.protocolrecords.impl.pb;
+
+
+import org.apache.hadoop.yarn.api.records.ProtoBase;
+import org.apache.hadoop.yarn.proto.YarnServerCommonProtos.RegistrationResponseProto;
+import org.apache.hadoop.yarn.proto.YarnServerCommonServiceProtos.RegisterNodeManagerResponseProto;
+import org.apache.hadoop.yarn.proto.YarnServerCommonServiceProtos.RegisterNodeManagerResponseProtoOrBuilder;
+import org.apache.hadoop.yarn.server.api.protocolrecords.RegisterNodeManagerResponse;
+import org.apache.hadoop.yarn.server.api.records.RegistrationResponse;
+import org.apache.hadoop.yarn.server.api.records.impl.pb.RegistrationResponsePBImpl;
+
+
+    
+public class RegisterNodeManagerResponsePBImpl extends ProtoBase<RegisterNodeManagerResponseProto> implements RegisterNodeManagerResponse {
+  RegisterNodeManagerResponseProto proto = RegisterNodeManagerResponseProto.getDefaultInstance();
+  RegisterNodeManagerResponseProto.Builder builder = null;
+  boolean viaProto = false;
+  
+  private RegistrationResponse registartionResponse = null;
+  
+  private boolean rebuild = false;
+  
+  public RegisterNodeManagerResponsePBImpl() {
+    builder = RegisterNodeManagerResponseProto.newBuilder();
+  }
+
+  public RegisterNodeManagerResponsePBImpl(RegisterNodeManagerResponseProto proto) {
+    this.proto = proto;
+    viaProto = true;
+  }
+  
+  public RegisterNodeManagerResponseProto getProto() {
+    if (rebuild)
+      mergeLocalToProto();
+    proto = viaProto ? proto : builder.build();
+    viaProto = true;
+    return proto;
+  }
+
+  private void mergeLocalToBuilder() {
+    if (this.registartionResponse != null) {
+      builder.setRegistrationResponse(convertToProtoFormat(this.registartionResponse));
+      this.registartionResponse = null;
+    }
+  }
+
+  private void mergeLocalToProto() {
+    if (viaProto) 
+      maybeInitBuilder();
+    mergeLocalToBuilder();
+    proto = builder.build();
+    rebuild = false;
+    viaProto = true;
+  }
+
+  private void maybeInitBuilder() {
+    if (viaProto || builder == null) {
+      builder = RegisterNodeManagerResponseProto.newBuilder(proto);
+    }
+    viaProto = false;
+  }
+    
+  
+  @Override
+  public RegistrationResponse getRegistrationResponse() {
+    RegisterNodeManagerResponseProtoOrBuilder p = viaProto ? proto : builder;
+    if (this.registartionResponse != null) {
+      return this.registartionResponse;
+    }
+    if (!p.hasRegistrationResponse()) {
+      return null;
+    }
+    this.registartionResponse = convertFromProtoFormat(p.getRegistrationResponse());
+    rebuild = true;
+    return this.registartionResponse;
+  }
+
+  @Override
+  public void setRegistrationResponse(RegistrationResponse registrationResponse) {
+    maybeInitBuilder();
+    if (registrationResponse == null) 
+      builder.clearRegistrationResponse();
+    this.registartionResponse = registrationResponse;
+    rebuild = true;
+  }
+
+  private RegistrationResponsePBImpl convertFromProtoFormat(RegistrationResponseProto p) {
+    return new RegistrationResponsePBImpl(p);
+  }
+
+  private RegistrationResponseProto convertToProtoFormat(RegistrationResponse t) {
+    return ((RegistrationResponsePBImpl)t).getProto();
+  }
+
+
+
+}  

Added: hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/records/HeartbeatResponse.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/records/HeartbeatResponse.java?rev=1087462&view=auto
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/records/HeartbeatResponse.java (added)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/records/HeartbeatResponse.java Thu Mar 31 22:23:22 2011
@@ -0,0 +1,32 @@
+package org.apache.hadoop.yarn.server.api.records;
+
+import java.util.List;
+
+import org.apache.hadoop.yarn.api.records.ApplicationId;
+import org.apache.hadoop.yarn.api.records.Container;
+
+public interface HeartbeatResponse {
+  public abstract int getResponseId();
+  public abstract boolean getReboot();
+  
+  public abstract List<Container> getContainersToCleanupList();
+  public abstract Container getContainerToCleanup(int index);
+  public abstract int getContainersToCleanupCount();
+  
+  public abstract List<ApplicationId> getApplicationsToCleanupList();
+  public abstract ApplicationId getApplicationsToCleanup(int index);
+  public abstract int getApplicationsToCleanupCount();
+  
+  public abstract void setResponseId(int responseId);
+  public abstract void setReboot(boolean reboot);
+  
+  public abstract void addAllContainersToCleanup(List<Container> containers);
+  public abstract void addContainerToCleanup(Container container);
+  public abstract void removeContainerToCleanup(int index);
+  public abstract void clearContainersToCleanup();
+  
+  public abstract void addAllApplicationsToCleanup(List<ApplicationId> applications);
+  public abstract void addApplicationToCleanup(ApplicationId applicationId);
+  public abstract void removeApplicationToCleanup(int index);
+  public abstract void clearApplicationsToCleanup();
+}

Added: hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/records/NodeId.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/records/NodeId.java?rev=1087462&view=auto
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/records/NodeId.java (added)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/records/NodeId.java Thu Mar 31 22:23:22 2011
@@ -0,0 +1,7 @@
+package org.apache.hadoop.yarn.server.api.records;
+
+public interface NodeId {
+  public abstract int getId();
+  
+  public abstract void setId(int id);
+}

Added: hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/records/NodeStatus.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/records/NodeStatus.java?rev=1087462&view=auto
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/records/NodeStatus.java (added)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/records/NodeStatus.java Thu Mar 31 22:23:22 2011
@@ -0,0 +1,35 @@
+package org.apache.hadoop.yarn.server.api.records;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.hadoop.yarn.api.records.Container;
+
+
+public interface NodeStatus {
+  
+  public abstract NodeId getNodeId();
+  public abstract int getResponseId();
+  public abstract long getLastSeen();
+  
+  public abstract Map<String, List<Container>> getAllContainers();
+  public abstract List<Container> getContainers(String key);
+  
+  public abstract boolean getIsNodeHealthy();
+  public abstract String getHealthReport();
+  public abstract long getLastHealthReport();
+  
+  
+  public abstract void setNodeId(NodeId nodeId);
+  public abstract void setResponseId(int responseId);
+  public abstract void setLastSeen(long lastSeen);
+  
+  public abstract void addAllContainers(Map<String, List<Container>> containers);
+  public abstract void setContainers(String key, List<Container> containers);
+  public abstract void removeContainers(String key);
+  public abstract void clearContainers();
+  
+  public abstract void setIsNodeHealthy(boolean isNodeHealthy);
+  public abstract void setHealthReport(String healthReport);
+  public abstract void setLastHealthReport(long lastHealthReport);
+}

Added: hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/records/RegistrationResponse.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/records/RegistrationResponse.java?rev=1087462&view=auto
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/records/RegistrationResponse.java (added)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/records/RegistrationResponse.java Thu Mar 31 22:23:22 2011
@@ -0,0 +1,11 @@
+package org.apache.hadoop.yarn.server.api.records;
+
+import java.nio.ByteBuffer;
+
+public interface RegistrationResponse {
+  public abstract NodeId getNodeId();
+  public abstract ByteBuffer getSecretKey();
+  
+  public abstract void setNodeId(NodeId nodeId);
+  public abstract void setSecretKey(ByteBuffer secretKey);
+}

Added: hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/records/impl/pb/HeartbeatResponsePBImpl.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/records/impl/pb/HeartbeatResponsePBImpl.java?rev=1087462&view=auto
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/records/impl/pb/HeartbeatResponsePBImpl.java (added)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/records/impl/pb/HeartbeatResponsePBImpl.java Thu Mar 31 22:23:22 2011
@@ -0,0 +1,284 @@
+package org.apache.hadoop.yarn.server.api.records.impl.pb;
+
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.hadoop.yarn.api.records.ApplicationId;
+import org.apache.hadoop.yarn.api.records.Container;
+import org.apache.hadoop.yarn.api.records.ProtoBase;
+import org.apache.hadoop.yarn.api.records.impl.pb.ApplicationIdPBImpl;
+import org.apache.hadoop.yarn.api.records.impl.pb.ContainerPBImpl;
+import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationIdProto;
+import org.apache.hadoop.yarn.proto.YarnProtos.ContainerProto;
+import org.apache.hadoop.yarn.proto.YarnServerCommonProtos.HeartbeatResponseProto;
+import org.apache.hadoop.yarn.proto.YarnServerCommonProtos.HeartbeatResponseProtoOrBuilder;
+import org.apache.hadoop.yarn.server.api.records.HeartbeatResponse;
+
+
+    
+public class HeartbeatResponsePBImpl extends ProtoBase<HeartbeatResponseProto> implements HeartbeatResponse {
+  HeartbeatResponseProto proto = HeartbeatResponseProto.getDefaultInstance();
+  HeartbeatResponseProto.Builder builder = null;
+  boolean viaProto = false;
+  
+  private List<Container> containersToCleanup = null;
+  
+  private List<ApplicationId> applicationsToCleanup = null;
+  
+  
+  public HeartbeatResponsePBImpl() {
+    builder = HeartbeatResponseProto.newBuilder();
+  }
+
+  public HeartbeatResponsePBImpl(HeartbeatResponseProto proto) {
+    this.proto = proto;
+    viaProto = true;
+  }
+  
+  public HeartbeatResponseProto getProto() {
+
+      mergeLocalToProto();
+    proto = viaProto ? proto : builder.build();
+    viaProto = true;
+    return proto;
+  }
+
+  private void mergeLocalToBuilder() {
+    if (this.containersToCleanup != null) {
+      addContainersToCleanupToProto();
+    }
+    if (this.applicationsToCleanup != null) {
+      addApplicationsToCleanupToProto();
+    }
+  }
+
+  private void mergeLocalToProto() {
+    if (viaProto) 
+      maybeInitBuilder();
+    mergeLocalToBuilder();
+    proto = builder.build();
+    viaProto = true;
+  }
+
+  private void maybeInitBuilder() {
+    if (viaProto || builder == null) {
+      builder = HeartbeatResponseProto.newBuilder(proto);
+    }
+    viaProto = false;
+  }
+    
+  
+  @Override
+  public int getResponseId() {
+    HeartbeatResponseProtoOrBuilder p = viaProto ? proto : builder;
+    return (p.getResponseId());
+  }
+
+  @Override
+  public void setResponseId(int responseId) {
+    maybeInitBuilder();
+    builder.setResponseId((responseId));
+  }
+  @Override
+  public boolean getReboot() {
+    HeartbeatResponseProtoOrBuilder p = viaProto ? proto : builder;
+    return (p.getReboot());
+  }
+
+  @Override
+  public void setReboot(boolean reboot) {
+    maybeInitBuilder();
+    builder.setReboot((reboot));
+  }
+  @Override
+  public List<Container> getContainersToCleanupList() {
+    initContainersToCleanup();
+    return this.containersToCleanup;
+  }
+  @Override
+  public Container getContainerToCleanup(int index) {
+    initContainersToCleanup();
+    return this.containersToCleanup.get(index);
+  }
+  @Override
+  public int getContainersToCleanupCount() {
+    initContainersToCleanup();
+    return this.containersToCleanup.size();
+  }
+  
+  private void initContainersToCleanup() {
+    if (this.containersToCleanup != null) {
+      return;
+    }
+    HeartbeatResponseProtoOrBuilder p = viaProto ? proto : builder;
+    List<ContainerProto> list = p.getContainersToCleanupList();
+    this.containersToCleanup = new ArrayList<Container>();
+
+    for (ContainerProto c : list) {
+      this.containersToCleanup.add(convertFromProtoFormat(c));
+    }
+  }
+  
+  @Override
+  public void addAllContainersToCleanup(final List<Container> containersToCleanup) {
+    if (containersToCleanup == null)
+      return;
+    initContainersToCleanup();
+    this.containersToCleanup.addAll(containersToCleanup);
+  }
+  
+  private void addContainersToCleanupToProto() {
+    maybeInitBuilder();
+    builder.clearContainersToCleanup();
+    if (containersToCleanup == null)
+      return;
+    Iterable<ContainerProto> iterable = new Iterable<ContainerProto>() {
+      @Override
+      public Iterator<ContainerProto> iterator() {
+        return new Iterator<ContainerProto>() {
+
+          Iterator<Container> iter = containersToCleanup.iterator();
+
+          @Override
+          public boolean hasNext() {
+            return iter.hasNext();
+          }
+
+          @Override
+          public ContainerProto next() {
+            return convertToProtoFormat(iter.next());
+          }
+
+          @Override
+          public void remove() {
+            throw new UnsupportedOperationException();
+
+          }
+        };
+
+      }
+    };
+    builder.addAllContainersToCleanup(iterable);
+  }
+  @Override
+  public void addContainerToCleanup(Container containersToCleanup) {
+    initContainersToCleanup();
+    this.containersToCleanup.add(containersToCleanup);
+  }
+  @Override
+  public void removeContainerToCleanup(int index) {
+    initContainersToCleanup();
+    this.containersToCleanup.remove(index);
+  }
+  @Override
+  public void clearContainersToCleanup() {
+    initContainersToCleanup();
+    this.containersToCleanup.clear();
+  }
+  @Override
+  public List<ApplicationId> getApplicationsToCleanupList() {
+    initApplicationsToCleanup();
+    return this.applicationsToCleanup;
+  }
+  @Override
+  public ApplicationId getApplicationsToCleanup(int index) {
+    initApplicationsToCleanup();
+    return this.applicationsToCleanup.get(index);
+  }
+  @Override
+  public int getApplicationsToCleanupCount() {
+    initApplicationsToCleanup();
+    return this.applicationsToCleanup.size();
+  }
+  
+  private void initApplicationsToCleanup() {
+    if (this.applicationsToCleanup != null) {
+      return;
+    }
+    HeartbeatResponseProtoOrBuilder p = viaProto ? proto : builder;
+    List<ApplicationIdProto> list = p.getApplicationsToCleanupList();
+    this.applicationsToCleanup = new ArrayList<ApplicationId>();
+
+    for (ApplicationIdProto c : list) {
+      this.applicationsToCleanup.add(convertFromProtoFormat(c));
+    }
+  }
+  
+  @Override
+  public void addAllApplicationsToCleanup(final List<ApplicationId> applicationsToCleanup) {
+    if (applicationsToCleanup == null)
+      return;
+    initApplicationsToCleanup();
+    this.applicationsToCleanup.addAll(applicationsToCleanup);
+  }
+  
+  private void addApplicationsToCleanupToProto() {
+    maybeInitBuilder();
+    builder.clearApplicationsToCleanup();
+    if (applicationsToCleanup == null)
+      return;
+    Iterable<ApplicationIdProto> iterable = new Iterable<ApplicationIdProto>() {
+      @Override
+      public Iterator<ApplicationIdProto> iterator() {
+        return new Iterator<ApplicationIdProto>() {
+
+          Iterator<ApplicationId> iter = applicationsToCleanup.iterator();
+
+          @Override
+          public boolean hasNext() {
+            return iter.hasNext();
+          }
+
+          @Override
+          public ApplicationIdProto next() {
+            return convertToProtoFormat(iter.next());
+          }
+
+          @Override
+          public void remove() {
+            throw new UnsupportedOperationException();
+
+          }
+        };
+
+      }
+    };
+    builder.addAllApplicationsToCleanup(iterable);
+  }
+  @Override
+  public void addApplicationToCleanup(ApplicationId applicationsToCleanup) {
+    initApplicationsToCleanup();
+    this.applicationsToCleanup.add(applicationsToCleanup);
+  }
+  @Override
+  public void removeApplicationToCleanup(int index) {
+    initApplicationsToCleanup();
+    this.applicationsToCleanup.remove(index);
+  }
+  @Override
+  public void clearApplicationsToCleanup() {
+    initApplicationsToCleanup();
+    this.applicationsToCleanup.clear();
+  }
+
+  private ContainerPBImpl convertFromProtoFormat(ContainerProto p) {
+    return new ContainerPBImpl(p);
+  }
+
+  private ContainerProto convertToProtoFormat(Container t) {
+    return ((ContainerPBImpl)t).getProto();
+  }
+
+  private ApplicationIdPBImpl convertFromProtoFormat(ApplicationIdProto p) {
+    return new ApplicationIdPBImpl(p);
+  }
+
+  private ApplicationIdProto convertToProtoFormat(ApplicationId t) {
+    return ((ApplicationIdPBImpl)t).getProto();
+  }
+
+
+
+}  

Added: hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/records/impl/pb/NodeIdPBImpl.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/records/impl/pb/NodeIdPBImpl.java?rev=1087462&view=auto
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/records/impl/pb/NodeIdPBImpl.java (added)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/records/impl/pb/NodeIdPBImpl.java Thu Mar 31 22:23:22 2011
@@ -0,0 +1,53 @@
+package org.apache.hadoop.yarn.server.api.records.impl.pb;
+
+
+import org.apache.hadoop.yarn.api.records.ProtoBase;
+import org.apache.hadoop.yarn.proto.YarnServerCommonProtos.NodeIdProto;
+import org.apache.hadoop.yarn.proto.YarnServerCommonProtos.NodeIdProtoOrBuilder;
+import org.apache.hadoop.yarn.server.api.records.NodeId;
+
+
+    
+public class NodeIdPBImpl extends ProtoBase<NodeIdProto> implements NodeId {
+  NodeIdProto proto = NodeIdProto.getDefaultInstance();
+  NodeIdProto.Builder builder = null;
+  boolean viaProto = false;
+  
+  public NodeIdPBImpl() {
+    builder = NodeIdProto.newBuilder();
+  }
+
+  public NodeIdPBImpl(NodeIdProto proto) {
+    this.proto = proto;
+    viaProto = true;
+  }
+  
+  public NodeIdProto getProto() {
+    proto = viaProto ? proto : builder.build();
+    viaProto = true;
+    return proto;
+  }
+
+  private void maybeInitBuilder() {
+    if (viaProto || builder == null) {
+      builder = NodeIdProto.newBuilder(proto);
+    }
+    viaProto = false;
+  }
+    
+  
+  @Override
+  public int getId() {
+    NodeIdProtoOrBuilder p = viaProto ? proto : builder;
+    return (p.getId());
+  }
+
+  @Override
+  public void setId(int id) {
+    maybeInitBuilder();
+    builder.setId((id));
+  }
+
+
+
+}  

Added: hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/records/impl/pb/NodeStatusPBImpl.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/records/impl/pb/NodeStatusPBImpl.java?rev=1087462&view=auto
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/records/impl/pb/NodeStatusPBImpl.java (added)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/records/impl/pb/NodeStatusPBImpl.java Thu Mar 31 22:23:22 2011
@@ -0,0 +1,298 @@
+package org.apache.hadoop.yarn.server.api.records.impl.pb;
+
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.hadoop.yarn.api.records.Container;
+import org.apache.hadoop.yarn.api.records.ProtoBase;
+import org.apache.hadoop.yarn.api.records.impl.pb.ContainerPBImpl;
+import org.apache.hadoop.yarn.proto.YarnProtos.ContainerProto;
+import org.apache.hadoop.yarn.proto.YarnServerCommonProtos.ContainerListProto;
+import org.apache.hadoop.yarn.proto.YarnServerCommonProtos.NodeIdProto;
+import org.apache.hadoop.yarn.proto.YarnServerCommonProtos.NodeStatusProto;
+import org.apache.hadoop.yarn.proto.YarnServerCommonProtos.NodeStatusProtoOrBuilder;
+import org.apache.hadoop.yarn.proto.YarnServerCommonProtos.StringContainerListMapProto;
+import org.apache.hadoop.yarn.server.api.records.NodeId;
+import org.apache.hadoop.yarn.server.api.records.NodeStatus;
+    
+public class NodeStatusPBImpl extends ProtoBase<NodeStatusProto> implements NodeStatus {
+  NodeStatusProto proto = NodeStatusProto.getDefaultInstance();
+  NodeStatusProto.Builder builder = null;
+  boolean viaProto = false;
+  
+  private NodeId nodeId = null;
+  private Map<String, List<Container>> containers = null;
+  
+
+  
+  public NodeStatusPBImpl() {
+    builder = NodeStatusProto.newBuilder();
+  }
+
+  public NodeStatusPBImpl(NodeStatusProto proto) {
+    this.proto = proto;
+    viaProto = true;
+  }
+  
+  public NodeStatusProto getProto() {
+
+      mergeLocalToProto();
+    proto = viaProto ? proto : builder.build();
+    viaProto = true;
+    return proto;
+  }
+
+  private void mergeLocalToBuilder() {
+    if (this.nodeId != null) {
+      builder.setNodeId(convertToProtoFormat(this.nodeId));
+    }
+    if (this.containers != null) {
+      addContainersToProto();
+    }
+  }
+
+  private void mergeLocalToProto() {
+    if (viaProto) 
+      maybeInitBuilder();
+    mergeLocalToBuilder();
+    proto = builder.build();
+    
+    viaProto = true;
+  }
+
+  private void maybeInitBuilder() {
+    if (viaProto || builder == null) {
+      builder = NodeStatusProto.newBuilder(proto);
+    }
+    viaProto = false;
+  }
+    
+  
+  @Override
+  public int getResponseId() {
+    NodeStatusProtoOrBuilder p = viaProto ? proto : builder;
+    return p.getResponseId();
+  }
+  @Override
+  public void setResponseId(int responseId) {
+    maybeInitBuilder();
+    builder.setResponseId(responseId);
+  }
+  @Override
+  public NodeId getNodeId() {
+    NodeStatusProtoOrBuilder p = viaProto ? proto : builder;
+    if (this.nodeId != null) {
+      return this.nodeId;
+    }
+    if (!p.hasNodeId()) {
+      return null;
+    }
+    this.nodeId = convertFromProtoFormat(p.getNodeId());
+    
+    return this.nodeId;
+  }
+  @Override
+  public void setNodeId(NodeId nodeId) {
+    maybeInitBuilder();
+    if (nodeId == null)
+      builder.clearNodeId();
+    this.nodeId = nodeId;
+    
+  }
+  @Override
+  public long getLastSeen() {
+    NodeStatusProtoOrBuilder p = viaProto ? proto : builder;
+    return p.getLastSeen();
+  }
+  @Override
+  public void setLastSeen(long lastSeen) {
+    maybeInitBuilder();
+    builder.setLastSeen(lastSeen);
+  }
+  
+  @Override
+  public Map<String, List<Container>> getAllContainers() {
+    initContainers();
+    return this.containers;
+  }
+
+  @Override
+  public List<Container> getContainers(String key) {
+    initContainers();
+    if (this.containers.get(key) == null) {
+      this.containers.put(key, new ArrayList<Container>());
+    }
+    return this.containers.get(key);
+  }
+
+  private void initContainers() {
+    if (this.containers != null) {
+      return;
+    }
+    NodeStatusProtoOrBuilder p = viaProto ? proto : builder;
+    List<StringContainerListMapProto> list = p.getContainersList();
+    this.containers = new HashMap<String, List<Container>>();
+
+    for (StringContainerListMapProto c : list) {
+      this.containers.put(c.getKey(), convertFromProtoFormat(c.getValue()));
+    }
+    
+  }
+  
+  @Override
+  public void addAllContainers(final Map<String, List<Container>> containers) {
+    if (containers == null)
+      return;
+    initContainers();
+    this.containers.putAll(containers);
+  }
+  
+  private void addContainersToProto() {
+    maybeInitBuilder();
+    builder.clearContainers();
+    viaProto = false;
+    Iterable<StringContainerListMapProto> iterable = new Iterable<StringContainerListMapProto>() {
+
+      @Override
+      public Iterator<StringContainerListMapProto> iterator() {
+        return new Iterator<StringContainerListMapProto>() {
+
+          Iterator<String> keyIter = containers.keySet().iterator();
+          @Override
+          public boolean hasNext() {
+            return keyIter.hasNext();
+          }
+
+          @Override
+          public StringContainerListMapProto next() {
+            String key = keyIter.next();
+            return StringContainerListMapProto.newBuilder().setKey(key).setValue(convertToProtoFormat(containers.get(key))).build();
+          }
+
+          @Override
+          public void remove() {
+            throw new UnsupportedOperationException();
+          }
+
+        };
+      }
+      
+    };
+    builder.addAllContainers(iterable);
+  }
+  
+  @Override
+  public boolean getIsNodeHealthy() {
+    NodeStatusProtoOrBuilder p = viaProto ? proto : builder;
+    return p.getIsNodeHealthy();
+  }
+  
+  @Override
+  public void setIsNodeHealthy(boolean isNodeHealthy) {
+    maybeInitBuilder();
+    builder.setIsNodeHealthy(isNodeHealthy);
+  }
+  /*
+   * 
+   * @Override
+  public String getApplicationName() {
+    ApplicationSubmissionContextProtoOrBuilder p = viaProto ? proto : builder;
+    if (!p.hasApplicationName()) {
+      return null;
+    }
+    return (p.getApplicationName());
+  }
+
+  @Override
+  public void setApplicationName(String applicationName) {
+    maybeInitBuilder();
+    if (applicationName == null) {
+      builder.clearApplicationName();
+      return;
+    }
+    builder.setApplicationName((applicationName));
+  }
+  */
+  
+  @Override
+  public String getHealthReport() {
+    NodeStatusProtoOrBuilder p = viaProto ? proto : builder;
+    if (!p.hasHealthReport()) {
+      return null;
+    }
+    return (p.getHealthReport()); 
+  }
+  
+  @Override
+  public void setHealthReport(String healthReport) {
+    maybeInitBuilder();
+    if (healthReport == null) {
+      builder.clearHealthReport();
+      return;
+    }
+    builder.setHealthReport((healthReport));
+  }
+  
+  @Override
+  public long getLastHealthReport() {
+    NodeStatusProtoOrBuilder p = viaProto ? proto : builder;
+    return (p.getLastHealthReport());
+  }
+  
+  @Override
+  public void setLastHealthReport(long lastHealthReport) {
+    maybeInitBuilder();
+    builder.setLastHealthReport((lastHealthReport));
+  }
+  
+  private ContainerListProto convertToProtoFormat(List<Container> src) {
+    ContainerListProto.Builder ret = ContainerListProto.newBuilder();
+    for (Container c : src) {
+      ret.addContainer(((ContainerPBImpl)c).getProto());
+    }
+    return ret.build();
+  }
+  
+  private List<Container> convertFromProtoFormat(ContainerListProto src) {
+    List<Container> ret = new ArrayList<Container>();
+    for (ContainerProto c : src.getContainerList()) {
+      ret.add(convertFromProtoFormat(c));
+    }
+    return ret;
+  }
+
+  private Container convertFromProtoFormat(ContainerProto src) {
+    return new ContainerPBImpl(src);
+  }
+  
+  @Override
+  public void setContainers(String key, List<Container> containers) {
+    initContainers();
+    this.containers.put(key, containers);
+  }
+
+  @Override
+  public void removeContainers(String key) {
+    initContainers();
+    this.containers.remove(key);
+  }
+  
+  @Override
+  public void clearContainers() {
+    initContainers();
+    this.containers.clear();
+  }
+
+  private NodeIdProto convertToProtoFormat(NodeId nodeId) {
+    return ((NodeIdPBImpl)nodeId).getProto();
+  }
+  
+  private NodeId convertFromProtoFormat(NodeIdProto proto) {
+    return new NodeIdPBImpl(proto);
+  }
+  
+}  

Added: hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/records/impl/pb/RegistrationResponsePBImpl.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/records/impl/pb/RegistrationResponsePBImpl.java?rev=1087462&view=auto
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/records/impl/pb/RegistrationResponsePBImpl.java (added)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/records/impl/pb/RegistrationResponsePBImpl.java Thu Mar 31 22:23:22 2011
@@ -0,0 +1,117 @@
+package org.apache.hadoop.yarn.server.api.records.impl.pb;
+
+
+import java.nio.ByteBuffer;
+
+import org.apache.hadoop.yarn.api.records.ProtoBase;
+import org.apache.hadoop.yarn.proto.YarnServerCommonProtos.NodeIdProto;
+import org.apache.hadoop.yarn.proto.YarnServerCommonProtos.RegistrationResponseProto;
+import org.apache.hadoop.yarn.proto.YarnServerCommonProtos.RegistrationResponseProtoOrBuilder;
+import org.apache.hadoop.yarn.server.api.records.NodeId;
+import org.apache.hadoop.yarn.server.api.records.RegistrationResponse;
+
+
+    
+public class RegistrationResponsePBImpl extends ProtoBase<RegistrationResponseProto> implements RegistrationResponse {
+  RegistrationResponseProto proto = RegistrationResponseProto.getDefaultInstance();
+  RegistrationResponseProto.Builder builder = null;
+  boolean viaProto = false;
+  
+  private NodeId nodeId = null;
+  private ByteBuffer secretKey = null;
+  
+  
+  
+  public RegistrationResponsePBImpl() {
+    builder = RegistrationResponseProto.newBuilder();
+  }
+
+  public RegistrationResponsePBImpl(RegistrationResponseProto proto) {
+    this.proto = proto;
+    viaProto = true;
+  }
+  
+  public RegistrationResponseProto getProto() {
+    
+      mergeLocalToProto();
+    proto = viaProto ? proto : builder.build();
+    viaProto = true;
+    return proto;
+  }
+
+  private void mergeLocalToBuilder() {
+    if (this.nodeId != null) {
+      builder.setNodeId(convertToProtoFormat(this.nodeId));
+    }
+    if (this.secretKey != null) {
+      builder.setSecretKey(convertToProtoFormat(this.secretKey));
+    }
+  }
+
+  private void mergeLocalToProto() {
+    if (viaProto) 
+      maybeInitBuilder();
+    mergeLocalToBuilder();
+    proto = builder.build();
+    
+    viaProto = true;
+  }
+
+  private void maybeInitBuilder() {
+    if (viaProto || builder == null) {
+      builder = RegistrationResponseProto.newBuilder(proto);
+    }
+    viaProto = false;
+  }
+    
+  
+  @Override
+  public NodeId getNodeId() {
+    RegistrationResponseProtoOrBuilder p = viaProto ? proto : builder;
+    if (this.nodeId != null) {
+      return this.nodeId;
+    }
+    if (!p.hasNodeId()) {
+      return null;
+    }
+    this.nodeId = convertFromProtoFormat(p.getNodeId());
+    return this.nodeId;
+  }
+
+  @Override
+  public void setNodeId(NodeId nodeId) {
+    maybeInitBuilder();
+    if (nodeId == null) 
+      builder.clearNodeId();
+    this.nodeId = nodeId;
+  }
+  @Override
+  public ByteBuffer getSecretKey() {
+    RegistrationResponseProtoOrBuilder p = viaProto ? proto : builder;
+    if (this.secretKey != null) {
+      return this.secretKey;
+    }
+    if (!p.hasSecretKey()) {
+      return null;
+    }
+    this.secretKey = convertFromProtoFormat(p.getSecretKey());
+    return this.secretKey;
+  }
+
+  @Override
+  public void setSecretKey(ByteBuffer secretKey) {
+    maybeInitBuilder();
+    if (secretKey == null) 
+      builder.clearSecretKey();
+    this.secretKey = secretKey;
+  }
+
+  private NodeIdPBImpl convertFromProtoFormat(NodeIdProto p) {
+    return new NodeIdPBImpl(p);
+  }
+
+  private NodeIdProto convertToProtoFormat(NodeId t) {
+    return ((NodeIdPBImpl)t).getProto();
+  }
+
+}  

Added: hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-common/src/main/proto/ResourceTracker.proto
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-common/src/main/proto/ResourceTracker.proto?rev=1087462&view=auto
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-common/src/main/proto/ResourceTracker.proto (added)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-common/src/main/proto/ResourceTracker.proto Thu Mar 31 22:23:22 2011
@@ -0,0 +1,11 @@
+option java_package = "org.apache.hadoop.yarn.proto";
+option java_outer_classname = "ResourceTracker";
+option java_generic_services = true;
+option java_generate_equals_and_hash = true;
+
+import "yarn_server_common_service_protos.proto";
+
+service ResourceTrackerService {
+  rpc registerNodeManager(RegisterNodeManagerRequestProto) returns (RegisterNodeManagerResponseProto);
+  rpc nodeHeartbeat(NodeHeartbeatRequestProto) returns (NodeHeartbeatResponseProto);
+}

Added: hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-common/src/main/proto/yarn_server_common_protos.proto
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-common/src/main/proto/yarn_server_common_protos.proto?rev=1087462&view=auto
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-common/src/main/proto/yarn_server_common_protos.proto (added)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-common/src/main/proto/yarn_server_common_protos.proto Thu Mar 31 22:23:22 2011
@@ -0,0 +1,42 @@
+option java_package = "org.apache.hadoop.yarn.proto";
+option java_outer_classname = "YarnServerCommonProtos";
+option java_generic_services = true;
+option java_generate_equals_and_hash = true;
+
+import "yarn_protos.proto";
+
+message NodeIdProto {
+  optional int32 id = 1;
+}
+
+message NodeStatusProto {
+  optional NodeIdProto node_id = 1;
+  optional int32 response_id = 2;
+  optional int64 last_seen = 3;
+  repeated StringContainerListMapProto containers = 4;
+  optional bool is_node_healthy = 5;
+  optional string health_report = 6;
+  optional int64 last_health_report = 7;
+}
+
+message RegistrationResponseProto {
+  optional NodeIdProto node_id = 1;
+  optional bytes secret_key = 2;
+}
+
+message HeartbeatResponseProto {
+  optional int32 response_id = 1;
+  optional bool reboot = 2;
+  repeated ContainerProto containers_to_cleanup = 3;
+  repeated ApplicationIdProto applications_to_cleanup = 4;
+}
+
+message ContainerListProto {
+  repeated ContainerProto container = 1;
+}
+
+message StringContainerListMapProto {
+  optional string key = 1;
+  optional ContainerListProto value = 2;
+}
+

Added: hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-common/src/main/proto/yarn_server_common_service_protos.proto
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-common/src/main/proto/yarn_server_common_service_protos.proto?rev=1087462&view=auto
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-common/src/main/proto/yarn_server_common_service_protos.proto (added)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-common/src/main/proto/yarn_server_common_service_protos.proto Thu Mar 31 22:23:22 2011
@@ -0,0 +1,23 @@
+option java_package = "org.apache.hadoop.yarn.proto";
+option java_outer_classname = "YarnServerCommonServiceProtos";
+option java_generic_services = true;
+option java_generate_equals_and_hash = true;
+
+import "yarn_protos.proto";
+import "yarn_server_common_protos.proto";
+
+message RegisterNodeManagerRequestProto {
+  optional string node = 1;
+  optional ResourceProto resource = 2;
+}
+message RegisterNodeManagerResponseProto {
+  optional RegistrationResponseProto registration_response = 1;
+}
+
+message NodeHeartbeatRequestProto {
+  optional NodeStatusProto node_status = 1;
+}
+
+message NodeHeartbeatResponseProto {
+  optional HeartbeatResponseProto heartbeat_response = 1;
+}

Added: hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-common/src/test/java/org/apache/hadoop/yarn/TestRPCFactories.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-common/src/test/java/org/apache/hadoop/yarn/TestRPCFactories.java?rev=1087462&view=auto
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-common/src/test/java/org/apache/hadoop/yarn/TestRPCFactories.java (added)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-common/src/test/java/org/apache/hadoop/yarn/TestRPCFactories.java Thu Mar 31 22:23:22 2011
@@ -0,0 +1,96 @@
+package org.apache.hadoop.yarn;
+
+import java.net.InetSocketAddress;
+
+import junit.framework.Assert;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.ipc.Server;
+import org.apache.hadoop.net.NetUtils;
+import org.apache.hadoop.yarn.YarnException;
+import org.apache.hadoop.yarn.exceptions.YarnRemoteException;
+import org.apache.hadoop.yarn.factories.impl.pb.RpcClientFactoryPBImpl;
+import org.apache.hadoop.yarn.factories.impl.pb.RpcServerFactoryPBImpl;
+import org.apache.hadoop.yarn.server.api.ResourceTracker;
+import org.apache.hadoop.yarn.server.api.protocolrecords.NodeHeartbeatRequest;
+import org.apache.hadoop.yarn.server.api.protocolrecords.NodeHeartbeatResponse;
+import org.apache.hadoop.yarn.server.api.protocolrecords.RegisterNodeManagerRequest;
+import org.apache.hadoop.yarn.server.api.protocolrecords.RegisterNodeManagerResponse;
+import org.junit.Test;
+
+public class TestRPCFactories {
+  
+  
+  
+  @Test
+  public void test() {
+    testPbServerFactory();
+    
+    testPbClientFactory();
+  }
+  
+  
+  
+  private void testPbServerFactory() {
+    InetSocketAddress addr = new InetSocketAddress(0);
+    Configuration conf = new Configuration();
+    ResourceTracker instance = new ResourceTrackerTestImpl();
+    Server server = null;
+    try {
+      server = RpcServerFactoryPBImpl.get().getServer(ResourceTracker.class, instance, addr, conf, null);
+      server.start();
+    } catch (YarnException e) {
+      e.printStackTrace();
+      Assert.fail("Failed to create server");
+    } finally {
+      server.stop();
+    }
+  }
+
+  
+  private void testPbClientFactory() {
+    InetSocketAddress addr = new InetSocketAddress(0);
+    System.err.println(addr.getHostName() + addr.getPort());
+    Configuration conf = new Configuration();
+    ResourceTracker instance = new ResourceTrackerTestImpl();
+    Server server = null;
+    try {
+      server = RpcServerFactoryPBImpl.get().getServer(ResourceTracker.class, instance, addr, conf, null);
+      server.start();
+      System.err.println(server.getListenerAddress());
+      System.err.println(NetUtils.getConnectAddress(server));
+
+      ResourceTracker client = null;
+      try {
+        client = (ResourceTracker) RpcClientFactoryPBImpl.get().getClient(ResourceTracker.class, 1, NetUtils.getConnectAddress(server), conf);
+      } catch (YarnException e) {
+        e.printStackTrace();
+        Assert.fail("Failed to create client");
+      }
+      
+    } catch (YarnException e) {
+      e.printStackTrace();
+      Assert.fail("Failed to create server");
+    } finally {
+      server.stop();
+    }     
+  }
+
+  public class ResourceTrackerTestImpl implements ResourceTracker {
+
+    @Override
+    public RegisterNodeManagerResponse registerNodeManager(
+        RegisterNodeManagerRequest request) throws YarnRemoteException {
+      // TODO Auto-generated method stub
+      return null;
+    }
+
+    @Override
+    public NodeHeartbeatResponse nodeHeartbeat(NodeHeartbeatRequest request)
+        throws YarnRemoteException {
+      // TODO Auto-generated method stub
+      return null;
+    }
+    
+  }
+}

Added: hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-common/src/test/java/org/apache/hadoop/yarn/TestRecordFactory.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-common/src/test/java/org/apache/hadoop/yarn/TestRecordFactory.java?rev=1087462&view=auto
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-common/src/test/java/org/apache/hadoop/yarn/TestRecordFactory.java (added)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-common/src/test/java/org/apache/hadoop/yarn/TestRecordFactory.java Thu Mar 31 22:23:22 2011
@@ -0,0 +1,38 @@
+package org.apache.hadoop.yarn;
+
+import junit.framework.Assert;
+
+import org.apache.hadoop.yarn.YarnException;
+import org.apache.hadoop.yarn.factories.RecordFactory;
+import org.apache.hadoop.yarn.factories.impl.pb.RecordFactoryPBImpl;
+import org.apache.hadoop.yarn.server.api.protocolrecords.NodeHeartbeatRequest;
+import org.apache.hadoop.yarn.server.api.protocolrecords.impl.pb.NodeHeartbeatRequestPBImpl;
+import org.apache.hadoop.yarn.server.api.records.HeartbeatResponse;
+import org.apache.hadoop.yarn.server.api.records.impl.pb.HeartbeatResponsePBImpl;
+import org.junit.Test;
+
+public class TestRecordFactory {
+  
+  @Test
+  public void testPbRecordFactory() {
+    RecordFactory pbRecordFactory = RecordFactoryPBImpl.get();
+    
+    try {
+      HeartbeatResponse response = pbRecordFactory.newRecordInstance(HeartbeatResponse.class);
+      Assert.assertEquals(HeartbeatResponsePBImpl.class, response.getClass());
+    } catch (YarnException e) {
+      e.printStackTrace();
+      Assert.fail("Failed to crete record");
+    }
+    
+    try {
+      NodeHeartbeatRequest request = pbRecordFactory.newRecordInstance(NodeHeartbeatRequest.class);
+      Assert.assertEquals(NodeHeartbeatRequestPBImpl.class, request.getClass());
+    } catch (YarnException e) {
+      e.printStackTrace();
+      Assert.fail("Failed to crete record");
+    }
+    
+  }
+
+}

Modified: hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-nodemanager/pom.xml
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-nodemanager/pom.xml?rev=1087462&r1=1087461&r2=1087462&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-nodemanager/pom.xml (original)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-nodemanager/pom.xml Thu Mar 31 22:23:22 2011
@@ -30,6 +30,11 @@
       <artifactId>yarn-server-common</artifactId>
       <version>${yarn.version}</version>
     </dependency>
+    <dependency>
+      <groupId>com.google.protobuf</groupId>
+      <artifactId>protobuf-java</artifactId>
+      <version>2.4.0a</version>
+    </dependency>
   </dependencies>
 
   <profiles>
@@ -119,7 +124,7 @@
           </excludes>
         </configuration>
       </plugin>
-      <plugin>
+      <!--plugin>
         <groupId>org.apache.avro</groupId>
         <artifactId>avro-maven-plugin</artifactId>
         <version>1.4.0-SNAPSHOT</version>
@@ -131,7 +136,72 @@
             </goals>
           </execution>
         </executions>
+      </plugin-->
+
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-antrun-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>create_generate_src_dirctory</id>
+            <phase>initialize</phase>
+            <configuration>
+              <tasks>
+                <mkdir dir="target/generated-sources/proto" />
+              </tasks>
+            </configuration>
+            <goals>
+              <goal>run</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>exec-maven-plugin</artifactId>
+        <version>1.2</version>
+        <executions>
+          <execution>
+            <id>generate-sources</id>
+            <phase>generate-sources</phase>
+            <configuration>
+              <executable>protoc</executable>
+              <arguments>
+                <argument>-I../../yarn-api/src/main/proto/</argument>
+                <argument>-Isrc/main/proto/</argument>
+                <argument>--java_out=target/generated-sources/proto</argument>
+                <argument>src/main/proto/yarn_server_nodemanager_service_protos.proto</argument>
+                <argument>src/main/proto/LocalizationProtocol.proto</argument>
+              </arguments>
+            </configuration>
+            <goals>
+              <goal>exec</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>build-helper-maven-plugin</artifactId>
+        <version>1.5</version>
+        <executions>
+          <execution>
+            <id>add-source</id>
+            <phase>generate-sources</phase>
+            <goals>
+              <goal>add-source</goal>
+            </goals>
+            <configuration>
+              <sources>
+                <source>target/generated-sources/proto</source>
+              </sources>
+            </configuration>
+          </execution>
+        </executions>
       </plugin>
+
     </plugins>
   </build>
 </project>

Modified: hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/CMgrCompletedAppsEvent.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/CMgrCompletedAppsEvent.java?rev=1087462&r1=1087461&r2=1087462&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/CMgrCompletedAppsEvent.java (original)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/CMgrCompletedAppsEvent.java Thu Mar 31 22:23:22 2011
@@ -20,20 +20,20 @@ package org.apache.hadoop.yarn.server.no
 
 import java.util.List;
 
-import org.apache.hadoop.yarn.ApplicationID;
+import org.apache.hadoop.yarn.api.records.ApplicationId;
 import org.apache.hadoop.yarn.server.nodemanager.ContainerManagerEvent;
 import org.apache.hadoop.yarn.server.nodemanager.ContainerManagerEventType;
 
 public class CMgrCompletedAppsEvent extends ContainerManagerEvent {
 
-  private List<ApplicationID> appsToCleanup;
+  private List<ApplicationId> appsToCleanup;
 
-  public CMgrCompletedAppsEvent(List<ApplicationID> appsToCleanup) {
+  public CMgrCompletedAppsEvent(List<ApplicationId> appsToCleanup) {
     super(ContainerManagerEventType.FINISH_APPS);
     this.appsToCleanup = appsToCleanup;
   }
 
-  public List<ApplicationID> getAppsToCleanup() {
+  public List<ApplicationId> getAppsToCleanup() {
     return this.appsToCleanup;
   }
 }

Modified: hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/CMgrCompletedContainersEvent.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/CMgrCompletedContainersEvent.java?rev=1087462&r1=1087461&r2=1087462&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/CMgrCompletedContainersEvent.java (original)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/CMgrCompletedContainersEvent.java Thu Mar 31 22:23:22 2011
@@ -20,7 +20,8 @@ package org.apache.hadoop.yarn.server.no
 
 import java.util.List;
 
-import org.apache.hadoop.yarn.Container;
+import org.apache.hadoop.yarn.api.records.Container;
+
 
 public class CMgrCompletedContainersEvent extends ContainerManagerEvent {
 

Modified: hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/ContainerExecutor.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/ContainerExecutor.java?rev=1087462&r1=1087461&r2=1087462&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/ContainerExecutor.java (original)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/ContainerExecutor.java Thu Mar 31 22:23:22 2011
@@ -31,8 +31,8 @@ import org.apache.hadoop.conf.Configurat
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.fs.permission.FsPermission;
 import org.apache.hadoop.util.Shell.ShellCommandExecutor;
-import org.apache.hadoop.yarn.ContainerID;
-import org.apache.hadoop.yarn.LocalizationProtocol;
+import org.apache.hadoop.yarn.api.records.ContainerId;
+import org.apache.hadoop.yarn.server.nodemanager.api.LocalizationProtocol;
 import org.apache.hadoop.yarn.server.nodemanager.containermanager.container.Container;
 
 public abstract class ContainerExecutor implements Configurable {
@@ -42,8 +42,8 @@ public abstract class ContainerExecutor 
     FsPermission.createImmutable((short) 0700);
 
   private Configuration conf;
-  protected ConcurrentMap<ContainerID, ShellCommandExecutor> launchCommandObjs =
-      new ConcurrentHashMap<ContainerID, ShellCommandExecutor>();
+  protected ConcurrentMap<ContainerId, ShellCommandExecutor> launchCommandObjs =
+      new ConcurrentHashMap<ContainerId, ShellCommandExecutor>();
 
   @Override
   public void setConf(Configuration conf) {
@@ -149,7 +149,7 @@ public abstract class ContainerExecutor 
    * @return the processid of the container if it has already launched,
    *         otherwise return null
    */
-  public String getProcessId(ContainerID containerID) {
+  public String getProcessId(ContainerId containerID) {
     String pid = null;
     ShellCommandExecutor shExec = launchCommandObjs.get(containerID);
     if (shExec == null) {

Modified: hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/Context.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/Context.java?rev=1087462&r1=1087461&r2=1087462&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/Context.java (original)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/Context.java Thu Mar 31 22:23:22 2011
@@ -20,11 +20,11 @@ package org.apache.hadoop.yarn.server.no
 
 import java.util.concurrent.ConcurrentMap;
 
+import org.apache.hadoop.yarn.api.records.ApplicationId;
+import org.apache.hadoop.yarn.api.records.ContainerId;
 import org.apache.hadoop.NodeHealthStatus;
 import org.apache.hadoop.yarn.server.nodemanager.containermanager.application.Application;
 import org.apache.hadoop.yarn.server.nodemanager.containermanager.container.Container;
-import org.apache.hadoop.yarn.ApplicationID;
-import org.apache.hadoop.yarn.ContainerID;
 
 /**
  * Context interface for sharing information across components in the
@@ -32,9 +32,9 @@ import org.apache.hadoop.yarn.ContainerI
  */
 public interface Context {
 
-  public ConcurrentMap<ApplicationID, Application> getApplications();
+  public ConcurrentMap<ApplicationId, Application> getApplications();
 
-  public ConcurrentMap<ContainerID, Container> getContainers();
+  public ConcurrentMap<ContainerId, Container> getContainers();
 
   public NodeHealthStatus getNodeHealthStatus();
 }

Modified: hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/DefaultContainerExecutor.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/DefaultContainerExecutor.java?rev=1087462&r1=1087461&r2=1087462&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/DefaultContainerExecutor.java (original)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/DefaultContainerExecutor.java Thu Mar 31 22:23:22 2011
@@ -32,12 +32,12 @@ import org.apache.hadoop.fs.permission.F
 import org.apache.hadoop.util.Shell.ExitCodeException;
 import org.apache.hadoop.util.Shell.ShellCommandExecutor;
 import org.apache.hadoop.yarn.YarnException;
+import org.apache.hadoop.yarn.server.nodemanager.api.LocalizationProtocol;
 import org.apache.hadoop.yarn.server.nodemanager.containermanager.container.Container;
 import org.apache.hadoop.yarn.server.nodemanager.containermanager.launcher.ContainerLaunch;
 import org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.ApplicationLocalizer;
 import org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.ResourceLocalizationService;
-import org.apache.hadoop.yarn.ApplicationID;
-import org.apache.hadoop.yarn.LocalizationProtocol;
+
 
 public class DefaultContainerExecutor extends ContainerExecutor {
 
@@ -121,7 +121,7 @@ public class DefaultContainerExecutor ex
           new String[] { "bash", "-c", launchDst.toUri().getPath().toString() };
       shExec = new ShellCommandExecutor(command,
           new File(appWorkDir.toUri().getPath()));
-      launchCommandObjs.put(container.getLaunchContext().id, shExec);
+      launchCommandObjs.put(container.getLaunchContext().getContainerId(), shExec);
       shExec.execute();
     } catch (Exception e) {
       if (null == shExec) {
@@ -132,7 +132,7 @@ public class DefaultContainerExecutor ex
       logOutput(shExec.getOutput());
       return exitCode;
     } finally {
-      launchCommandObjs.remove(container.getLaunchContext().id);
+      launchCommandObjs.remove(container.getLaunchContext().getContainerId());
     }
     return 0;
   }

Modified: hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/LinuxContainerExecutor.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/LinuxContainerExecutor.java?rev=1087462&r1=1087461&r2=1087462&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/LinuxContainerExecutor.java (original)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/LinuxContainerExecutor.java Thu Mar 31 22:23:22 2011
@@ -31,11 +31,11 @@ import org.apache.hadoop.conf.Configurat
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.util.Shell.ExitCodeException;
 import org.apache.hadoop.util.Shell.ShellCommandExecutor;
+import org.apache.hadoop.yarn.server.nodemanager.api.LocalizationProtocol;
 import org.apache.hadoop.yarn.server.nodemanager.containermanager.container.Container;
 import org.apache.hadoop.yarn.server.nodemanager.containermanager.launcher.ContainerLaunch;
 import org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.ApplicationLocalizer;
 import org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.ResourceLocalizationService;
-import org.apache.hadoop.yarn.LocalizationProtocol;
 
 public class LinuxContainerExecutor extends ContainerExecutor {
 
@@ -168,7 +168,7 @@ public class LinuxContainerExecutor exte
                     appToken.toUri().getPath().toString()));
     String[] commandArray = command.toArray(new String[command.size()]);
     ShellCommandExecutor shExec = new ShellCommandExecutor(commandArray);
-    launchCommandObjs.put(container.getLaunchContext().id, shExec);
+    launchCommandObjs.put(container.getLaunchContext().getContainerId(), shExec);
     // DEBUG
     LOG.info("launchContainer: " + Arrays.toString(commandArray));
     if (LOG.isDebugEnabled()) {
@@ -191,7 +191,7 @@ public class LinuxContainerExecutor exte
       }
       return exitCode;
     } finally {
-      launchCommandObjs.remove(container.getLaunchContext().id);
+      launchCommandObjs.remove(container.getLaunchContext().getContainerId());
     }
     if (LOG.isDebugEnabled()) {
       LOG.debug("Output from LinuxContainerExecutor's launchTask follows:");

Modified: hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/NodeManager.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/NodeManager.java?rev=1087462&r1=1087461&r2=1087462&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/NodeManager.java (original)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/NodeManager.java Thu Mar 31 22:23:22 2011
@@ -32,9 +32,9 @@ import org.apache.hadoop.NodeHealthStatu
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.security.SecurityUtil;
 import org.apache.hadoop.util.ReflectionUtils;
-import org.apache.hadoop.yarn.ApplicationID;
-import org.apache.hadoop.yarn.ContainerID;
 import org.apache.hadoop.yarn.YarnException;
+import org.apache.hadoop.yarn.api.records.ApplicationId;
+import org.apache.hadoop.yarn.api.records.ContainerId;
 import org.apache.hadoop.yarn.conf.YarnConfiguration;
 import org.apache.hadoop.yarn.event.AsyncDispatcher;
 import org.apache.hadoop.yarn.event.Dispatcher;
@@ -136,17 +136,17 @@ public class NodeManager extends Composi
 
   public static class NMContext implements Context {
 
-    private final ConcurrentMap<ApplicationID, Application> applications =
-        new ConcurrentHashMap<ApplicationID, Application>();
-    private final ConcurrentMap<ContainerID, Container> containers =
-      new ConcurrentSkipListMap<ContainerID,Container>(
-          new Comparator<ContainerID>() {
+    private final ConcurrentMap<ApplicationId, Application> applications =
+        new ConcurrentHashMap<ApplicationId, Application>();
+    private final ConcurrentMap<ContainerId, Container> containers =
+      new ConcurrentSkipListMap<ContainerId,Container>(
+          new Comparator<ContainerId>() {
             @Override
-            public int compare(ContainerID a, ContainerID b) {
-              if (a.appID.id == b.appID.id) {
-                return a.id - b.id;
+            public int compare(ContainerId a, ContainerId b) {
+              if (a.getAppId().getId() == b.getAppId().getId()) {
+                return a.getId() - b.getId();
               }
-              return a.appID.id - b.appID.id;
+              return a.getAppId().getId() - b.getAppId().getId();
             }
             @Override
             public boolean equals(Object other) {
@@ -160,12 +160,12 @@ public class NodeManager extends Composi
     }
 
     @Override
-    public ConcurrentMap<ApplicationID, Application> getApplications() {
+    public ConcurrentMap<ApplicationId, Application> getApplications() {
       return this.applications;
     }
 
     @Override
-    public ConcurrentMap<ContainerID, Container> getContainers() {
+    public ConcurrentMap<ContainerId, Container> getContainers() {
       return this.containers;
     }
 

Modified: hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/NodeStatusUpdaterImpl.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/NodeStatusUpdaterImpl.java?rev=1087462&r1=1087461&r2=1087462&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/NodeStatusUpdaterImpl.java (original)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/NodeStatusUpdaterImpl.java Thu Mar 31 22:23:22 2011
@@ -20,14 +20,12 @@ package org.apache.hadoop.yarn.server.no
 
 import java.net.InetSocketAddress;
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 
 import org.apache.avro.AvroRuntimeException;
-import org.apache.avro.ipc.AvroRemoteException;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.NodeHealthCheckerService;
@@ -37,19 +35,24 @@ import org.apache.hadoop.fs.CommonConfig
 import org.apache.hadoop.net.NetUtils;
 import org.apache.hadoop.security.SecurityInfo;
 import org.apache.hadoop.security.UserGroupInformation;
-import org.apache.hadoop.yarn.ApplicationID;
-import org.apache.hadoop.yarn.ContainerID;
-import org.apache.hadoop.yarn.ContainerState;
-import org.apache.hadoop.yarn.HeartbeatResponse;
-import org.apache.hadoop.yarn.NodeID;
-import org.apache.hadoop.yarn.NodeStatus;
-import org.apache.hadoop.yarn.RegistrationResponse;
-import org.apache.hadoop.yarn.Resource;
-import org.apache.hadoop.yarn.ResourceTracker;
+import org.apache.hadoop.yarn.api.records.ApplicationId;
+import org.apache.hadoop.yarn.api.records.ContainerId;
+import org.apache.hadoop.yarn.api.records.ContainerState;
+import org.apache.hadoop.yarn.api.records.Resource;
 import org.apache.hadoop.yarn.event.Dispatcher;
+import org.apache.hadoop.yarn.exceptions.YarnRemoteException;
+import org.apache.hadoop.yarn.factories.RecordFactory;
+import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider;
 import org.apache.hadoop.yarn.ipc.YarnRPC;
 import org.apache.hadoop.yarn.server.RMNMSecurityInfoClass;
 import org.apache.hadoop.yarn.server.YarnServerConfig;
+import org.apache.hadoop.yarn.server.api.ResourceTracker;
+import org.apache.hadoop.yarn.server.api.protocolrecords.NodeHeartbeatRequest;
+import org.apache.hadoop.yarn.server.api.protocolrecords.RegisterNodeManagerRequest;
+import org.apache.hadoop.yarn.server.api.records.HeartbeatResponse;
+import org.apache.hadoop.yarn.server.api.records.NodeId;
+import org.apache.hadoop.yarn.server.api.records.NodeStatus;
+import org.apache.hadoop.yarn.server.api.records.RegistrationResponse;
 import org.apache.hadoop.yarn.server.nodemanager.containermanager.container.Container;
 import org.apache.hadoop.yarn.service.AbstractService;
 
@@ -68,9 +71,10 @@ public class NodeStatusUpdaterImpl exten
   private String rmAddress;
   private Resource totalResource;
   private String nodeName;
-  private NodeID nodeId;
+  private NodeId nodeId;
   private byte[] secretKeyBytes = new byte[0];
   private boolean isStopped;
+  private RecordFactory recordFactory = RecordFactoryProvider.getRecordFactory(null);
 
   private final NodeHealthCheckerService healthChecker;
 
@@ -91,8 +95,8 @@ public class NodeStatusUpdaterImpl exten
         conf.getLong(NMConfig.HEARTBEAT_INTERVAL,
             NMConfig.DEFAULT_HEARTBEAT_INTERVAL);
     int memory = conf.getInt(NMConfig.NM_RESOURCE, 8);
-    this.totalResource = new Resource();
-    this.totalResource.memory = memory * 1024;
+    this.totalResource = recordFactory.newRecordInstance(Resource.class);
+    this.totalResource.setMemory(memory * 1024);
     super.init(conf);
   }
 
@@ -134,15 +138,18 @@ public class NodeStatusUpdaterImpl exten
         getConfig());
   }
 
-  private void registerWithRM() throws AvroRemoteException {
+  private void registerWithRM() throws YarnRemoteException {
     this.resourceTracker = getRMClient();
     LOG.info("Connected to ResourceManager at " + this.rmAddress);
+    
+    RegisterNodeManagerRequest request = recordFactory.newRecordInstance(RegisterNodeManagerRequest.class);
+    request.setNode(this.nodeName);
+    request.setResource(this.totalResource);
     RegistrationResponse regResponse =
-        this.resourceTracker.registerNodeManager(this.nodeName,
-            this.totalResource);
-    this.nodeId = regResponse.nodeID;
+        this.resourceTracker.registerNodeManager(request).getRegistrationResponse();
+    this.nodeId = regResponse.getNodeId();
     if (UserGroupInformation.isSecurityEnabled()) {
-      this.secretKeyBytes = regResponse.secretKey.array();
+      this.secretKeyBytes = regResponse.getSecretKey().array();
     }
 
     LOG.info("Registered with ResourceManager as " + this.nodeName
@@ -160,37 +167,37 @@ public class NodeStatusUpdaterImpl exten
   }
 
   private NodeStatus getNodeStatus() {
-    NodeStatus status = new NodeStatus();
-    status.nodeId = this.nodeId;
-    status.containers =
-        new HashMap<CharSequence, List<org.apache.hadoop.yarn.Container>>();
-    Map<CharSequence, List<org.apache.hadoop.yarn.Container>> activeContainers =
-        status.containers;
+    NodeStatus status = recordFactory.newRecordInstance(NodeStatus.class);
+    status.setNodeId(this.nodeId);
+
+    Map<String, List<org.apache.hadoop.yarn.api.records.Container>> activeContainers =
+        status.getAllContainers();
 
     int numActiveContainers = 0;
     synchronized (this.context.getContainers()) {
-      for (Iterator<Entry<ContainerID, Container>> i =
+      for (Iterator<Entry<ContainerId, Container>> i =
           this.context.getContainers().entrySet().iterator(); i.hasNext();) {
-        Entry<ContainerID, Container> e = i.next();
-        ContainerID containerId = e.getKey();
+        Entry<ContainerId, Container> e = i.next();
+        ContainerId containerId = e.getKey();
         Container container = e.getValue();
-        CharSequence applicationId = String.valueOf(containerId.appID.id); // TODO: ID? Really?
+        String applicationId = String.valueOf(containerId.getAppId().getId()); // TODO: ID? Really?
 
-        List<org.apache.hadoop.yarn.Container> applicationContainers =
+        List<org.apache.hadoop.yarn.api.records.Container> applicationContainers = status.getContainers(applicationId);
             activeContainers.get(applicationId);
         if (applicationContainers == null) {
-          applicationContainers = new ArrayList<org.apache.hadoop.yarn.Container>();
-          activeContainers.put(applicationId, applicationContainers);
+          applicationContainers = new ArrayList<org.apache.hadoop.yarn.api.records.Container>();
+          status.setContainers(applicationId, applicationContainers);
+//          activeContainers.put(applicationId, applicationContainers);
         }
 
         // Clone the container to send it to the RM
-        org.apache.hadoop.yarn.Container c = container.cloneAndGetContainer();
-        c.hostName = this.nodeName;
+        org.apache.hadoop.yarn.api.records.Container c = container.cloneAndGetContainer();
+        c.setHostName(this.nodeName);
         applicationContainers.add(c);
         ++numActiveContainers;
         LOG.info("Sending out status for container: " + c);
 
-        if (c.state == ContainerState.COMPLETE) {
+        if (c.getState() == ContainerState.COMPLETE) {
           // Remove
           i.remove();
 
@@ -205,9 +212,9 @@ public class NodeStatusUpdaterImpl exten
     if (this.healthChecker != null) {
       NodeHealthStatus nodeHealthStatus = this.context.getNodeHealthStatus();
       this.healthChecker.setHealthStatus(nodeHealthStatus);
-      status.isNodeHealthy = nodeHealthStatus.isNodeHealthy();
-      status.healthReport = nodeHealthStatus.getHealthReport();
-      status.lastHealthReport = nodeHealthStatus.getLastReported();
+      status.setIsNodeHealthy(nodeHealthStatus.isNodeHealthy());
+      status.setHealthReport(nodeHealthStatus.getHealthReport());
+      status.setLastHealthReport(nodeHealthStatus.getLastReported());
     }
 
     return status;
@@ -221,7 +228,7 @@ public class NodeStatusUpdaterImpl exten
   }
 
   protected void startStatusUpdater() throws InterruptedException,
-      AvroRemoteException {
+    YarnRemoteException {
 
     new Thread() {
       @Override
@@ -234,23 +241,26 @@ public class NodeStatusUpdaterImpl exten
               heartbeatMonitor.wait(heartBeatInterval);
             }
             NodeStatus nodeStatus = getNodeStatus();
-            nodeStatus.responseId = lastHeartBeatID;
+            nodeStatus.setResponseId(lastHeartBeatID);
+            
+            NodeHeartbeatRequest request = recordFactory.newRecordInstance(NodeHeartbeatRequest.class);
+            request.setNodeStatus(nodeStatus);            
             HeartbeatResponse response =
-              resourceTracker.nodeHeartbeat(nodeStatus);
-            lastHeartBeatID = response.responseId;
-            List<org.apache.hadoop.yarn.Container> containersToCleanup =
-                response.containersToCleanup;
+              resourceTracker.nodeHeartbeat(request).getHeartbeatResponse();
+            lastHeartBeatID = response.getResponseId();
+            List<org.apache.hadoop.yarn.api.records.Container> containersToCleanup =
+                response.getContainersToCleanupList();
             if (containersToCleanup.size() != 0) {
               dispatcher.getEventHandler().handle(
                   new CMgrCompletedContainersEvent(containersToCleanup));
             }
-            List<ApplicationID> appsToCleanup =
-                response.appplicationsToCleanup;
+            List<ApplicationId> appsToCleanup =
+                response.getApplicationsToCleanupList();
             if (appsToCleanup.size() != 0) {
               dispatcher.getEventHandler().handle(
                   new CMgrCompletedAppsEvent(appsToCleanup));
             }
-          } catch (AvroRemoteException e) {
+          } catch (YarnRemoteException e) {
             LOG.error("Caught exception in status-updater", e);
             break;
           } catch (InterruptedException e) {

Added: hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/api/LocalizationProtocol.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/api/LocalizationProtocol.java?rev=1087462&view=auto
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/api/LocalizationProtocol.java (added)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/api/LocalizationProtocol.java Thu Mar 31 22:23:22 2011
@@ -0,0 +1,12 @@
+package org.apache.hadoop.yarn.server.nodemanager.api;
+
+import org.apache.hadoop.yarn.exceptions.YarnRemoteException;
+import org.apache.hadoop.yarn.server.nodemanager.api.protocolrecords.FailedLocalizationRequest;
+import org.apache.hadoop.yarn.server.nodemanager.api.protocolrecords.FailedLocalizationResponse;
+import org.apache.hadoop.yarn.server.nodemanager.api.protocolrecords.SuccessfulLocalizationRequest;
+import org.apache.hadoop.yarn.server.nodemanager.api.protocolrecords.SuccessfulLocalizationResponse;
+
+public interface LocalizationProtocol {
+  public SuccessfulLocalizationResponse successfulLocalization(SuccessfulLocalizationRequest request) throws YarnRemoteException;
+  public FailedLocalizationResponse failedLocalization(FailedLocalizationRequest request) throws YarnRemoteException;
+}



Mime
View raw message