diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/RMAppImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/RMAppImpl.java index 0b8f321..1d7bc6f 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/RMAppImpl.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/RMAppImpl.java @@ -128,7 +128,7 @@ private long startTime; private long finishTime = 0; private long storedFinishTime = 0; - private RMAppAttempt currentAttempt; + private volatile RMAppAttempt currentAttempt; private String queue; private EventHandler handler; private static final AppFinishedTransition FINISHED_TRANSITION = @@ -433,16 +433,10 @@ public String getUser() { @Override public float getProgress() { - this.readLock.lock(); - - try { - if (this.currentAttempt != null) { - return this.currentAttempt.getProgress(); - } - return 0; - } finally { - this.readLock.unlock(); + if (this.currentAttempt != null) { + return this.currentAttempt.getProgress(); } + return 0; } @Override @@ -473,13 +467,7 @@ public String getName() { @Override public RMAppAttempt getCurrentAppAttempt() { - this.readLock.lock(); - - try { - return this.currentAttempt; - } finally { - this.readLock.unlock(); - } + return this.currentAttempt; } @Override @@ -650,30 +638,18 @@ public long getSubmitTime() { @Override public String getTrackingUrl() { - this.readLock.lock(); - - try { - if (this.currentAttempt != null) { - return this.currentAttempt.getTrackingUrl(); - } - return null; - } finally { - this.readLock.unlock(); + if (this.currentAttempt != null) { + return this.currentAttempt.getTrackingUrl(); } + return null; } @Override public String getOriginalTrackingUrl() { - this.readLock.lock(); - - try { - if (this.currentAttempt != null) { - return this.currentAttempt.getOriginalTrackingUrl(); - } - return null; - } finally { - this.readLock.unlock(); + if (this.currentAttempt != null) { + return this.currentAttempt.getOriginalTrackingUrl(); } + return null; } @Override