YARN-3882. AggregatedLogFormat should close aclScanner and ownerScanner
after create them. Contributed by zhihai xu
This commit is contained in:
parent
2eae130ab9
commit
688617d6d7
|
@ -589,6 +589,9 @@ Release 2.8.0 - UNRELEASED
|
|||
YARN-3875. FSSchedulerNode#reserveResource() doesn't print Application Id
|
||||
properly in log. (Bibin A Chundatt via devaraj)
|
||||
|
||||
YARN-3882. AggregatedLogFormat should close aclScanner and ownerScanner
|
||||
after create them. (zhihai xu via xgong)
|
||||
|
||||
Release 2.7.2 - UNRELEASED
|
||||
|
||||
INCOMPATIBLE CHANGES
|
||||
|
|
|
@ -489,7 +489,9 @@ public class AggregatedLogFormat {
|
|||
* @throws IOException
|
||||
*/
|
||||
public String getApplicationOwner() throws IOException {
|
||||
TFile.Reader.Scanner ownerScanner = reader.createScanner();
|
||||
TFile.Reader.Scanner ownerScanner = null;
|
||||
try {
|
||||
ownerScanner = reader.createScanner();
|
||||
LogKey key = new LogKey();
|
||||
while (!ownerScanner.atEnd()) {
|
||||
TFile.Reader.Scanner.Entry entry = ownerScanner.entry();
|
||||
|
@ -501,6 +503,9 @@ public class AggregatedLogFormat {
|
|||
ownerScanner.advance();
|
||||
}
|
||||
return null;
|
||||
} finally {
|
||||
IOUtils.cleanup(LOG, ownerScanner);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -513,7 +518,9 @@ public class AggregatedLogFormat {
|
|||
public Map<ApplicationAccessType, String> getApplicationAcls()
|
||||
throws IOException {
|
||||
// TODO Seek directly to the key once a comparator is specified.
|
||||
TFile.Reader.Scanner aclScanner = reader.createScanner();
|
||||
TFile.Reader.Scanner aclScanner = null;
|
||||
try {
|
||||
aclScanner = reader.createScanner();
|
||||
LogKey key = new LogKey();
|
||||
Map<ApplicationAccessType, String> acls =
|
||||
new HashMap<ApplicationAccessType, String>();
|
||||
|
@ -538,11 +545,13 @@ public class AggregatedLogFormat {
|
|||
}
|
||||
acls.put(ApplicationAccessType.valueOf(appAccessOp), aclString);
|
||||
}
|
||||
|
||||
}
|
||||
aclScanner.advance();
|
||||
}
|
||||
return acls;
|
||||
} finally {
|
||||
IOUtils.cleanup(LOG, aclScanner);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue