YARN-5199. Close LogReader in NMWebServices#getLogs. Contributed by Xuan Gong.

This commit is contained in:
Junping Du 2016-06-09 12:29:25 -07:00
parent 7e09601a90
commit 2be48e7d15
1 changed files with 11 additions and 7 deletions

View File

@ -36,7 +36,7 @@ import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import javax.ws.rs.core.StreamingOutput;
import javax.ws.rs.core.UriInfo;
import org.apache.commons.io.IOUtils;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.api.records.ApplicationId;
@ -241,6 +241,7 @@ public class NMWebServices {
@Override
public void write(OutputStream os) throws IOException,
WebApplicationException {
try {
int bufferSize = 65536;
byte[] buf = new byte[bufferSize];
int len;
@ -248,6 +249,9 @@ public class NMWebServices {
os.write(buf, 0, len);
}
os.flush();
} finally {
IOUtils.closeQuietly(fis);
}
}
};