Skip to content

Commit 6049652

Browse files
committed
YARN-11786. Improve Some Code.
1 parent 07e1538 commit 6049652

File tree

5 files changed

+6
-7
lines changed

5 files changed

+6
-7
lines changed

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/timelineservice/FlowRunEntity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public void setRunId(long runId) {
109109
addInfo(FLOW_RUN_ID_INFO_KEY, runId);
110110
}
111111

112-
public long getStartTime() {
112+
public Long getStartTime() {
113113
return getCreatedTime();
114114
}
115115

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/timelineservice/TimelineEntity.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
*/
1818
package org.apache.hadoop.yarn.api.records.timelineservice;
1919

20-
import java.time.Instant;
2120
import java.util.HashMap;
2221
import java.util.HashSet;
2322
import java.util.Map;
@@ -32,7 +31,6 @@
3231

3332
import com.fasterxml.jackson.annotation.JsonIgnore;
3433
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
35-
import com.fasterxml.jackson.annotation.JsonInclude;
3634
import org.apache.hadoop.classification.InterfaceAudience;
3735
import org.apache.hadoop.classification.InterfaceStability;
3836
import org.apache.hadoop.yarn.util.TimelineServiceHelper;
@@ -152,7 +150,7 @@ public boolean equals(Object obj) {
152150
private NavigableSet<TimelineEvent> events = new TreeSet<>();
153151
private HashMap<String, Set<String>> isRelatedToEntities = new HashMap<>();
154152
private HashMap<String, Set<String>> relatesToEntities = new HashMap<>();
155-
private Long createdTime = Instant.EPOCH.toEpochMilli();
153+
private Long createdTime;
156154
private long idPrefix;
157155

158156
public TimelineEntity() {

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase-tests/src/test/java/org/apache/hadoop/yarn/server/timelineservice/reader/AbstractTimelineReaderHBaseTestBase.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@ protected HttpUrlConnectorProvider getHttpURLConnectionFactory() {
160160
url -> {
161161
HttpURLConnection conn;
162162
try {
163-
HttpURLConnection.setFollowRedirects(false);
164163
conn = (HttpURLConnection) url.openConnection();
165164
} catch (Exception e) {
166165
throw new IOException(e);

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase-tests/src/test/java/org/apache/hadoop/yarn/server/timelineservice/storage/flow/TestHBaseStorageFlowRun.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ public void testWriteFlowRunMinMax() throws Exception {
251251
new TimelineDataToRetrieve());
252252
assertTrue(TimelineEntityType.YARN_FLOW_RUN.matches(entity.getType()));
253253
FlowRunEntity flowRun = (FlowRunEntity)entity;
254-
assertEquals(minStartTs, flowRun.getStartTime());
254+
assertEquals(minStartTs, flowRun.getStartTime().longValue());
255255
assertEquals(endTs, flowRun.getMaxEndTime());
256256
} finally {
257257
if (hbr != null) {

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase/hadoop-yarn-server-timelineservice-hbase-client/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/HBaseTimelineWriterImpl.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,9 @@ protected void serviceStop() throws Exception {
690690
conn.close();
691691
}
692692
}
693-
storageMonitor.stop();
693+
if (storageMonitor != null) {
694+
storageMonitor.stop();
695+
}
694696
super.serviceStop();
695697
}
696698

0 commit comments

Comments
 (0)