svn merge -c 1411289 FIXES: YARN-219. NM should aggregate logs when application finishes. (bobby)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1411295 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Joseph Evans 2012-11-19 16:45:14 +00:00
parent fa6b7fca7a
commit f1653b3ea8
2 changed files with 10 additions and 10 deletions

View File

@ -230,6 +230,8 @@ Release 0.23.5 - UNRELEASED
YARN-212. NM state machine ignores an APPLICATION_CONTAINER_FINISHED event YARN-212. NM state machine ignores an APPLICATION_CONTAINER_FINISHED event
when it shouldn't (Nathan Roberts via jlowe) when it shouldn't (Nathan Roberts via jlowe)
YARN-219. NM should aggregate logs when application finishes. (bobby)
Release 0.23.4 Release 0.23.4
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -149,18 +149,15 @@ public class AppLogAggregatorImpl implements AppLogAggregator {
ContainerId containerId; ContainerId containerId;
while (!this.appFinishing.get()) { while (!this.appFinishing.get()) {
synchronized(this) {
try { try {
containerId = this.pendingContainers.poll(); wait(THREAD_SLEEP_TIME);
if (containerId == null) {
Thread.sleep(THREAD_SLEEP_TIME);
} else {
uploadLogsForContainer(containerId);
}
} catch (InterruptedException e) { } catch (InterruptedException e) {
LOG.warn("PendingContainers queue is interrupted"); LOG.warn("PendingContainers queue is interrupted");
this.appFinishing.set(true); this.appFinishing.set(true);
} }
} }
}
// Application is finished. Finish pending-containers // Application is finished. Finish pending-containers
while ((containerId = this.pendingContainers.poll()) != null) { while ((containerId = this.pendingContainers.poll()) != null) {
@ -251,8 +248,9 @@ public class AppLogAggregatorImpl implements AppLogAggregator {
} }
@Override @Override
public void finishLogAggregation() { public synchronized void finishLogAggregation() {
LOG.info("Application just finished : " + this.applicationId); LOG.info("Application just finished : " + this.applicationId);
this.appFinishing.set(true); this.appFinishing.set(true);
this.notifyAll();
} }
} }