review comment - move index closure to finally

This commit is contained in:
nishantmonu51 2014-08-12 14:58:55 +05:30
parent 32b9290723
commit 9598a524a8
1 changed files with 88 additions and 84 deletions

View File

@ -283,7 +283,7 @@ public class IndexGeneratorJob implements Jobby
final AggregatorFactory[] aggs = config.getSchema().getDataSchema().getAggregators();
IncrementalIndex index = makeIncrementalIndex(bucket, aggs);
try {
File baseFlushFile = File.createTempFile("base", "flush");
baseFlushFile.delete();
baseFlushFile.mkdirs();
@ -327,6 +327,7 @@ public class IndexGeneratorJob implements Jobby
}
}
);
// close this index and make a new one
index.close();
index = makeIncrementalIndex(bucket, aggs);
@ -386,13 +387,16 @@ public class IndexGeneratorJob implements Jobby
}
);
}
index.close();
serializeOutIndex(context, bucket, mergedBase, Lists.newArrayList(allDimensionNames));
for (File file : toMerge) {
FileUtils.deleteDirectory(file);
}
}
finally {
index.close();
}
}
private void serializeOutIndex(Context context, Bucket bucket, File mergedBase, List<String> dimensionNames)
throws IOException