mirror of https://github.com/apache/druid.git
proper closing of resources in case of query cancellation
This commit is contained in:
parent
1be85af320
commit
32f6243be0
|
@ -60,27 +60,29 @@ public class TimeseriesQueryEngine
|
||||||
{
|
{
|
||||||
Aggregator[] aggregators = QueryRunnerHelper.makeAggregators(cursor, aggregatorSpecs);
|
Aggregator[] aggregators = QueryRunnerHelper.makeAggregators(cursor, aggregatorSpecs);
|
||||||
|
|
||||||
while (!cursor.isDone()) {
|
try {
|
||||||
for (Aggregator aggregator : aggregators) {
|
while (!cursor.isDone()) {
|
||||||
aggregator.aggregate();
|
for (Aggregator aggregator : aggregators) {
|
||||||
|
aggregator.aggregate();
|
||||||
|
}
|
||||||
|
cursor.advance();
|
||||||
}
|
}
|
||||||
cursor.advance();
|
|
||||||
|
TimeseriesResultBuilder bob = new TimeseriesResultBuilder(cursor.getTime());
|
||||||
|
|
||||||
|
for (Aggregator aggregator : aggregators) {
|
||||||
|
bob.addMetric(aggregator);
|
||||||
|
}
|
||||||
|
|
||||||
|
Result<TimeseriesResultValue> retVal = bob.build();
|
||||||
|
return retVal;
|
||||||
}
|
}
|
||||||
|
finally {
|
||||||
TimeseriesResultBuilder bob = new TimeseriesResultBuilder(cursor.getTime());
|
// cleanup
|
||||||
|
for (Aggregator agg : aggregators) {
|
||||||
for (Aggregator aggregator : aggregators) {
|
agg.close();
|
||||||
bob.addMetric(aggregator);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<TimeseriesResultValue> retVal = bob.build();
|
|
||||||
|
|
||||||
// cleanup
|
|
||||||
for (Aggregator agg : aggregators) {
|
|
||||||
agg.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
return retVal;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue