You are viewing a plain text version of this content. The canonical link for it is here.
Posted to yarn-commits@hadoop.apache.org by vi...@apache.org on 2014/02/05 01:32:40 UTC
svn commit: r1564585 - in
/hadoop/common/branches/branch-2/hadoop-yarn-project: ./
hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/apptimeline/
hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src...
Author: vinodkv
Date: Wed Feb 5 00:32:40 2014
New Revision: 1564585
URL: http://svn.apache.org/r1564585
Log:
YARN-1634. Added a testable in-memory implementation of ApplicationTimelineStore. Contributed by Zhijie Shen.
svn merge --ignore-ancestry -c 1564583 ../../trunk/
Added:
hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/apptimeline/EntityId.java
- copied unchanged from r1564583, hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/apptimeline/EntityId.java
hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/apptimeline/MemoryApplicationTimelineStore.java
- copied unchanged from r1564583, hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/apptimeline/MemoryApplicationTimelineStore.java
hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/apptimeline/
- copied from r1564583, hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/apptimeline/
Modified:
hadoop/common/branches/branch-2/hadoop-yarn-project/CHANGES.txt
hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/apptimeline/ATSEntity.java
Modified: hadoop/common/branches/branch-2/hadoop-yarn-project/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-yarn-project/CHANGES.txt?rev=1564585&r1=1564584&r2=1564585&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-yarn-project/CHANGES.txt (original)
+++ hadoop/common/branches/branch-2/hadoop-yarn-project/CHANGES.txt Wed Feb 5 00:32:40 2014
@@ -67,6 +67,9 @@ Release 2.4.0 - UNRELEASED
implementing different storage impls for storing timeline information.
(Billie Rinaldi via vinodkv)
+ YARN-1634. Added a testable in-memory implementation of
+ ApplicationTimelineStore. (Zhijie Shen via vinodkv)
+
IMPROVEMENTS
YARN-1007. Enhance History Reader interface for Containers. (Mayank Bansal via
Modified: hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/apptimeline/ATSEntity.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/apptimeline/ATSEntity.java?rev=1564585&r1=1564584&r2=1564585&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/apptimeline/ATSEntity.java (original)
+++ hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/apptimeline/ATSEntity.java Wed Feb 5 00:32:40 2014
@@ -50,7 +50,7 @@ import org.apache.hadoop.classification.
@XmlAccessorType(XmlAccessType.NONE)
@Public
@Unstable
-public class ATSEntity {
+public class ATSEntity implements Comparable<ATSEntity> {
private String entityType;
private String entityId;
@@ -310,4 +310,92 @@ public class ATSEntity {
this.otherInfo = otherInfo;
}
+ @Override
+ public int hashCode() {
+ // generated by eclipse
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((entityId == null) ? 0 : entityId.hashCode());
+ result =
+ prime * result + ((entityType == null) ? 0 : entityType.hashCode());
+ result = prime * result + ((events == null) ? 0 : events.hashCode());
+ result = prime * result + ((otherInfo == null) ? 0 : otherInfo.hashCode());
+ result =
+ prime * result
+ + ((primaryFilters == null) ? 0 : primaryFilters.hashCode());
+ result =
+ prime * result
+ + ((relatedEntities == null) ? 0 : relatedEntities.hashCode());
+ result = prime * result + ((startTime == null) ? 0 : startTime.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ // generated by eclipse
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ ATSEntity other = (ATSEntity) obj;
+ if (entityId == null) {
+ if (other.entityId != null)
+ return false;
+ } else if (!entityId.equals(other.entityId))
+ return false;
+ if (entityType == null) {
+ if (other.entityType != null)
+ return false;
+ } else if (!entityType.equals(other.entityType))
+ return false;
+ if (events == null) {
+ if (other.events != null)
+ return false;
+ } else if (!events.equals(other.events))
+ return false;
+ if (otherInfo == null) {
+ if (other.otherInfo != null)
+ return false;
+ } else if (!otherInfo.equals(other.otherInfo))
+ return false;
+ if (primaryFilters == null) {
+ if (other.primaryFilters != null)
+ return false;
+ } else if (!primaryFilters.equals(other.primaryFilters))
+ return false;
+ if (relatedEntities == null) {
+ if (other.relatedEntities != null)
+ return false;
+ } else if (!relatedEntities.equals(other.relatedEntities))
+ return false;
+ if (startTime == null) {
+ if (other.startTime != null)
+ return false;
+ } else if (!startTime.equals(other.startTime))
+ return false;
+ return true;
+ }
+
+ @Override
+ public int compareTo(ATSEntity other) {
+ int comparison = entityType.compareTo(other.entityType);
+ if (comparison == 0) {
+ long thisStartTime =
+ startTime == null ? Long.MIN_VALUE : startTime;
+ long otherStartTime =
+ other.startTime == null ? Long.MIN_VALUE : other.startTime;
+ if (thisStartTime > otherStartTime) {
+ return -1;
+ } else if (thisStartTime < otherStartTime) {
+ return 1;
+ } else {
+ return entityId.compareTo(other.entityId);
+ }
+ } else {
+ return comparison;
+ }
+ }
+
}