|
@@ -128,7 +128,8 @@ public class RMAppImpl implements RMApp, Recoverable {
|
|
|
private long startTime;
|
|
|
private long finishTime = 0;
|
|
|
private long storedFinishTime = 0;
|
|
|
- private RMAppAttempt currentAttempt;
|
|
|
+ // This field isn't protected by readlock now.
|
|
|
+ private volatile RMAppAttempt currentAttempt;
|
|
|
private String queue;
|
|
|
private EventHandler handler;
|
|
|
private static final AppFinishedTransition FINISHED_TRANSITION =
|
|
@@ -438,16 +439,11 @@ public class RMAppImpl implements RMApp, Recoverable {
|
|
|
|
|
|
@Override
|
|
|
public float getProgress() {
|
|
|
- this.readLock.lock();
|
|
|
-
|
|
|
- try {
|
|
|
- if (this.currentAttempt != null) {
|
|
|
- return this.currentAttempt.getProgress();
|
|
|
- }
|
|
|
- return 0;
|
|
|
- } finally {
|
|
|
- this.readLock.unlock();
|
|
|
+ RMAppAttempt attempt = this.currentAttempt;
|
|
|
+ if (attempt != null) {
|
|
|
+ return attempt.getProgress();
|
|
|
}
|
|
|
+ return 0;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -478,13 +474,7 @@ public class RMAppImpl implements RMApp, Recoverable {
|
|
|
|
|
|
@Override
|
|
|
public RMAppAttempt getCurrentAppAttempt() {
|
|
|
- this.readLock.lock();
|
|
|
-
|
|
|
- try {
|
|
|
- return this.currentAttempt;
|
|
|
- } finally {
|
|
|
- this.readLock.unlock();
|
|
|
- }
|
|
|
+ return this.currentAttempt;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -655,30 +645,20 @@ public class RMAppImpl implements RMApp, Recoverable {
|
|
|
|
|
|
@Override
|
|
|
public String getTrackingUrl() {
|
|
|
- this.readLock.lock();
|
|
|
-
|
|
|
- try {
|
|
|
- if (this.currentAttempt != null) {
|
|
|
- return this.currentAttempt.getTrackingUrl();
|
|
|
- }
|
|
|
- return null;
|
|
|
- } finally {
|
|
|
- this.readLock.unlock();
|
|
|
+ RMAppAttempt attempt = this.currentAttempt;
|
|
|
+ if (attempt != null) {
|
|
|
+ return attempt.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();
|
|
|
+ RMAppAttempt attempt = this.currentAttempt;
|
|
|
+ if (attempt != null) {
|
|
|
+ return attempt.getOriginalTrackingUrl();
|
|
|
}
|
|
|
+ return null;
|
|
|
}
|
|
|
|
|
|
@Override
|