From 61885df2fa76c589df9751653f94d9b26948dc3e Mon Sep 17 00:00:00 2001 From: Vinod Kumar Vavilapalli Date: Thu, 23 May 2013 22:47:33 +0000 Subject: [PATCH] YARN-711. Copied BuilderUtil methods in individual API records as BuilderUtils is going to be dismantled. Contributed by Jian He. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1485888 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-yarn-project/CHANGES.txt | 3 + .../api/records/ApplicationAttemptId.java | 13 +- .../yarn/api/records/ApplicationMaster.java | 60 ---- .../yarn/api/records/ApplicationReport.java | 105 ++++--- .../ApplicationResourceUsageReport.java | 41 ++- .../yarn/api/records/ApplicationStatus.java | 38 --- .../records/ApplicationSubmissionContext.java | 78 +++-- .../hadoop/yarn/api/records/Container.java | 47 ++- .../hadoop/yarn/api/records/ContainerId.java | 11 + .../api/records/ContainerLaunchContext.java | 51 ++- .../yarn/api/records/ContainerStatus.java | 31 +- .../yarn/api/records/LocalResource.java | 50 ++- .../yarn/api/records/NodeHealthStatus.java | 25 +- .../hadoop/yarn/api/records/NodeId.java | 9 + .../hadoop/yarn/api/records/NodeReport.java | 52 +++- .../hadoop/yarn/api/records/Priority.java | 14 +- .../hadoop/yarn/api/records/QueueInfo.java | 48 ++- .../yarn/api/records/QueueUserACLInfo.java | 21 +- .../hadoop/yarn/api/records/Resource.java | 10 + .../yarn/api/records/ResourceRequest.java | 13 + .../apache/hadoop/yarn/api/records/URL.java | 17 +- .../yarn/api/records/YarnClusterMetrics.java | 10 +- .../impl/pb/ApplicationMasterPBImpl.java | 294 ------------------ .../impl/pb/ApplicationReportPBImpl.java | 25 +- .../ApplicationResourceUsageReportPBImpl.java | 24 +- .../impl/pb/ApplicationStatusPBImpl.java | 134 -------- .../ApplicationSubmissionContextPBImpl.java | 24 +- .../impl/pb/ContainerLaunchContextPBImpl.java | 36 ++- .../api/records/impl/pb/ContainerPBImpl.java | 18 +- .../impl/pb/ContainerStatusPBImpl.java | 24 +- .../records/impl/pb/LocalResourcePBImpl.java | 24 +- .../impl/pb/NodeHealthStatusPBImpl.java | 24 +- .../api/records/impl/pb/NodeReportPBImpl.java | 25 +- .../api/records/impl/pb/QueueInfoPBImpl.java | 25 +- .../impl/pb/QueueUserACLInfoPBImpl.java | 25 +- .../yarn/api/records/impl/pb/URLPBImpl.java | 23 +- .../impl/pb/YarnClusterMetricsPBImpl.java | 23 +- .../localizer/LocalResourceRequest.java | 2 +- .../applicationsmanager/MockAsm.java | 106 ------- .../TestAMLaunchFailure.java | 1 - .../applicationsmanager/TestAMRestart.java | 1 - .../TestASMStateMachine.java | 1 - .../TestSchedulerNegotiator.java | 1 - 43 files changed, 755 insertions(+), 852 deletions(-) delete mode 100644 hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationMaster.java delete mode 100644 hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationStatus.java delete mode 100644 hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ApplicationMasterPBImpl.java delete mode 100644 hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ApplicationStatusPBImpl.java diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index c88448d9be9..691d4897694 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -266,6 +266,9 @@ Release 2.0.5-beta - UNRELEASED YARN-708. Moved RecordFactory classes to hadoop-yarn-api, and put some miscellaneous fixes to the interfaces. (Siddharth Seth via vinodkv) + YARN-711. Copied BuilderUtil methods in individual API records as + BuilderUtils is going to be dismantled. (Jian He via vinodkv) + OPTIMIZATIONS BUG FIXES diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationAttemptId.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationAttemptId.java index 24f15ced7fd..0a33a5e909a 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationAttemptId.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationAttemptId.java @@ -24,6 +24,7 @@ import org.apache.hadoop.classification.InterfaceAudience.Private; import org.apache.hadoop.classification.InterfaceAudience.Public; import org.apache.hadoop.classification.InterfaceStability.Stable; import org.apache.hadoop.classification.InterfaceStability.Unstable; +import org.apache.hadoop.yarn.util.Records; /** *

ApplicationAttemptId denotes the particular attempt @@ -37,9 +38,19 @@ import org.apache.hadoop.classification.InterfaceStability.Unstable; @Stable public abstract class ApplicationAttemptId implements Comparable { - + public static final String appAttemptIdStrPrefix = "appattempt_"; + @Private + public static ApplicationAttemptId newInstance(ApplicationId appId, + int attemptId) { + ApplicationAttemptId appAttemptId = + Records.newRecord(ApplicationAttemptId.class); + appAttemptId.setApplicationId(appId); + appAttemptId.setAttemptId(attemptId); + return appAttemptId; + } + /** * Get the ApplicationId of the ApplicationAttempId. * @return ApplicationId of the ApplicationAttempId diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationMaster.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationMaster.java deleted file mode 100644 index 45adedbc18b..00000000000 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationMaster.java +++ /dev/null @@ -1,60 +0,0 @@ -/** -* Licensed to the Apache Software Foundation (ASF) under one -* or more contributor license agreements. See the NOTICE file -* distributed with this work for additional information -* regarding copyright ownership. The ASF licenses this file -* to you under the Apache License, Version 2.0 (the -* "License"); you may not use this file except in compliance -* with the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -package org.apache.hadoop.yarn.api.records; - -import org.apache.hadoop.classification.InterfaceAudience.Private; -import org.apache.hadoop.classification.InterfaceStability.Unstable; - -/** - * For internal use only... - */ -@Private -@Unstable -public interface ApplicationMaster { - ApplicationId getApplicationId(); - void setApplicationId(ApplicationId appId); - - String getHost(); - void setHost(String host); - - int getRpcPort(); - void setRpcPort(int rpcPort); - - String getTrackingUrl(); - void setTrackingUrl(String url); - - ApplicationStatus getStatus(); - void setStatus(ApplicationStatus status); - - YarnApplicationState getState(); - void setState(YarnApplicationState state); - - ClientToken getClientToken(); - void setClientToken(ClientToken clientToken); - - int getAMFailCount(); - void setAMFailCount(int amFailCount); - - int getContainerCount(); - void setContainerCount(int containerCount); - - String getDiagnostics(); - void setDiagnostics(String diagnostics); -} - diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationReport.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationReport.java index 92a9e22e205..b69ea0f0dfc 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationReport.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationReport.java @@ -23,6 +23,7 @@ import org.apache.hadoop.classification.InterfaceAudience.Public; import org.apache.hadoop.classification.InterfaceStability.Stable; import org.apache.hadoop.classification.InterfaceStability.Unstable; import org.apache.hadoop.yarn.api.ClientRMProtocol; +import org.apache.hadoop.yarn.util.Records; /** *

ApplicationReport is a report of an application.

@@ -47,7 +48,37 @@ import org.apache.hadoop.yarn.api.ClientRMProtocol; */ @Public @Stable -public interface ApplicationReport { +public abstract class ApplicationReport { + + @Private + public static ApplicationReport newInstance(ApplicationId applicationId, + ApplicationAttemptId applicationAttemptId, String user, String queue, + String name, String host, int rpcPort, ClientToken clientToken, + YarnApplicationState state, String diagnostics, String url, + long startTime, long finishTime, FinalApplicationStatus finalStatus, + ApplicationResourceUsageReport appResources, String origTrackingUrl, + float progress, String applicationType) { + ApplicationReport report = Records.newRecord(ApplicationReport.class); + report.setApplicationId(applicationId); + report.setCurrentApplicationAttemptId(applicationAttemptId); + report.setUser(user); + report.setQueue(queue); + report.setName(name); + report.setHost(host); + report.setRpcPort(rpcPort); + report.setClientToken(clientToken); + report.setYarnApplicationState(state); + report.setDiagnostics(diagnostics); + report.setTrackingUrl(url); + report.setStartTime(startTime); + report.setFinishTime(finishTime); + report.setFinalApplicationStatus(finalStatus); + report.setApplicationResourceUsageReport(appResources); + report.setOriginalTrackingUrl(origTrackingUrl); + report.setProgress(progress); + report.setApplicationType(applicationType); + return report; + } /** * Get the ApplicationId of the application. @@ -55,11 +86,11 @@ public interface ApplicationReport { */ @Public @Stable - ApplicationId getApplicationId(); + public abstract ApplicationId getApplicationId(); @Private @Unstable - void setApplicationId(ApplicationId applicationId); + public abstract void setApplicationId(ApplicationId applicationId); /** * Get the ApplicationAttemptId of the current @@ -68,11 +99,11 @@ public interface ApplicationReport { */ @Private @Unstable - ApplicationAttemptId getCurrentApplicationAttemptId(); + public abstract ApplicationAttemptId getCurrentApplicationAttemptId(); @Private @Unstable - void setCurrentApplicationAttemptId(ApplicationAttemptId applicationAttemptId); + public abstract void setCurrentApplicationAttemptId(ApplicationAttemptId applicationAttemptId); /** * Get the user who submitted the application. @@ -80,11 +111,11 @@ public interface ApplicationReport { */ @Public @Stable - String getUser(); + public abstract String getUser(); @Private @Unstable - void setUser(String user); + public abstract void setUser(String user); /** * Get the queue to which the application was submitted. @@ -92,11 +123,11 @@ public interface ApplicationReport { */ @Public @Stable - String getQueue(); + public abstract String getQueue(); @Private @Unstable - void setQueue(String queue); + public abstract void setQueue(String queue); /** * Get the user-defined name of the application. @@ -104,11 +135,11 @@ public interface ApplicationReport { */ @Public @Stable - String getName(); + public abstract String getName(); @Private @Unstable - void setName(String name); + public abstract void setName(String name); /** * Get the host on which the ApplicationMaster @@ -118,11 +149,11 @@ public interface ApplicationReport { */ @Public @Stable - String getHost(); + public abstract String getHost(); @Private @Unstable - void setHost(String host); + public abstract void setHost(String host); /** * Get the RPC port of the ApplicationMaster. @@ -130,11 +161,11 @@ public interface ApplicationReport { */ @Public @Stable - int getRpcPort(); + public abstract int getRpcPort(); @Private @Unstable - void setRpcPort(int rpcPort); + public abstract void setRpcPort(int rpcPort); /** * Get the client token for communicating with the @@ -144,11 +175,11 @@ public interface ApplicationReport { */ @Public @Stable - ClientToken getClientToken(); + public abstract ClientToken getClientToken(); @Private @Unstable - void setClientToken(ClientToken clientToken); + public abstract void setClientToken(ClientToken clientToken); /** * Get the YarnApplicationState of the application. @@ -156,11 +187,11 @@ public interface ApplicationReport { */ @Public @Stable - YarnApplicationState getYarnApplicationState(); + public abstract YarnApplicationState getYarnApplicationState(); @Private @Unstable - void setYarnApplicationState(YarnApplicationState state); + public abstract void setYarnApplicationState(YarnApplicationState state); /** * Get the diagnositic information of the application in case of @@ -170,11 +201,11 @@ public interface ApplicationReport { */ @Public @Stable - String getDiagnostics(); + public abstract String getDiagnostics(); @Private @Unstable - void setDiagnostics(String diagnostics); + public abstract void setDiagnostics(String diagnostics); /** * Get the tracking url for the application. @@ -182,11 +213,11 @@ public interface ApplicationReport { */ @Public @Stable - String getTrackingUrl(); + public abstract String getTrackingUrl(); @Private @Unstable - void setTrackingUrl(String url); + public abstract void setTrackingUrl(String url); /** * Get the original not-proxied tracking url for the application. @@ -195,11 +226,11 @@ public interface ApplicationReport { */ @Private @Unstable - String getOriginalTrackingUrl(); + public abstract String getOriginalTrackingUrl(); @Private @Unstable - void setOriginalTrackingUrl(String url); + public abstract void setOriginalTrackingUrl(String url); /** * Get the start time of the application. @@ -207,11 +238,11 @@ public interface ApplicationReport { */ @Public @Stable - long getStartTime(); + public abstract long getStartTime(); @Private @Unstable - void setStartTime(long startTime); + public abstract void setStartTime(long startTime); /** * Get the finish time of the application. @@ -219,11 +250,11 @@ public interface ApplicationReport { */ @Public @Stable - long getFinishTime(); + public abstract long getFinishTime(); @Private @Unstable - void setFinishTime(long finishTime); + public abstract void setFinishTime(long finishTime); /** @@ -232,11 +263,11 @@ public interface ApplicationReport { */ @Public @Stable - FinalApplicationStatus getFinalApplicationStatus(); + public abstract FinalApplicationStatus getFinalApplicationStatus(); @Private @Unstable - void setFinalApplicationStatus(FinalApplicationStatus finishState); + public abstract void setFinalApplicationStatus(FinalApplicationStatus finishState); /** * Retrieve the structure containing the job resources for this application @@ -244,7 +275,7 @@ public interface ApplicationReport { */ @Public @Stable - ApplicationResourceUsageReport getApplicationResourceUsageReport(); + public abstract ApplicationResourceUsageReport getApplicationResourceUsageReport(); /** * Store the structure containing the job resources for this application @@ -252,7 +283,7 @@ public interface ApplicationReport { */ @Private @Unstable - void setApplicationResourceUsageReport(ApplicationResourceUsageReport appResources); + public abstract void setApplicationResourceUsageReport(ApplicationResourceUsageReport appResources); /** * Get the application's progress ( range 0.0 to 1.0 ) @@ -260,11 +291,11 @@ public interface ApplicationReport { */ @Public @Stable - float getProgress(); + public abstract float getProgress(); @Private @Unstable - void setProgress(float progress); + public abstract void setProgress(float progress); /** * Get the application's Type @@ -272,9 +303,9 @@ public interface ApplicationReport { */ @Public @Stable - String getApplicationType(); + public abstract String getApplicationType(); @Private @Unstable - void setApplicationType(String applicationType); + public abstract void setApplicationType(String applicationType); } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationResourceUsageReport.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationResourceUsageReport.java index 9d45e8b75f4..4cf2b145278 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationResourceUsageReport.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationResourceUsageReport.java @@ -18,21 +18,32 @@ package org.apache.hadoop.yarn.api.records; -import java.io.DataInput; -import java.io.DataOutput; -import java.io.IOException; - import org.apache.hadoop.classification.InterfaceAudience.Private; import org.apache.hadoop.classification.InterfaceAudience.Public; import org.apache.hadoop.classification.InterfaceStability.Stable; import org.apache.hadoop.classification.InterfaceStability.Unstable; +import org.apache.hadoop.yarn.util.Records; /** * Contains various scheduling metrics to be reported by UI and CLI. */ @Public @Stable -public interface ApplicationResourceUsageReport { +public abstract class ApplicationResourceUsageReport { + + @Private + public static ApplicationResourceUsageReport newInstance( + int numUsedContainers, int numReservedContainers, Resource usedResources, + Resource reservedResources, Resource neededResources) { + ApplicationResourceUsageReport report = + Records.newRecord(ApplicationResourceUsageReport.class); + report.setNumUsedContainers(numUsedContainers); + report.setNumReservedContainers(numReservedContainers); + report.setUsedResources(usedResources); + report.setReservedResources(reservedResources); + report.setNeededResources(neededResources); + return report; + } /** * Get the number of used containers @@ -40,7 +51,7 @@ public interface ApplicationResourceUsageReport { */ @Public @Stable - int getNumUsedContainers(); + public abstract int getNumUsedContainers(); /** * Set the number of used containers @@ -48,7 +59,7 @@ public interface ApplicationResourceUsageReport { */ @Private @Unstable - void setNumUsedContainers(int num_containers); + public abstract void setNumUsedContainers(int num_containers); /** * Get the number of reserved containers @@ -56,7 +67,7 @@ public interface ApplicationResourceUsageReport { */ @Public @Stable - int getNumReservedContainers(); + public abstract int getNumReservedContainers(); /** * Set the number of reserved containers @@ -64,7 +75,7 @@ public interface ApplicationResourceUsageReport { */ @Private @Unstable - void setNumReservedContainers(int num_reserved_containers); + public abstract void setNumReservedContainers(int num_reserved_containers); /** * Get the used Resource @@ -72,11 +83,11 @@ public interface ApplicationResourceUsageReport { */ @Public @Stable - Resource getUsedResources(); + public abstract Resource getUsedResources(); @Private @Unstable - void setUsedResources(Resource resources); + public abstract void setUsedResources(Resource resources); /** * Get the reserved Resource @@ -84,11 +95,11 @@ public interface ApplicationResourceUsageReport { */ @Public @Stable - Resource getReservedResources(); + public abstract Resource getReservedResources(); @Private @Unstable - void setReservedResources(Resource reserved_resources); + public abstract void setReservedResources(Resource reserved_resources); /** * Get the needed Resource @@ -96,9 +107,9 @@ public interface ApplicationResourceUsageReport { */ @Public @Stable - Resource getNeededResources(); + public abstract Resource getNeededResources(); @Private @Unstable - void setNeededResources(Resource needed_resources); + public abstract void setNeededResources(Resource needed_resources); } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationStatus.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationStatus.java deleted file mode 100644 index a71a1652fe0..00000000000 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationStatus.java +++ /dev/null @@ -1,38 +0,0 @@ -/** -* Licensed to the Apache Software Foundation (ASF) under one -* or more contributor license agreements. See the NOTICE file -* distributed with this work for additional information -* regarding copyright ownership. The ASF licenses this file -* to you under the Apache License, Version 2.0 (the -* "License"); you may not use this file except in compliance -* with the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -package org.apache.hadoop.yarn.api.records; - -import org.apache.hadoop.classification.InterfaceAudience.Private; -import org.apache.hadoop.classification.InterfaceStability.Unstable; - -/** - * For internal use only... - */ -@Private -@Unstable -public interface ApplicationStatus { - ApplicationAttemptId getApplicationAttemptId(); - void setApplicationAttemptId(ApplicationAttemptId applicationAttemptId); - - int getResponseId(); - void setResponseId(int id); - - float getProgress(); - void setProgress(float progress); -} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationSubmissionContext.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationSubmissionContext.java index 4941a281b63..b4f6c044f7d 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationSubmissionContext.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationSubmissionContext.java @@ -23,6 +23,7 @@ import org.apache.hadoop.classification.InterfaceAudience.Public; import org.apache.hadoop.classification.InterfaceStability.Stable; import org.apache.hadoop.classification.InterfaceStability.Unstable; import org.apache.hadoop.yarn.api.ClientRMProtocol; +import org.apache.hadoop.yarn.util.Records; /** *

ApplicationSubmissionContext represents all of the @@ -47,14 +48,49 @@ import org.apache.hadoop.yarn.api.ClientRMProtocol; */ @Public @Stable -public interface ApplicationSubmissionContext { +public abstract class ApplicationSubmissionContext { + + @Public + @Stable + public static ApplicationSubmissionContext newInstance( + ApplicationId applicationId, String applicationName, String queue, + Priority priority, ContainerLaunchContext amContainer, + boolean isUnmanagedAM, boolean cancelTokensWhenComplete, + int maxAppAttempts, Resource resource, String applicationType) { + ApplicationSubmissionContext context = + Records.newRecord(ApplicationSubmissionContext.class); + context.setApplicationId(applicationId); + context.setApplicationName(applicationName); + context.setQueue(queue); + context.setPriority(priority); + context.setAMContainerSpec(amContainer); + context.setUnmanagedAM(isUnmanagedAM); + context.setCancelTokensWhenComplete(cancelTokensWhenComplete); + context.setMaxAppAttempts(maxAppAttempts); + context.setResource(resource); + context.setApplicationType(applicationType); + return context; + } + + @Public + @Stable + public static ApplicationSubmissionContext newInstance( + ApplicationId applicationId, String applicationName, String queue, + Priority priority, ContainerLaunchContext amContainer, + boolean isUnmanagedAM, boolean cancelTokensWhenComplete, + int maxAppAttempts, Resource resource) { + return newInstance(applicationId, applicationName, queue, priority, + amContainer, isUnmanagedAM, cancelTokensWhenComplete, maxAppAttempts, + resource, null); + } + /** * Get the ApplicationId of the submitted application. * @return ApplicationId of the submitted application */ @Public @Stable - public ApplicationId getApplicationId(); + public abstract ApplicationId getApplicationId(); /** * Set the ApplicationId of the submitted application. @@ -63,7 +99,7 @@ public interface ApplicationSubmissionContext { */ @Public @Stable - public void setApplicationId(ApplicationId applicationId); + public abstract void setApplicationId(ApplicationId applicationId); /** * Get the application name. @@ -71,7 +107,7 @@ public interface ApplicationSubmissionContext { */ @Public @Stable - public String getApplicationName(); + public abstract String getApplicationName(); /** * Set the application name. @@ -79,7 +115,7 @@ public interface ApplicationSubmissionContext { */ @Public @Stable - public void setApplicationName(String applicationName); + public abstract void setApplicationName(String applicationName); /** * Get the queue to which the application is being submitted. @@ -87,7 +123,7 @@ public interface ApplicationSubmissionContext { */ @Public @Stable - public String getQueue(); + public abstract String getQueue(); /** * Set the queue to which the application is being submitted @@ -95,7 +131,7 @@ public interface ApplicationSubmissionContext { */ @Public @Stable - public void setQueue(String queue); + public abstract void setQueue(String queue); /** * Get the Priority of the application. @@ -103,7 +139,7 @@ public interface ApplicationSubmissionContext { */ @Public @Stable - public Priority getPriority(); + public abstract Priority getPriority(); /** * Set the Priority of the application. @@ -111,7 +147,7 @@ public interface ApplicationSubmissionContext { */ @Public @Stable - public void setPriority(Priority priority); + public abstract void setPriority(Priority priority); /** * Get the ContainerLaunchContext to describe the @@ -122,7 +158,7 @@ public interface ApplicationSubmissionContext { */ @Public @Stable - public ContainerLaunchContext getAMContainerSpec(); + public abstract ContainerLaunchContext getAMContainerSpec(); /** * Set the ContainerLaunchContext to describe the @@ -133,7 +169,7 @@ public interface ApplicationSubmissionContext { */ @Public @Stable - public void setAMContainerSpec(ContainerLaunchContext amContainer); + public abstract void setAMContainerSpec(ContainerLaunchContext amContainer); /** * Get if the RM should manage the execution of the AM. @@ -148,21 +184,21 @@ public interface ApplicationSubmissionContext { */ @Public @Unstable - public boolean getUnmanagedAM(); + public abstract boolean getUnmanagedAM(); /** * @param value true if RM should not manage the AM */ @Public @Unstable - public void setUnmanagedAM(boolean value); + public abstract void setUnmanagedAM(boolean value); /** * @return true if tokens should be canceled when the app completes. */ @LimitedPrivate("mapreduce") @Unstable - public boolean getCancelTokensWhenComplete(); + public abstract boolean getCancelTokensWhenComplete(); /** * Set to false if tokens should not be canceled when the app finished else @@ -172,14 +208,14 @@ public interface ApplicationSubmissionContext { */ @LimitedPrivate("mapreduce") @Unstable - public void setCancelTokensWhenComplete(boolean cancel); + public abstract void setCancelTokensWhenComplete(boolean cancel); /** * @return the number of max attempts of the application to be submitted */ @Public @Unstable - public int getMaxAppAttempts(); + public abstract int getMaxAppAttempts(); /** * Set the number of max attempts of the application to be submitted. WARNING: @@ -190,15 +226,15 @@ public interface ApplicationSubmissionContext { */ @Public @Unstable - public void setMaxAppAttempts(int maxAppAttempts); + public abstract void setMaxAppAttempts(int maxAppAttempts); @Public @Stable - public Resource getResource(); + public abstract Resource getResource(); @Public @Stable - public void setResource(Resource resource); + public abstract void setResource(Resource resource); /** * Get the applicationType is the application type @@ -207,7 +243,7 @@ public interface ApplicationSubmissionContext { */ @Public @Stable - public String getApplicationType(); + public abstract String getApplicationType(); /** * Set the applicationType is the application type @@ -217,5 +253,5 @@ public interface ApplicationSubmissionContext { */ @Public @Stable - public void setApplicationType(String applicationType); + public abstract void setApplicationType(String applicationType); } \ No newline at end of file diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Container.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Container.java index b0860e5aa19..f70a9486b0f 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Container.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Container.java @@ -24,6 +24,7 @@ import org.apache.hadoop.classification.InterfaceStability.Stable; import org.apache.hadoop.classification.InterfaceStability.Unstable; import org.apache.hadoop.yarn.api.AMRMProtocol; import org.apache.hadoop.yarn.api.ContainerManager; +import org.apache.hadoop.yarn.util.Records; /** *

Container represents an allocated resource in the cluster. @@ -63,18 +64,34 @@ import org.apache.hadoop.yarn.api.ContainerManager; */ @Public @Stable -public interface Container extends Comparable { +public abstract class Container implements Comparable { + + @Private + public static Container newInstance(ContainerId containerId, NodeId nodeId, + String nodeHttpAddress, Resource resource, Priority priority, + ContainerToken containerToken, long rmIdentifier) { + Container container = Records.newRecord(Container.class); + container.setId(containerId); + container.setNodeId(nodeId); + container.setNodeHttpAddress(nodeHttpAddress); + container.setResource(resource); + container.setPriority(priority); + container.setContainerToken(containerToken); + container.setRMIdentifier(rmIdentifier); + return container; + } + /** * Get the globally unique identifier for the container. * @return globally unique identifier for the container */ @Public @Stable - ContainerId getId(); + public abstract ContainerId getId(); @Private @Unstable - void setId(ContainerId id); + public abstract void setId(ContainerId id); /** * Get the identifier of the node on which the container is allocated. @@ -82,11 +99,11 @@ public interface Container extends Comparable { */ @Public @Stable - NodeId getNodeId(); + public abstract NodeId getNodeId(); @Private @Unstable - void setNodeId(NodeId nodeId); + public abstract void setNodeId(NodeId nodeId); /** * Get the http uri of the node on which the container is allocated. @@ -94,11 +111,11 @@ public interface Container extends Comparable { */ @Public @Stable - String getNodeHttpAddress(); + public abstract String getNodeHttpAddress(); @Private @Unstable - void setNodeHttpAddress(String nodeHttpAddress); + public abstract void setNodeHttpAddress(String nodeHttpAddress); /** * Get the Resource allocated to the container. @@ -106,11 +123,11 @@ public interface Container extends Comparable { */ @Public @Stable - Resource getResource(); + public abstract Resource getResource(); @Private @Unstable - void setResource(Resource resource); + public abstract void setResource(Resource resource); /** * Get the Priority at which the Container was @@ -118,11 +135,11 @@ public interface Container extends Comparable { * @return Priority at which the Container was * allocated */ - Priority getPriority(); + public abstract Priority getPriority(); @Private @Unstable - void setPriority(Priority priority); + public abstract void setPriority(Priority priority); /** * Get the ContainerToken for the container. @@ -130,11 +147,11 @@ public interface Container extends Comparable { */ @Public @Stable - ContainerToken getContainerToken(); + public abstract ContainerToken getContainerToken(); @Private @Unstable - void setContainerToken(ContainerToken containerToken); + public abstract void setContainerToken(ContainerToken containerToken); /** * Get the RMIdentifier of RM in which containers are allocated @@ -142,9 +159,9 @@ public interface Container extends Comparable { */ @Private @Unstable - long getRMIdentifer(); + public abstract long getRMIdentifer(); @Private @Unstable - void setRMIdentifier(long rmIdentifier); + public abstract void setRMIdentifier(long rmIdentifier); } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerId.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerId.java index 68cd09e2aa1..99b36478887 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerId.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerId.java @@ -24,6 +24,7 @@ import org.apache.hadoop.classification.InterfaceAudience.Private; import org.apache.hadoop.classification.InterfaceAudience.Public; import org.apache.hadoop.classification.InterfaceStability.Stable; import org.apache.hadoop.classification.InterfaceStability.Unstable; +import org.apache.hadoop.yarn.util.Records; /** *

ContainerId represents a globally unique identifier @@ -32,6 +33,16 @@ import org.apache.hadoop.classification.InterfaceStability.Unstable; @Public @Stable public abstract class ContainerId implements Comparable{ + + @Private + public static ContainerId newInstance(ApplicationAttemptId appAttemptId, + int containerId) { + ContainerId id = Records.newRecord(ContainerId.class); + id.setId(containerId); + id.setApplicationAttemptId(appAttemptId); + return id; + } + /** * Get the ApplicationAttemptId of the application to which * the Container was assigned. diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerLaunchContext.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerLaunchContext.java index da6f6d42378..ae360913813 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerLaunchContext.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerLaunchContext.java @@ -25,6 +25,7 @@ import java.util.Map; import org.apache.hadoop.classification.InterfaceAudience.Public; import org.apache.hadoop.classification.InterfaceStability.Stable; import org.apache.hadoop.yarn.api.ContainerManager; +import org.apache.hadoop.yarn.util.Records; /** *

ContainerLaunchContext represents all of the information @@ -50,14 +51,34 @@ import org.apache.hadoop.yarn.api.ContainerManager; */ @Public @Stable -public interface ContainerLaunchContext { +public abstract class ContainerLaunchContext { + + @Public + @Stable + public static ContainerLaunchContext newInstance( + String user, Map localResources, + Map environment, List commands, + Map serviceData, ByteBuffer tokens, + Map acls) { + ContainerLaunchContext container = + Records.newRecord(ContainerLaunchContext.class); + container.setUser(user); + container.setLocalResources(localResources); + container.setEnvironment(environment); + container.setCommands(commands); + container.setServiceData(serviceData); + container.setTokens(tokens); + container.setApplicationACLs(acls); + return container; + } + /** * Get the user to whom the container has been allocated. * @return the user to whom the container has been allocated */ @Public @Stable - String getUser(); + public abstract String getUser(); /** * Set the user to whom the container has been allocated @@ -65,7 +86,7 @@ public interface ContainerLaunchContext { */ @Public @Stable - void setUser(String user); + public abstract void setUser(String user); /** * Get all the tokens needed by this container. It may include file-system @@ -77,7 +98,7 @@ public interface ContainerLaunchContext { */ @Public @Stable - ByteBuffer getTokens(); + public abstract ByteBuffer getTokens(); /** * Set security tokens needed by this container. @@ -85,7 +106,7 @@ public interface ContainerLaunchContext { */ @Public @Stable - void setTokens(ByteBuffer tokens); + public abstract void setTokens(ByteBuffer tokens); /** * Get LocalResource required by the container. @@ -93,7 +114,7 @@ public interface ContainerLaunchContext { */ @Public @Stable - Map getLocalResources(); + public abstract Map getLocalResources(); /** * Set LocalResource required by the container. All pre-existing @@ -102,7 +123,7 @@ public interface ContainerLaunchContext { */ @Public @Stable - void setLocalResources(Map localResources); + public abstract void setLocalResources(Map localResources); /** * Get application-specific binary service data. @@ -110,7 +131,7 @@ public interface ContainerLaunchContext { */ @Public @Stable - Map getServiceData(); + public abstract Map getServiceData(); /** * Set application-specific binary service data. All pre-existing Map @@ -119,7 +140,7 @@ public interface ContainerLaunchContext { */ @Public @Stable - void setServiceData(Map serviceData); + public abstract void setServiceData(Map serviceData); /** * Get environment variables for the container. @@ -127,7 +148,7 @@ public interface ContainerLaunchContext { */ @Public @Stable - Map getEnvironment(); + public abstract Map getEnvironment(); /** * Add environment variables for the container. All pre-existing Map @@ -136,7 +157,7 @@ public interface ContainerLaunchContext { */ @Public @Stable - void setEnvironment(Map environment); + public abstract void setEnvironment(Map environment); /** * Get the list of commands for launching the container. @@ -144,7 +165,7 @@ public interface ContainerLaunchContext { */ @Public @Stable - List getCommands(); + public abstract List getCommands(); /** * Add the list of commands for launching the container. All @@ -153,7 +174,7 @@ public interface ContainerLaunchContext { */ @Public @Stable - void setCommands(List commands); + public abstract void setCommands(List commands); /** * Get the ApplicationACLs for the application. @@ -161,7 +182,7 @@ public interface ContainerLaunchContext { */ @Public @Stable - public Map getApplicationACLs(); + public abstract Map getApplicationACLs(); /** * Set the ApplicationACLs for the application. All pre-existing @@ -170,5 +191,5 @@ public interface ContainerLaunchContext { */ @Public @Stable - public void setApplicationACLs(Map acls); + public abstract void setApplicationACLs(Map acls); } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerStatus.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerStatus.java index 88965270bbf..6322ee18086 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerStatus.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerStatus.java @@ -22,6 +22,7 @@ import org.apache.hadoop.classification.InterfaceAudience.Private; import org.apache.hadoop.classification.InterfaceAudience.Public; import org.apache.hadoop.classification.InterfaceStability.Stable; import org.apache.hadoop.classification.InterfaceStability.Unstable; +import org.apache.hadoop.yarn.util.Records; /** *

ContainerStatus represents the current status of a @@ -38,18 +39,30 @@ import org.apache.hadoop.classification.InterfaceStability.Unstable; */ @Public @Stable -public interface ContainerStatus { +public abstract class ContainerStatus { + + @Private + public static ContainerStatus newInstance(ContainerId containerId, + ContainerState containerState, String diagnostics, int exitStatus) { + ContainerStatus containerStatus = Records.newRecord(ContainerStatus.class); + containerStatus.setState(containerState); + containerStatus.setContainerId(containerId); + containerStatus.setDiagnostics(diagnostics); + containerStatus.setExitStatus(exitStatus); + return containerStatus; + } + /** * Get the ContainerId of the container. * @return ContainerId of the container */ @Public @Stable - ContainerId getContainerId(); + public abstract ContainerId getContainerId(); @Private @Unstable - void setContainerId(ContainerId containerId); + public abstract void setContainerId(ContainerId containerId); /** * Get the ContainerState of the container. @@ -57,11 +70,11 @@ public interface ContainerStatus { */ @Public @Stable - ContainerState getState(); + public abstract ContainerState getState(); @Private @Unstable - void setState(ContainerState state); + public abstract void setState(ContainerState state); /** *

Get the exit status for the container.

@@ -84,11 +97,11 @@ public interface ContainerStatus { */ @Public @Stable - int getExitStatus(); + public abstract int getExitStatus(); @Private @Unstable - void setExitStatus(int exitStatus); + public abstract void setExitStatus(int exitStatus); /** * Get diagnostic messages for failed containers. @@ -96,9 +109,9 @@ public interface ContainerStatus { */ @Public @Stable - String getDiagnostics(); + public abstract String getDiagnostics(); @Private @Unstable - void setDiagnostics(String diagnostics); + public abstract void setDiagnostics(String diagnostics); } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/LocalResource.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/LocalResource.java index 1a8790a5889..610e557b147 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/LocalResource.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/LocalResource.java @@ -21,6 +21,7 @@ package org.apache.hadoop.yarn.api.records; import org.apache.hadoop.classification.InterfaceAudience.Public; import org.apache.hadoop.classification.InterfaceStability.Stable; import org.apache.hadoop.yarn.api.ContainerManager; +import org.apache.hadoop.yarn.util.Records; /** *

LocalResource represents a local resource required to @@ -40,56 +41,79 @@ import org.apache.hadoop.yarn.api.ContainerManager; */ @Public @Stable -public interface LocalResource { +public abstract class LocalResource { + + @Public + @Stable + public static LocalResource newInstance(URL url, LocalResourceType type, + LocalResourceVisibility visibility, long size, long timestamp, + String pattern) { + LocalResource resource = Records.newRecord(LocalResource.class); + resource.setResource(url); + resource.setType(type); + resource.setVisibility(visibility); + resource.setSize(size); + resource.setTimestamp(timestamp); + resource.setPattern(pattern); + return resource; + } + + @Public + @Stable + public static LocalResource newInstance(URL url, LocalResourceType type, + LocalResourceVisibility visibility, long size, long timestamp) { + return newInstance(url, type, visibility, size, timestamp, null); + } + /** * Get the location of the resource to be localized. * @return location of the resource to be localized */ - public URL getResource(); + public abstract URL getResource(); /** * Set location of the resource to be localized. * @param resource location of the resource to be localized */ - public void setResource(URL resource); + public abstract void setResource(URL resource); /** * Get the size of the resource to be localized. * @return size of the resource to be localized */ - public long getSize(); + public abstract long getSize(); /** * Set the size of the resource to be localized. * @param size size of the resource to be localized */ - public void setSize(long size); + public abstract void setSize(long size); /** * Get the original timestamp of the resource to be localized, used * for verification. * @return timestamp of the resource to be localized */ - public long getTimestamp(); + public abstract long getTimestamp(); /** * Set the timestamp of the resource to be localized, used * for verification. * @param timestamp timestamp of the resource to be localized */ - public void setTimestamp(long timestamp); + public abstract void setTimestamp(long timestamp); /** * Get the LocalResourceType of the resource to be localized. * @return LocalResourceType of the resource to be localized */ - public LocalResourceType getType(); + public abstract LocalResourceType getType(); /** * Set the LocalResourceType of the resource to be localized. * @param type LocalResourceType of the resource to be localized */ - public void setType(LocalResourceType type); + public abstract void setType(LocalResourceType type); /** * Get the LocalResourceVisibility of the resource to be @@ -97,7 +121,7 @@ public interface LocalResource { * @return LocalResourceVisibility of the resource to be * localized */ - public LocalResourceVisibility getVisibility(); + public abstract LocalResourceVisibility getVisibility(); /** * Set the LocalResourceVisibility of the resource to be @@ -105,7 +129,7 @@ public interface LocalResource { * @param visibility LocalResourceVisibility of the resource to be * localized */ - public void setVisibility(LocalResourceVisibility visibility); + public abstract void setVisibility(LocalResourceVisibility visibility); /** * Get the pattern that should be used to extract entries from the @@ -113,7 +137,7 @@ public interface LocalResource { * @return pattern that should be used to extract entries from the * archive. */ - public String getPattern(); + public abstract String getPattern(); /** * Set the pattern that should be used to extract entries from the @@ -121,5 +145,5 @@ public interface LocalResource { * @param pattern pattern that should be used to extract entries * from the archive. */ - public void setPattern(String pattern); + public abstract void setPattern(String pattern); } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/NodeHealthStatus.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/NodeHealthStatus.java index eca22fa4297..dad19c2b8c1 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/NodeHealthStatus.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/NodeHealthStatus.java @@ -22,6 +22,7 @@ import org.apache.hadoop.classification.InterfaceAudience.Public; import org.apache.hadoop.classification.InterfaceStability.Stable; import org.apache.hadoop.classification.InterfaceStability.Unstable; import org.apache.hadoop.yarn.api.ClientRMProtocol; +import org.apache.hadoop.yarn.util.Records; /** *

NodeHealthStatus is a summary of the health status of the @@ -43,7 +44,17 @@ import org.apache.hadoop.yarn.api.ClientRMProtocol; */ @Public @Stable -public interface NodeHealthStatus { +public abstract class NodeHealthStatus { + + @Private + public static NodeHealthStatus newInstance(boolean isNodeHealthy, + String healthReport, long lastHealthReport) { + NodeHealthStatus status = Records.newRecord(NodeHealthStatus.class); + status.setIsNodeHealthy(isNodeHealthy); + status.setHealthReport(healthReport); + status.setLastHealthReportTime(lastHealthReport); + return status; + } /** * Is the node healthy? @@ -51,11 +62,11 @@ public interface NodeHealthStatus { */ @Public @Stable - boolean getIsNodeHealthy(); + public abstract boolean getIsNodeHealthy(); @Private @Unstable - void setIsNodeHealthy(boolean isNodeHealthy); + public abstract void setIsNodeHealthy(boolean isNodeHealthy); /** * Get the diagnostic health report of the node. @@ -63,11 +74,11 @@ public interface NodeHealthStatus { */ @Public @Stable - String getHealthReport(); + public abstract String getHealthReport(); @Private @Unstable - void setHealthReport(String healthReport); + public abstract void setHealthReport(String healthReport); /** * Get the last timestamp at which the health report was received. @@ -75,9 +86,9 @@ public interface NodeHealthStatus { */ @Public @Stable - long getLastHealthReportTime(); + public abstract long getLastHealthReportTime(); @Private @Unstable - void setLastHealthReportTime(long lastHealthReport); + public abstract void setLastHealthReportTime(long lastHealthReport); } \ No newline at end of file diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/NodeId.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/NodeId.java index 886f88eac50..ae4ff89fa39 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/NodeId.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/NodeId.java @@ -22,6 +22,7 @@ import org.apache.hadoop.classification.InterfaceAudience.Private; import org.apache.hadoop.classification.InterfaceAudience.Public; import org.apache.hadoop.classification.InterfaceStability.Stable; import org.apache.hadoop.classification.InterfaceStability.Unstable; +import org.apache.hadoop.yarn.util.Records; /** *

NodeId is the unique identifier for a node.

@@ -34,6 +35,14 @@ import org.apache.hadoop.classification.InterfaceStability.Unstable; @Stable public abstract class NodeId implements Comparable { + @Private + public static NodeId newInstance(String host, int port) { + NodeId nodeId = Records.newRecord(NodeId.class); + nodeId.setHost(host); + nodeId.setPort(port); + return nodeId; + } + /** * Get the hostname of the node. * @return hostname of the node diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/NodeReport.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/NodeReport.java index c4489abfe98..5f8dc3654e3 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/NodeReport.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/NodeReport.java @@ -23,6 +23,7 @@ import org.apache.hadoop.classification.InterfaceAudience.Public; import org.apache.hadoop.classification.InterfaceStability.Stable; import org.apache.hadoop.classification.InterfaceStability.Unstable; import org.apache.hadoop.yarn.api.ClientRMProtocol; +import org.apache.hadoop.yarn.util.Records; /** *

NodeReport is a summary of runtime information of a @@ -45,26 +46,43 @@ import org.apache.hadoop.yarn.api.ClientRMProtocol; */ @Public @Stable -public interface NodeReport { +public abstract class NodeReport { + + @Private + public static NodeReport newInstance(NodeId nodeId, NodeState nodeState, + String httpAddress, String rackName, Resource used, Resource capability, + int numContainers, NodeHealthStatus nodeHealthStatus) { + NodeReport nodeReport = Records.newRecord(NodeReport.class); + nodeReport.setNodeId(nodeId); + nodeReport.setNodeState(nodeState); + nodeReport.setHttpAddress(httpAddress); + nodeReport.setRackName(rackName); + nodeReport.setUsed(used); + nodeReport.setCapability(capability); + nodeReport.setNumContainers(numContainers); + nodeReport.setNodeHealthStatus(nodeHealthStatus); + return nodeReport; + } + /** * Get the NodeId of the node. * @return NodeId of the node */ - NodeId getNodeId(); + public abstract NodeId getNodeId(); @Private @Unstable - void setNodeId(NodeId nodeId); + public abstract void setNodeId(NodeId nodeId); /** * Get the NodeState of the node. * @return NodeState of the node */ - NodeState getNodeState(); + public abstract NodeState getNodeState(); @Private @Unstable - void setNodeState(NodeState nodeState); + public abstract void setNodeState(NodeState nodeState); /** * Get the http address of the node. @@ -72,11 +90,11 @@ public interface NodeReport { */ @Public @Stable - String getHttpAddress(); + public abstract String getHttpAddress(); @Private @Unstable - void setHttpAddress(String httpAddress); + public abstract void setHttpAddress(String httpAddress); /** * Get the rack name for the node. @@ -84,11 +102,11 @@ public interface NodeReport { */ @Public @Stable - String getRackName(); + public abstract String getRackName(); @Private @Unstable - void setRackName(String rackName); + public abstract void setRackName(String rackName); /** * Get used Resource on the node. @@ -96,11 +114,11 @@ public interface NodeReport { */ @Public @Stable - Resource getUsed(); + public abstract Resource getUsed(); @Private @Unstable - void setUsed(Resource used); + public abstract void setUsed(Resource used); /** * Get the total Resource on the node. @@ -108,11 +126,11 @@ public interface NodeReport { */ @Public @Stable - Resource getCapability(); + public abstract Resource getCapability(); @Private @Unstable - void setCapability(Resource capability); + public abstract void setCapability(Resource capability); /** * Get the number of running containers on the node. @@ -120,11 +138,11 @@ public interface NodeReport { */ @Public @Stable - int getNumContainers(); + public abstract int getNumContainers(); @Private @Unstable - void setNumContainers(int numContainers); + public abstract void setNumContainers(int numContainers); /** * Get the NodeHealthStatus of the node. @@ -132,9 +150,9 @@ public interface NodeReport { */ @Public @Stable - NodeHealthStatus getNodeHealthStatus(); + public abstract NodeHealthStatus getNodeHealthStatus(); @Private @Unstable - void setNodeHealthStatus(NodeHealthStatus nodeHealthStatus); + public abstract void setNodeHealthStatus(NodeHealthStatus nodeHealthStatus); } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Priority.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Priority.java index 2b456f74846..e9180566f8b 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Priority.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Priority.java @@ -18,13 +18,25 @@ package org.apache.hadoop.yarn.api.records; +import org.apache.hadoop.classification.InterfaceAudience.Public; +import org.apache.hadoop.classification.InterfaceStability.Stable; +import org.apache.hadoop.yarn.util.Records; + /** * The priority assigned to a ResourceRequest or Application or Container * allocation * */ public abstract class Priority implements Comparable { - + + @Public + @Stable + public static Priority newInstance(int p) { + Priority priority = Records.newRecord(Priority.class); + priority.setPriority(p); + return priority; + } + /** * Get the assigned priority * @return the assigned priority diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/QueueInfo.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/QueueInfo.java index b4b45c44364..2d23eb9ce1f 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/QueueInfo.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/QueueInfo.java @@ -25,6 +25,7 @@ import org.apache.hadoop.classification.InterfaceAudience.Public; import org.apache.hadoop.classification.InterfaceStability.Stable; import org.apache.hadoop.classification.InterfaceStability.Unstable; import org.apache.hadoop.yarn.api.ClientRMProtocol; +import org.apache.hadoop.yarn.util.Records; /** *

QueueInfo is a report of the runtime information of the queue.

@@ -46,18 +47,35 @@ import org.apache.hadoop.yarn.api.ClientRMProtocol; */ @Public @Stable -public interface QueueInfo { +public abstract class QueueInfo { + + @Private + public static QueueInfo newInstance(String queueName, float capacity, + float maximumCapacity, float currentCapacity, + List childQueues, List applications, + QueueState queueState) { + QueueInfo queueInfo = Records.newRecord(QueueInfo.class); + queueInfo.setQueueName(queueName); + queueInfo.setCapacity(capacity); + queueInfo.setMaximumCapacity(maximumCapacity); + queueInfo.setCurrentCapacity(currentCapacity); + queueInfo.setChildQueues(childQueues); + queueInfo.setApplications(applications); + queueInfo.setQueueState(queueState); + return queueInfo; + } + /** * Get the name of the queue. * @return name of the queue */ @Public @Stable - String getQueueName(); + public abstract String getQueueName(); @Private @Unstable - void setQueueName(String queueName); + public abstract void setQueueName(String queueName); /** * Get the configured capacity of the queue. @@ -65,11 +83,11 @@ public interface QueueInfo { */ @Public @Stable - float getCapacity(); + public abstract float getCapacity(); @Private @Unstable - void setCapacity(float capacity); + public abstract void setCapacity(float capacity); /** * Get the maximum capacity of the queue. @@ -77,11 +95,11 @@ public interface QueueInfo { */ @Public @Stable - float getMaximumCapacity(); + public abstract float getMaximumCapacity(); @Private @Unstable - void setMaximumCapacity(float maximumCapacity); + public abstract void setMaximumCapacity(float maximumCapacity); /** * Get the current capacity of the queue. @@ -89,11 +107,11 @@ public interface QueueInfo { */ @Public @Stable - float getCurrentCapacity(); + public abstract float getCurrentCapacity(); @Private @Unstable - void setCurrentCapacity(float currentCapacity); + public abstract void setCurrentCapacity(float currentCapacity); /** * Get the child queues of the queue. @@ -101,11 +119,11 @@ public interface QueueInfo { */ @Public @Stable - List getChildQueues(); + public abstract List getChildQueues(); @Private @Unstable - void setChildQueues(List childQueues); + public abstract void setChildQueues(List childQueues); /** * Get the running applications of the queue. @@ -113,11 +131,11 @@ public interface QueueInfo { */ @Public @Stable - List getApplications(); + public abstract List getApplications(); @Private @Unstable - void setApplications(List applications); + public abstract void setApplications(List applications); /** * Get the QueueState of the queue. @@ -125,9 +143,9 @@ public interface QueueInfo { */ @Public @Stable - QueueState getQueueState(); + public abstract QueueState getQueueState(); @Private @Unstable - void setQueueState(QueueState queueState); + public abstract void setQueueState(QueueState queueState); } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/QueueUserACLInfo.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/QueueUserACLInfo.java index 704cc16e90a..d81808e5a30 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/QueueUserACLInfo.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/QueueUserACLInfo.java @@ -25,6 +25,7 @@ import org.apache.hadoop.classification.InterfaceAudience.Public; import org.apache.hadoop.classification.InterfaceStability.Stable; import org.apache.hadoop.classification.InterfaceStability.Unstable; import org.apache.hadoop.yarn.api.ClientRMProtocol; +import org.apache.hadoop.yarn.util.Records; /** *

QueueUserACLInfo provides information {@link QueueACL} for @@ -35,18 +36,28 @@ import org.apache.hadoop.yarn.api.ClientRMProtocol; */ @Public @Stable -public interface QueueUserACLInfo { +public abstract class QueueUserACLInfo { + + @Private + public static QueueUserACLInfo newInstance(String queueName, + List acls) { + QueueUserACLInfo info = Records.newRecord(QueueUserACLInfo.class); + info.setQueueName(queueName); + info.setUserAcls(acls); + return info; + } + /** * Get the queue name of the queue. * @return queue name of the queue */ @Public @Stable - String getQueueName(); + public abstract String getQueueName(); @Private @Unstable - void setQueueName(String queueName); + public abstract void setQueueName(String queueName); /** * Get the list of QueueACL for the given user. @@ -54,9 +65,9 @@ public interface QueueUserACLInfo { */ @Public @Stable - List getUserAcls(); + public abstract List getUserAcls(); @Private @Unstable - void setUserAcls(List acls); + public abstract void setUserAcls(List acls); } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Resource.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Resource.java index fc120339204..19f868f0738 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Resource.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Resource.java @@ -22,6 +22,7 @@ import org.apache.hadoop.classification.InterfaceAudience.Public; import org.apache.hadoop.classification.InterfaceStability.Evolving; import org.apache.hadoop.classification.InterfaceStability.Stable; import org.apache.hadoop.yarn.api.AMRMProtocol; +import org.apache.hadoop.yarn.util.Records; /** *

Resource models a set of computer resources in the @@ -39,6 +40,15 @@ import org.apache.hadoop.yarn.api.AMRMProtocol; @Stable public abstract class Resource implements Comparable { + @Public + @Stable + public static Resource newInstance(int memory, int vCores) { + Resource resource = Records.newRecord(Resource.class); + resource.setMemory(memory); + resource.setVirtualCores(vCores); + return resource; + } + /** * Get memory of the resource. * @return memory of the resource diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ResourceRequest.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ResourceRequest.java index 0406a57525d..81c418ea35a 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ResourceRequest.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ResourceRequest.java @@ -21,6 +21,7 @@ package org.apache.hadoop.yarn.api.records; import org.apache.hadoop.classification.InterfaceAudience.Public; import org.apache.hadoop.classification.InterfaceStability.Stable; import org.apache.hadoop.yarn.api.AMRMProtocol; +import org.apache.hadoop.yarn.util.Records; /** *

ResourceRequest represents the request made by an @@ -50,6 +51,18 @@ import org.apache.hadoop.yarn.api.AMRMProtocol; @Stable public abstract class ResourceRequest implements Comparable { + @Public + @Stable + public static ResourceRequest newInstance(Priority priority, + String hostName, Resource capability, int numContainers) { + ResourceRequest request = Records.newRecord(ResourceRequest.class); + request.setPriority(priority); + request.setHostName(hostName); + request.setCapability(capability); + request.setNumContainers(numContainers); + return request; + } + /** * The constant string representing no locality. * It should be used by all references that want to pass an arbitrary host diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/URL.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/URL.java index 973302fff67..0a6b715e497 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/URL.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/URL.java @@ -20,14 +20,27 @@ package org.apache.hadoop.yarn.api.records; import org.apache.hadoop.classification.InterfaceAudience.Public; import org.apache.hadoop.classification.InterfaceStability.Evolving; +import org.apache.hadoop.classification.InterfaceStability.Stable; +import org.apache.hadoop.yarn.util.Records; /** *

URL represents a serializable {@link java.net.URL}.

*/ @Public @Evolving -public interface URL { - +public abstract class URL { + + @Public + @Stable + public static URL newInstance(String scheme, String host, int port, String file) { + URL url = Records.newRecord(URL.class); + url.setScheme(scheme); + url.setHost(host); + url.setPort(port); + url.setFile(file); + return url; + } + /** * Get the scheme of the URL. * @return scheme of the URL diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/YarnClusterMetrics.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/YarnClusterMetrics.java index 8ecf60c0edf..5d0565ce728 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/YarnClusterMetrics.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/YarnClusterMetrics.java @@ -22,6 +22,7 @@ import org.apache.hadoop.classification.InterfaceAudience.Private; import org.apache.hadoop.classification.InterfaceAudience.Public; import org.apache.hadoop.classification.InterfaceStability.Stable; import org.apache.hadoop.classification.InterfaceStability.Unstable; +import org.apache.hadoop.yarn.util.Records; /** *

YarnClusterMetrics represents cluster metrics.

@@ -30,8 +31,15 @@ import org.apache.hadoop.classification.InterfaceStability.Unstable; */ @Public @Stable -public interface YarnClusterMetrics { +public abstract class YarnClusterMetrics { + @Private + public static YarnClusterMetrics newInstance(int numNodeManagers) { + YarnClusterMetrics metrics = Records.newRecord(YarnClusterMetrics.class); + metrics.setNumNodeManagers(numNodeManagers); + return metrics; + } + /** * Get the number of NodeManagers in the cluster. * @return number of NodeManagers in the cluster diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ApplicationMasterPBImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ApplicationMasterPBImpl.java deleted file mode 100644 index f136a4a506c..00000000000 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ApplicationMasterPBImpl.java +++ /dev/null @@ -1,294 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.yarn.api.records.impl.pb; - -import org.apache.hadoop.security.proto.SecurityProtos.TokenProto; -import org.apache.hadoop.yarn.api.records.ApplicationId; -import org.apache.hadoop.yarn.api.records.ApplicationMaster; -import org.apache.hadoop.yarn.api.records.ApplicationStatus; -import org.apache.hadoop.yarn.api.records.ClientToken; -import org.apache.hadoop.yarn.api.records.ProtoBase; -import org.apache.hadoop.yarn.api.records.YarnApplicationState; -import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationIdProto; -import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationMasterProto; -import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationMasterProtoOrBuilder; -import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationStatusProto; -import org.apache.hadoop.yarn.proto.YarnProtos.YarnApplicationStateProto; -import org.apache.hadoop.yarn.util.ProtoUtils; - -public class ApplicationMasterPBImpl extends ProtoBase - implements ApplicationMaster { - ApplicationMasterProto proto = ApplicationMasterProto.getDefaultInstance(); - ApplicationMasterProto.Builder builder = null; - boolean viaProto = false; - - private ApplicationId applicationId = null; - private ApplicationStatus applicationStatus = null; - private ClientToken clientToken = null; - - public ApplicationMasterPBImpl() { - builder = ApplicationMasterProto.newBuilder(); - } - - public ApplicationMasterPBImpl(ApplicationMasterProto proto) { - this.proto = proto; - viaProto = true; - } - - public ApplicationMasterProto getProto() { - - mergeLocalToProto(); - proto = viaProto ? proto : builder.build(); - viaProto = true; - return proto; - } - - private void mergeLocalToBuilder() { - if (this.applicationId != null - && !((ApplicationIdPBImpl) this.applicationId).getProto().equals( - builder.getApplicationId())) { - builder.setApplicationId(convertToProtoFormat(this.applicationId)); - } - - if (this.applicationStatus != null - && !((ApplicationStatusPBImpl) this.applicationStatus).getProto() - .equals(builder.getStatus())) { - builder.setStatus(convertToProtoFormat(this.applicationStatus)); - } - if (this.clientToken != null - && !((ClientTokenPBImpl) this.clientToken).getProto().equals( - builder.getClientToken())) { - builder.setClientToken(convertToProtoFormat(this.clientToken)); - } - } - - private void mergeLocalToProto() { - if (viaProto) - maybeInitBuilder(); - mergeLocalToBuilder(); - proto = builder.build(); - - viaProto = true; - } - - private void maybeInitBuilder() { - if (viaProto || builder == null) { - builder = ApplicationMasterProto.newBuilder(proto); - } - viaProto = false; - } - - - @Override - public YarnApplicationState getState() { - ApplicationMasterProtoOrBuilder p = viaProto ? proto : builder; - if (!p.hasState()) { - return null; - } - return convertFromProtoFormat(p.getState()); - } - - @Override - public void setState(YarnApplicationState state) { - maybeInitBuilder(); - if (state == null) { - builder.clearState(); - return; - } - builder.setState(convertToProtoFormat(state)); - } - @Override - public String getHost() { - ApplicationMasterProtoOrBuilder p = viaProto ? proto : builder; - if (!p.hasHost()) { - return null; - } - return (p.getHost()); - } - - @Override - public void setHost(String host) { - maybeInitBuilder(); - if (host == null) { - builder.clearHost(); - return; - } - builder.setHost((host)); - } - - @Override - public ApplicationId getApplicationId() { - ApplicationMasterProtoOrBuilder p = viaProto ? proto : builder; - if (this.applicationId != null) { - return applicationId; - } // Else via proto - if (!p.hasApplicationId()) { - return null; - } - applicationId = convertFromProtoFormat(p.getApplicationId()); - - return applicationId; - } - - @Override - public void setApplicationId(ApplicationId applicationId) { - maybeInitBuilder(); - if (applicationId == null) - builder.clearApplicationId(); - this.applicationId = applicationId; - - } - @Override - public int getRpcPort() { - ApplicationMasterProtoOrBuilder p = viaProto ? proto : builder; - return (p.getRpcPort()); - } - - @Override - public void setRpcPort(int rpcPort) { - maybeInitBuilder(); - builder.setRpcPort((rpcPort)); - } - @Override - public String getTrackingUrl() { - ApplicationMasterProtoOrBuilder p = viaProto ? proto : builder; - return (p.getTrackingUrl()); - } - - @Override - public void setTrackingUrl(String url) { - maybeInitBuilder(); - builder.setTrackingUrl(url); - } - @Override - public ApplicationStatus getStatus() { - ApplicationMasterProtoOrBuilder p = viaProto ? proto : builder; - if (this.applicationStatus != null) { - return this.applicationStatus; - } // Else via proto - if (!p.hasStatus()) { - return null; - } - this.applicationStatus = convertFromProtoFormat(p.getStatus()); - - return this.applicationStatus; - } - - @Override - public void setStatus(ApplicationStatus status) { - maybeInitBuilder(); - if (status == null) - builder.clearStatus(); - this.applicationStatus = status; - - } - - @Override - public ClientToken getClientToken() { - ApplicationMasterProtoOrBuilder p = viaProto ? proto : builder; - if (this.clientToken != null) { - return this.clientToken; - } - if (!p.hasClientToken()) { - return null; - } - this.clientToken = convertFromProtoFormat(p.getClientToken()); - return this.clientToken; - } - - @Override - public void setClientToken(ClientToken clientToken) { - maybeInitBuilder(); - if (clientToken == null) - builder.clearClientToken(); - this.clientToken = clientToken; - } - - @Override - public int getAMFailCount() { - ApplicationMasterProtoOrBuilder p = viaProto ? proto : builder; - return (p.getAmFailCount()); - } - - @Override - public int getContainerCount() { - ApplicationMasterProtoOrBuilder p = viaProto ? proto : builder; - return (p.getContainerCount()); - } - - @Override - public void setAMFailCount(int amFailCount) { - maybeInitBuilder(); - builder.setAmFailCount(amFailCount); - } - - @Override - public void setContainerCount(int containerCount) { - maybeInitBuilder(); - builder.setContainerCount(containerCount); - } - - @Override - public String getDiagnostics() { - ApplicationMasterProtoOrBuilder p = viaProto ? proto : builder; - return p.getDiagnostics(); - } - - @Override - public void setDiagnostics(String diagnostics) { - maybeInitBuilder(); - if (diagnostics == null) { - builder.clearDiagnostics(); - return; - } - builder.setDiagnostics(diagnostics); - } - - private YarnApplicationStateProto convertToProtoFormat(YarnApplicationState e) { - return ProtoUtils.convertToProtoFormat(e); - } - - private YarnApplicationState convertFromProtoFormat(YarnApplicationStateProto e) { - return ProtoUtils.convertFromProtoFormat(e); - } - - private ApplicationIdPBImpl convertFromProtoFormat(ApplicationIdProto p) { - return new ApplicationIdPBImpl(p); - } - - private ApplicationIdProto convertToProtoFormat(ApplicationId t) { - return ((ApplicationIdPBImpl)t).getProto(); - } - - private ApplicationStatusPBImpl convertFromProtoFormat(ApplicationStatusProto p) { - return new ApplicationStatusPBImpl(p); - } - - private ApplicationStatusProto convertToProtoFormat(ApplicationStatus t) { - return ((ApplicationStatusPBImpl)t).getProto(); - } - - private ClientTokenPBImpl convertFromProtoFormat(TokenProto p) { - return new ClientTokenPBImpl(p); - } - - private TokenProto convertToProtoFormat(ClientToken t) { - return ((ClientTokenPBImpl)t).getProto(); - } -} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ApplicationReportPBImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ApplicationReportPBImpl.java index 115888b933a..a4ed75041cc 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ApplicationReportPBImpl.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ApplicationReportPBImpl.java @@ -25,7 +25,6 @@ import org.apache.hadoop.yarn.api.records.ApplicationReport; import org.apache.hadoop.yarn.api.records.ApplicationResourceUsageReport; import org.apache.hadoop.yarn.api.records.ClientToken; import org.apache.hadoop.yarn.api.records.FinalApplicationStatus; -import org.apache.hadoop.yarn.api.records.ProtoBase; import org.apache.hadoop.yarn.api.records.YarnApplicationState; import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationAttemptIdProto; import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationIdProto; @@ -36,8 +35,7 @@ import org.apache.hadoop.yarn.proto.YarnProtos.FinalApplicationStatusProto; import org.apache.hadoop.yarn.proto.YarnProtos.YarnApplicationStateProto; import org.apache.hadoop.yarn.util.ProtoUtils; -public class ApplicationReportPBImpl extends ProtoBase -implements ApplicationReport { +public class ApplicationReportPBImpl extends ApplicationReport { ApplicationReportProto proto = ApplicationReportProto.getDefaultInstance(); ApplicationReportProto.Builder builder = null; boolean viaProto = false; @@ -376,7 +374,6 @@ implements ApplicationReport { builder.setProgress(progress); } - @Override public ApplicationReportProto getProto() { mergeLocalToProto(); proto = viaProto ? proto : builder.build(); @@ -384,6 +381,26 @@ implements ApplicationReport { return proto; } + @Override + public int hashCode() { + return getProto().hashCode(); + } + + @Override + public boolean equals(Object other) { + if (other == null) + return false; + if (other.getClass().isAssignableFrom(this.getClass())) { + return this.getProto().equals(this.getClass().cast(other).getProto()); + } + return false; + } + + @Override + public String toString() { + return getProto().toString().replaceAll("\\n", ", ").replaceAll("\\s+", " "); + } + private void mergeLocalToBuilder() { if (this.applicationId != null && !((ApplicationIdPBImpl) this.applicationId).getProto().equals( diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ApplicationResourceUsageReportPBImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ApplicationResourceUsageReportPBImpl.java index 83cf9477c08..9fa8e9dd4cc 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ApplicationResourceUsageReportPBImpl.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ApplicationResourceUsageReportPBImpl.java @@ -19,15 +19,13 @@ package org.apache.hadoop.yarn.api.records.impl.pb; import org.apache.hadoop.yarn.api.records.ApplicationResourceUsageReport; -import org.apache.hadoop.yarn.api.records.ProtoBase; import org.apache.hadoop.yarn.api.records.Resource; import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationResourceUsageReportProto; import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationResourceUsageReportProtoOrBuilder; import org.apache.hadoop.yarn.proto.YarnProtos.ResourceProto; public class ApplicationResourceUsageReportPBImpl -extends ProtoBase -implements ApplicationResourceUsageReport { +extends ApplicationResourceUsageReport { ApplicationResourceUsageReportProto proto = ApplicationResourceUsageReportProto.getDefaultInstance(); ApplicationResourceUsageReportProto.Builder builder = null; @@ -54,6 +52,26 @@ implements ApplicationResourceUsageReport { return proto; } + @Override + public int hashCode() { + return getProto().hashCode(); + } + + @Override + public boolean equals(Object other) { + if (other == null) + return false; + if (other.getClass().isAssignableFrom(this.getClass())) { + return this.getProto().equals(this.getClass().cast(other).getProto()); + } + return false; + } + + @Override + public String toString() { + return getProto().toString().replaceAll("\\n", ", ").replaceAll("\\s+", " "); + } + private void mergeLocalToBuilder() { if (this.usedResources != null && !((ResourcePBImpl) this.usedResources).getProto().equals( diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ApplicationStatusPBImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ApplicationStatusPBImpl.java deleted file mode 100644 index ccfea17a315..00000000000 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ApplicationStatusPBImpl.java +++ /dev/null @@ -1,134 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.yarn.api.records.impl.pb; - - -import org.apache.hadoop.yarn.api.records.ApplicationAttemptId; -import org.apache.hadoop.yarn.api.records.ApplicationStatus; -import org.apache.hadoop.yarn.api.records.ProtoBase; -import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationAttemptIdProto; -import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationStatusProto; -import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationStatusProtoOrBuilder; - - - -public class ApplicationStatusPBImpl extends ProtoBase implements ApplicationStatus { - ApplicationStatusProto proto = ApplicationStatusProto.getDefaultInstance(); - ApplicationStatusProto.Builder builder = null; - boolean viaProto = false; - - private ApplicationAttemptId applicationAttemptId = null; - - - public ApplicationStatusPBImpl() { - builder = ApplicationStatusProto.newBuilder(); - } - - public ApplicationStatusPBImpl(ApplicationStatusProto proto) { - this.proto = proto; - viaProto = true; - } - - public ApplicationStatusProto getProto() { - - mergeLocalToProto(); - proto = viaProto ? proto : builder.build(); - viaProto = true; - return proto; - } - - private void mergeLocalToBuilder() { - if (this.applicationAttemptId != null && !((ApplicationAttemptIdPBImpl)this.applicationAttemptId).getProto().equals(builder.getApplicationAttemptId())) { - builder.setApplicationAttemptId(convertToProtoFormat(this.applicationAttemptId)); - } - } - - private void mergeLocalToProto() { - if (viaProto) - maybeInitBuilder(); - mergeLocalToBuilder(); - proto = builder.build(); - - viaProto = true; - } - - private void maybeInitBuilder() { - if (viaProto || builder == null) { - builder = ApplicationStatusProto.newBuilder(proto); - } - viaProto = false; - } - - - @Override - public int getResponseId() { - ApplicationStatusProtoOrBuilder p = viaProto ? proto : builder; - return (p.getResponseId()); - } - - @Override - public void setResponseId(int responseId) { - maybeInitBuilder(); - builder.setResponseId((responseId)); - } - - @Override - public ApplicationAttemptId getApplicationAttemptId() { - ApplicationStatusProtoOrBuilder p = viaProto ? proto : builder; - if (this.applicationAttemptId != null) { - return this.applicationAttemptId; - } - if (!p.hasApplicationAttemptId()) { - return null; - } - this.applicationAttemptId = convertFromProtoFormat(p.getApplicationAttemptId()); - return this.applicationAttemptId; - } - - @Override - public void setApplicationAttemptId(ApplicationAttemptId applicationAttemptId) { - maybeInitBuilder(); - if (applicationAttemptId == null) - builder.clearApplicationAttemptId(); - this.applicationAttemptId = applicationAttemptId; - } - - @Override - public float getProgress() { - ApplicationStatusProtoOrBuilder p = viaProto ? proto : builder; - return (p.getProgress()); - } - - @Override - public void setProgress(float progress) { - maybeInitBuilder(); - builder.setProgress((progress)); - } - - private ApplicationAttemptIdPBImpl convertFromProtoFormat(ApplicationAttemptIdProto p) { - return new ApplicationAttemptIdPBImpl(p); - } - - private ApplicationAttemptIdProto convertToProtoFormat(ApplicationAttemptId t) { - return ((ApplicationAttemptIdPBImpl)t).getProto(); - } - - - -} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ApplicationSubmissionContextPBImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ApplicationSubmissionContextPBImpl.java index 996b8032576..0968aaff974 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ApplicationSubmissionContextPBImpl.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ApplicationSubmissionContextPBImpl.java @@ -22,7 +22,6 @@ import org.apache.hadoop.yarn.api.records.ApplicationId; import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext; import org.apache.hadoop.yarn.api.records.ContainerLaunchContext; import org.apache.hadoop.yarn.api.records.Priority; -import org.apache.hadoop.yarn.api.records.ProtoBase; import org.apache.hadoop.yarn.api.records.Resource; import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationIdProto; import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationSubmissionContextProto; @@ -32,8 +31,7 @@ import org.apache.hadoop.yarn.proto.YarnProtos.PriorityProto; import org.apache.hadoop.yarn.proto.YarnProtos.ResourceProto; public class ApplicationSubmissionContextPBImpl -extends ProtoBase -implements ApplicationSubmissionContext { +extends ApplicationSubmissionContext { ApplicationSubmissionContextProto proto = ApplicationSubmissionContextProto.getDefaultInstance(); ApplicationSubmissionContextProto.Builder builder = null; @@ -61,6 +59,26 @@ implements ApplicationSubmissionContext { return proto; } + @Override + public int hashCode() { + return getProto().hashCode(); + } + + @Override + public boolean equals(Object other) { + if (other == null) + return false; + if (other.getClass().isAssignableFrom(this.getClass())) { + return this.getProto().equals(this.getClass().cast(other).getProto()); + } + return false; + } + + @Override + public String toString() { + return getProto().toString().replaceAll("\\n", ", ").replaceAll("\\s+", " "); + } + private void mergeLocalToBuilder() { if (this.applicationId != null) { builder.setApplicationId(convertToProtoFormat(this.applicationId)); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ContainerLaunchContextPBImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ContainerLaunchContextPBImpl.java index 5ab7e12fa55..bd74b923725 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ContainerLaunchContextPBImpl.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ContainerLaunchContextPBImpl.java @@ -28,7 +28,6 @@ import java.util.Map; import org.apache.hadoop.yarn.api.records.ApplicationAccessType; import org.apache.hadoop.yarn.api.records.ContainerLaunchContext; import org.apache.hadoop.yarn.api.records.LocalResource; -import org.apache.hadoop.yarn.api.records.ProtoBase; import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationACLMapProto; import org.apache.hadoop.yarn.proto.YarnProtos.ContainerLaunchContextProto; import org.apache.hadoop.yarn.proto.YarnProtos.ContainerLaunchContextProtoOrBuilder; @@ -38,9 +37,10 @@ import org.apache.hadoop.yarn.proto.YarnProtos.StringLocalResourceMapProto; import org.apache.hadoop.yarn.proto.YarnProtos.StringStringMapProto; import org.apache.hadoop.yarn.util.ProtoUtils; +import com.google.protobuf.ByteString; + public class ContainerLaunchContextPBImpl -extends ProtoBase -implements ContainerLaunchContext { +extends ContainerLaunchContext { ContainerLaunchContextProto proto = ContainerLaunchContextProto.getDefaultInstance(); ContainerLaunchContextProto.Builder builder = null; @@ -68,7 +68,35 @@ implements ContainerLaunchContext { viaProto = true; return proto; } - + + @Override + public int hashCode() { + return getProto().hashCode(); + } + + @Override + public boolean equals(Object other) { + if (other == null) + return false; + if (other.getClass().isAssignableFrom(this.getClass())) { + return this.getProto().equals(this.getClass().cast(other).getProto()); + } + return false; + } + + @Override + public String toString() { + return getProto().toString().replaceAll("\\n", ", ").replaceAll("\\s+", " "); + } + + protected final ByteBuffer convertFromProtoFormat(ByteString byteString) { + return ProtoUtils.convertFromProtoFormat(byteString); + } + + protected final ByteString convertToProtoFormat(ByteBuffer byteBuffer) { + return ProtoUtils.convertToProtoFormat(byteBuffer); + } + private void mergeLocalToBuilder() { if (this.localResources != null) { addLocalResourcesToProto(); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ContainerPBImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ContainerPBImpl.java index 68bb0839a9e..46ebfb6e0b2 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ContainerPBImpl.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ContainerPBImpl.java @@ -24,7 +24,6 @@ import org.apache.hadoop.yarn.api.records.ContainerId; import org.apache.hadoop.yarn.api.records.ContainerToken; import org.apache.hadoop.yarn.api.records.NodeId; import org.apache.hadoop.yarn.api.records.Priority; -import org.apache.hadoop.yarn.api.records.ProtoBase; import org.apache.hadoop.yarn.api.records.Resource; import org.apache.hadoop.yarn.proto.YarnProtos.ContainerIdProto; import org.apache.hadoop.yarn.proto.YarnProtos.ContainerProto; @@ -33,7 +32,7 @@ import org.apache.hadoop.yarn.proto.YarnProtos.NodeIdProto; import org.apache.hadoop.yarn.proto.YarnProtos.PriorityProto; import org.apache.hadoop.yarn.proto.YarnProtos.ResourceProto; -public class ContainerPBImpl extends ProtoBase implements Container { +public class ContainerPBImpl extends Container { ContainerProto proto = ContainerProto.getDefaultInstance(); ContainerProto.Builder builder = null; @@ -62,6 +61,21 @@ public class ContainerPBImpl extends ProtoBase implements Contai return proto; } + @Override + public int hashCode() { + return getProto().hashCode(); + } + + @Override + public boolean equals(Object other) { + if (other == null) + return false; + if (other.getClass().isAssignableFrom(this.getClass())) { + return this.getProto().equals(this.getClass().cast(other).getProto()); + } + return false; + } + private void mergeLocalToBuilder() { if (this.containerId != null && !((ContainerIdPBImpl) containerId).getProto().equals( diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ContainerStatusPBImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ContainerStatusPBImpl.java index bfde5dd2d8c..5c0a1c0e285 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ContainerStatusPBImpl.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ContainerStatusPBImpl.java @@ -22,7 +22,6 @@ package org.apache.hadoop.yarn.api.records.impl.pb; import org.apache.hadoop.yarn.api.records.ContainerId; import org.apache.hadoop.yarn.api.records.ContainerState; import org.apache.hadoop.yarn.api.records.ContainerStatus; -import org.apache.hadoop.yarn.api.records.ProtoBase; import org.apache.hadoop.yarn.proto.YarnProtos.ContainerIdProto; import org.apache.hadoop.yarn.proto.YarnProtos.ContainerStateProto; import org.apache.hadoop.yarn.proto.YarnProtos.ContainerStatusProto; @@ -31,8 +30,7 @@ import org.apache.hadoop.yarn.util.ProtoUtils; -public class ContainerStatusPBImpl extends ProtoBase -implements ContainerStatus { +public class ContainerStatusPBImpl extends ContainerStatus { ContainerStatusProto proto = ContainerStatusProto.getDefaultInstance(); ContainerStatusProto.Builder builder = null; boolean viaProto = false; @@ -56,6 +54,26 @@ implements ContainerStatus { return proto; } + @Override + public int hashCode() { + return getProto().hashCode(); + } + + @Override + public boolean equals(Object other) { + if (other == null) + return false; + if (other.getClass().isAssignableFrom(this.getClass())) { + return this.getProto().equals(this.getClass().cast(other).getProto()); + } + return false; + } + + @Override + public String toString() { + return getProto().toString().replaceAll("\\n", ", ").replaceAll("\\s+", " "); + } + private void mergeLocalToBuilder() { if (containerId != null) { builder.setContainerId(convertToProtoFormat(this.containerId)); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/LocalResourcePBImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/LocalResourcePBImpl.java index 60ea0da6ca0..4dd77bc3232 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/LocalResourcePBImpl.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/LocalResourcePBImpl.java @@ -21,7 +21,6 @@ package org.apache.hadoop.yarn.api.records.impl.pb; import org.apache.hadoop.yarn.api.records.LocalResource; import org.apache.hadoop.yarn.api.records.LocalResourceType; import org.apache.hadoop.yarn.api.records.LocalResourceVisibility; -import org.apache.hadoop.yarn.api.records.ProtoBase; import org.apache.hadoop.yarn.api.records.URL; import org.apache.hadoop.yarn.proto.YarnProtos.LocalResourceProto; import org.apache.hadoop.yarn.proto.YarnProtos.LocalResourceProtoOrBuilder; @@ -32,8 +31,7 @@ import org.apache.hadoop.yarn.util.ProtoUtils; -public class LocalResourcePBImpl extends ProtoBase - implements LocalResource { +public class LocalResourcePBImpl extends LocalResource { LocalResourceProto proto = LocalResourceProto.getDefaultInstance(); LocalResourceProto.Builder builder = null; boolean viaProto = false; @@ -56,6 +54,26 @@ public class LocalResourcePBImpl extends ProtoBase return proto; } + @Override + public int hashCode() { + return getProto().hashCode(); + } + + @Override + public boolean equals(Object other) { + if (other == null) + return false; + if (other.getClass().isAssignableFrom(this.getClass())) { + return this.getProto().equals(this.getClass().cast(other).getProto()); + } + return false; + } + + @Override + public String toString() { + return getProto().toString().replaceAll("\\n", ", ").replaceAll("\\s+", " "); + } + private synchronized void mergeLocalToBuilder() { LocalResourceProtoOrBuilder l = viaProto ? proto : builder; if (this.url != null diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/NodeHealthStatusPBImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/NodeHealthStatusPBImpl.java index 39dada75afa..a31427d9ed6 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/NodeHealthStatusPBImpl.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/NodeHealthStatusPBImpl.java @@ -19,12 +19,10 @@ package org.apache.hadoop.yarn.api.records.impl.pb; import org.apache.hadoop.yarn.api.records.NodeHealthStatus; -import org.apache.hadoop.yarn.api.records.ProtoBase; import org.apache.hadoop.yarn.proto.YarnProtos.NodeHealthStatusProto; import org.apache.hadoop.yarn.proto.YarnProtos.NodeHealthStatusProtoOrBuilder; -public class NodeHealthStatusPBImpl extends ProtoBase - implements NodeHealthStatus { +public class NodeHealthStatusPBImpl extends NodeHealthStatus { private NodeHealthStatusProto.Builder builder; private boolean viaProto = false; @@ -47,6 +45,26 @@ public class NodeHealthStatusPBImpl extends ProtoBase return this.proto; } + @Override + public int hashCode() { + return getProto().hashCode(); + } + + @Override + public boolean equals(Object other) { + if (other == null) + return false; + if (other.getClass().isAssignableFrom(this.getClass())) { + return this.getProto().equals(this.getClass().cast(other).getProto()); + } + return false; + } + + @Override + public String toString() { + return getProto().toString().replaceAll("\\n", ", ").replaceAll("\\s+", " "); + } + private void mergeLocalToProto() { if (this.viaProto) maybeInitBuilder(); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/NodeReportPBImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/NodeReportPBImpl.java index 115a7da60e2..72b9d436012 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/NodeReportPBImpl.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/NodeReportPBImpl.java @@ -22,7 +22,6 @@ import org.apache.hadoop.yarn.api.records.NodeHealthStatus; import org.apache.hadoop.yarn.api.records.NodeId; import org.apache.hadoop.yarn.api.records.NodeReport; import org.apache.hadoop.yarn.api.records.NodeState; -import org.apache.hadoop.yarn.api.records.ProtoBase; import org.apache.hadoop.yarn.api.records.Resource; import org.apache.hadoop.yarn.proto.YarnProtos.NodeHealthStatusProto; import org.apache.hadoop.yarn.proto.YarnProtos.NodeIdProto; @@ -31,8 +30,7 @@ import org.apache.hadoop.yarn.proto.YarnProtos.NodeReportProtoOrBuilder; import org.apache.hadoop.yarn.proto.YarnProtos.ResourceProto; import org.apache.hadoop.yarn.util.ProtoUtils; -public class NodeReportPBImpl extends ProtoBase - implements NodeReport { +public class NodeReportPBImpl extends NodeReport { private NodeReportProto proto = NodeReportProto.getDefaultInstance(); private NodeReportProto.Builder builder = null; @@ -206,7 +204,6 @@ public class NodeReportPBImpl extends ProtoBase this.used = used; } - @Override public NodeReportProto getProto() { mergeLocalToProto(); proto = viaProto ? proto : builder.build(); @@ -214,6 +211,26 @@ public class NodeReportPBImpl extends ProtoBase return proto; } + @Override + public int hashCode() { + return getProto().hashCode(); + } + + @Override + public boolean equals(Object other) { + if (other == null) + return false; + if (other.getClass().isAssignableFrom(this.getClass())) { + return this.getProto().equals(this.getClass().cast(other).getProto()); + } + return false; + } + + @Override + public String toString() { + return getProto().toString().replaceAll("\\n", ", ").replaceAll("\\s+", " "); + } + private void mergeLocalToBuilder() { if (this.nodeId != null && !((NodeIdPBImpl) this.nodeId).getProto().equals( diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/QueueInfoPBImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/QueueInfoPBImpl.java index 6862539405f..3c24c3479df 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/QueueInfoPBImpl.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/QueueInfoPBImpl.java @@ -23,7 +23,6 @@ import java.util.Iterator; import java.util.List; import org.apache.hadoop.yarn.api.records.ApplicationReport; -import org.apache.hadoop.yarn.api.records.ProtoBase; import org.apache.hadoop.yarn.api.records.QueueInfo; import org.apache.hadoop.yarn.api.records.QueueState; import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationReportProto; @@ -32,8 +31,7 @@ import org.apache.hadoop.yarn.proto.YarnProtos.QueueInfoProtoOrBuilder; import org.apache.hadoop.yarn.proto.YarnProtos.QueueStateProto; import org.apache.hadoop.yarn.util.ProtoUtils; -public class QueueInfoPBImpl extends ProtoBase implements - QueueInfo { +public class QueueInfoPBImpl extends QueueInfo { QueueInfoProto proto = QueueInfoProto.getDefaultInstance(); QueueInfoProto.Builder builder = null; @@ -150,7 +148,6 @@ public class QueueInfoPBImpl extends ProtoBase implements builder.setState(convertToProtoFormat(queueState)); } - @Override public QueueInfoProto getProto() { mergeLocalToProto(); proto = viaProto ? proto : builder.build(); @@ -158,6 +155,26 @@ public class QueueInfoPBImpl extends ProtoBase implements return proto; } + @Override + public int hashCode() { + return getProto().hashCode(); + } + + @Override + public boolean equals(Object other) { + if (other == null) + return false; + if (other.getClass().isAssignableFrom(this.getClass())) { + return this.getProto().equals(this.getClass().cast(other).getProto()); + } + return false; + } + + @Override + public String toString() { + return getProto().toString().replaceAll("\\n", ", ").replaceAll("\\s+", " "); + } + private void initLocalApplicationsList() { if (this.applicationsList != null) { return; diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/QueueUserACLInfoPBImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/QueueUserACLInfoPBImpl.java index 50eaeddfed4..a34eaa14644 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/QueueUserACLInfoPBImpl.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/QueueUserACLInfoPBImpl.java @@ -23,15 +23,13 @@ import java.util.Iterator; import java.util.List; import org.apache.hadoop.yarn.api.records.QueueACL; -import org.apache.hadoop.yarn.api.records.ProtoBase; import org.apache.hadoop.yarn.api.records.QueueUserACLInfo; import org.apache.hadoop.yarn.proto.YarnProtos.QueueACLProto; import org.apache.hadoop.yarn.proto.YarnProtos.QueueUserACLInfoProto; import org.apache.hadoop.yarn.proto.YarnProtos.QueueUserACLInfoProtoOrBuilder; import org.apache.hadoop.yarn.util.ProtoUtils; -public class QueueUserACLInfoPBImpl extends ProtoBase -implements QueueUserACLInfo { +public class QueueUserACLInfoPBImpl extends QueueUserACLInfo { QueueUserACLInfoProto proto = QueueUserACLInfoProto.getDefaultInstance(); QueueUserACLInfoProto.Builder builder = null; @@ -78,7 +76,6 @@ implements QueueUserACLInfo { this.userAclsList = userAclsList; } - @Override public QueueUserACLInfoProto getProto() { mergeLocalToProto(); proto = viaProto ? proto : builder.build(); @@ -86,6 +83,26 @@ implements QueueUserACLInfo { return proto; } + @Override + public int hashCode() { + return getProto().hashCode(); + } + + @Override + public boolean equals(Object other) { + if (other == null) + return false; + if (other.getClass().isAssignableFrom(this.getClass())) { + return this.getProto().equals(this.getClass().cast(other).getProto()); + } + return false; + } + + @Override + public String toString() { + return getProto().toString().replaceAll("\\n", ", ").replaceAll("\\s+", " "); + } + private void initLocalQueueUserAclsList() { if (this.userAclsList != null) { return; diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/URLPBImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/URLPBImpl.java index d7b1bd0bd38..4d5077667b7 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/URLPBImpl.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/URLPBImpl.java @@ -19,14 +19,13 @@ package org.apache.hadoop.yarn.api.records.impl.pb; -import org.apache.hadoop.yarn.api.records.ProtoBase; import org.apache.hadoop.yarn.api.records.URL; import org.apache.hadoop.yarn.proto.YarnProtos.URLProto; import org.apache.hadoop.yarn.proto.YarnProtos.URLProtoOrBuilder; -public class URLPBImpl extends ProtoBase implements URL { +public class URLPBImpl extends URL { URLProto proto = URLProto.getDefaultInstance(); URLProto.Builder builder = null; boolean viaProto = false; @@ -46,6 +45,26 @@ public class URLPBImpl extends ProtoBase implements URL { return proto; } + @Override + public int hashCode() { + return getProto().hashCode(); + } + + @Override + public boolean equals(Object other) { + if (other == null) + return false; + if (other.getClass().isAssignableFrom(this.getClass())) { + return this.getProto().equals(this.getClass().cast(other).getProto()); + } + return false; + } + + @Override + public String toString() { + return getProto().toString().replaceAll("\\n", ", ").replaceAll("\\s+", " "); + } + private void maybeInitBuilder() { if (viaProto || builder == null) { builder = URLProto.newBuilder(proto); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/YarnClusterMetricsPBImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/YarnClusterMetricsPBImpl.java index a6672ed2c41..bd31db03230 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/YarnClusterMetricsPBImpl.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/YarnClusterMetricsPBImpl.java @@ -19,14 +19,13 @@ package org.apache.hadoop.yarn.api.records.impl.pb; -import org.apache.hadoop.yarn.api.records.ProtoBase; import org.apache.hadoop.yarn.api.records.YarnClusterMetrics; import org.apache.hadoop.yarn.proto.YarnProtos.YarnClusterMetricsProto; import org.apache.hadoop.yarn.proto.YarnProtos.YarnClusterMetricsProtoOrBuilder; -public class YarnClusterMetricsPBImpl extends ProtoBase implements YarnClusterMetrics { +public class YarnClusterMetricsPBImpl extends YarnClusterMetrics { YarnClusterMetricsProto proto = YarnClusterMetricsProto.getDefaultInstance(); YarnClusterMetricsProto.Builder builder = null; boolean viaProto = false; @@ -46,6 +45,26 @@ public class YarnClusterMetricsPBImpl extends ProtoBase return proto; } + @Override + public int hashCode() { + return getProto().hashCode(); + } + + @Override + public boolean equals(Object other) { + if (other == null) + return false; + if (other.getClass().isAssignableFrom(this.getClass())) { + return this.getProto().equals(this.getClass().cast(other).getProto()); + } + return false; + } + + @Override + public String toString() { + return getProto().toString().replaceAll("\\n", ", ").replaceAll("\\s+", " "); + } + private void maybeInitBuilder() { if (viaProto || builder == null) { builder = YarnClusterMetricsProto.newBuilder(proto); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/LocalResourceRequest.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/LocalResourceRequest.java index 3d0e0fd3e2e..70bead7320a 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/LocalResourceRequest.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/LocalResourceRequest.java @@ -28,7 +28,7 @@ import org.apache.hadoop.yarn.api.records.URL; import org.apache.hadoop.yarn.util.ConverterUtils; public class LocalResourceRequest - implements LocalResource, Comparable { + extends LocalResource implements Comparable { private final Path loc; private final long timestamp; diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/MockAsm.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/MockAsm.java index 6f133905d13..3c99b449550 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/MockAsm.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/MockAsm.java @@ -25,15 +25,11 @@ import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.yarn.MockApps; import org.apache.hadoop.yarn.api.records.ApplicationAttemptId; import org.apache.hadoop.yarn.api.records.ApplicationId; -import org.apache.hadoop.yarn.api.records.ApplicationMaster; import org.apache.hadoop.yarn.api.records.ApplicationReport; -import org.apache.hadoop.yarn.api.records.ApplicationStatus; import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext; -import org.apache.hadoop.yarn.api.records.ClientToken; import org.apache.hadoop.yarn.api.records.Container; import org.apache.hadoop.yarn.api.records.ContainerId; import org.apache.hadoop.yarn.api.records.FinalApplicationStatus; -import org.apache.hadoop.yarn.api.records.YarnApplicationState; import org.apache.hadoop.yarn.conf.YarnConfiguration; import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp; import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppEvent; @@ -47,108 +43,6 @@ import com.google.common.collect.Lists; @InterfaceAudience.Private public abstract class MockAsm extends MockApps { - public static class AppMasterBase implements ApplicationMaster { - @Override - public ApplicationId getApplicationId() { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public String getHost() { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public int getRpcPort() { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public String getTrackingUrl() { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public ApplicationStatus getStatus() { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public YarnApplicationState getState() { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public ClientToken getClientToken() { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public int getAMFailCount() { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public int getContainerCount() { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public String getDiagnostics() { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public void setApplicationId(ApplicationId appId) { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public void setHost(String host) { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public void setRpcPort(int rpcPort) { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public void setTrackingUrl(String url) { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public void setStatus(ApplicationStatus status) { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public void setState(YarnApplicationState state) { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public void setClientToken(ClientToken clientToken) { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public void setAMFailCount(int amFailCount) { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public void setContainerCount(int containerCount) { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public void setDiagnostics(String diagnostics) { - throw new UnsupportedOperationException("Not supported yet."); - } - } - public static class ApplicationBase implements RMApp { @Override public String getUser() { diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestAMLaunchFailure.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestAMLaunchFailure.java index 130f0e473fc..6f5e1b2de6c 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestAMLaunchFailure.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestAMLaunchFailure.java @@ -30,7 +30,6 @@ import org.apache.commons.logging.LogFactory; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.yarn.api.protocolrecords.SubmitApplicationRequest; import org.apache.hadoop.yarn.api.records.ApplicationId; -import org.apache.hadoop.yarn.api.records.ApplicationMaster; import org.apache.hadoop.yarn.api.records.ApplicationReport; import org.apache.hadoop.yarn.api.records.YarnApplicationState; import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext; diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestAMRestart.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestAMRestart.java index 211eaa55095..116658f7b3a 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestAMRestart.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestAMRestart.java @@ -32,7 +32,6 @@ import org.apache.commons.logging.LogFactory; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.yarn.api.protocolrecords.SubmitApplicationRequest; import org.apache.hadoop.yarn.api.records.ApplicationId; -import org.apache.hadoop.yarn.api.records.ApplicationMaster; import org.apache.hadoop.yarn.api.records.YarnApplicationState; import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext; import org.apache.hadoop.yarn.api.records.Container; diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestASMStateMachine.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestASMStateMachine.java index d1d45d09f3b..e4731ecbac5 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestASMStateMachine.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestASMStateMachine.java @@ -27,7 +27,6 @@ import org.apache.commons.logging.LogFactory; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.yarn.api.records.ApplicationId; import org.apache.hadoop.yarn.api.records.YarnApplicationState; -import org.apache.hadoop.yarn.api.records.ApplicationStatus; import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext; import org.apache.hadoop.yarn.event.EventHandler; import org.apache.hadoop.yarn.factories.RecordFactory; diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestSchedulerNegotiator.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestSchedulerNegotiator.java index add00db378e..e33334735cb 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestSchedulerNegotiator.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestSchedulerNegotiator.java @@ -27,7 +27,6 @@ import junit.framework.Assert; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.yarn.api.records.ApplicationId; -import org.apache.hadoop.yarn.api.records.ApplicationMaster; import org.apache.hadoop.yarn.api.records.YarnApplicationState; import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext; import org.apache.hadoop.yarn.api.records.Container;