mirror of https://github.com/apache/druid.git
Fix a resource leak in JobHelper (#10913)
Co-authored-by: Suneet Saldanha <suneet@apache.org>
This commit is contained in:
parent
8b4f966708
commit
82c4d9dd92
|
@ -370,10 +370,12 @@ public class JobHelper
|
||||||
{
|
{
|
||||||
if (hadoopJobId != null && hadoopJobIdFileName != null) {
|
if (hadoopJobId != null && hadoopJobIdFileName != null) {
|
||||||
try (final OutputStream out = Files.newOutputStream(Paths.get(hadoopJobIdFileName))) {
|
try (final OutputStream out = Files.newOutputStream(Paths.get(hadoopJobIdFileName))) {
|
||||||
|
try (final OutputStreamWriter osw = new OutputStreamWriter(out, StandardCharsets.UTF_8)) {
|
||||||
HadoopDruidIndexerConfig.JSON_MAPPER.writeValue(
|
HadoopDruidIndexerConfig.JSON_MAPPER.writeValue(
|
||||||
new OutputStreamWriter(out, StandardCharsets.UTF_8),
|
osw,
|
||||||
hadoopJobId
|
hadoopJobId
|
||||||
);
|
);
|
||||||
|
}
|
||||||
log.info("MR job id [%s] is written to the file [%s]", hadoopJobId, hadoopJobIdFileName);
|
log.info("MR job id [%s] is written to the file [%s]", hadoopJobId, hadoopJobIdFileName);
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
|
|
Loading…
Reference in New Issue