1) Include new version of java-util to fix issue with resources not getting closed when an exception is thrown sometimes

2) Whitespace changes to GroupByQueryEngine
This commit is contained in:
cheddar 2013-08-12 17:57:30 -07:00
parent d739b15380
commit bb18b162ab
2 changed files with 25 additions and 21 deletions

View File

@ -38,7 +38,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<metamx.java-util.version>0.22.6</metamx.java-util.version>
<metamx.java-util.version>0.23.0</metamx.java-util.version>
<apache.curator.version>2.1.0-incubating</apache.curator.version>
</properties>

View File

@ -88,44 +88,48 @@ public class GroupByQueryEngine
final ResourceHolder<ByteBuffer> bufferHolder = intermediateResultsBufferPool.take();
return Sequences.concat(
new BaseSequence<Sequence<Row>, Iterator<Sequence<Row>>>(new BaseSequence.IteratorMaker<Sequence<Row>, Iterator<Sequence<Row>>>()
{
@Override
public Iterator<Sequence<Row>> make()
{
return FunctionalIterator
.create(cursors.iterator())
.transform(new Function<Cursor, Sequence<Row>>()
new BaseSequence<Sequence<Row>, Iterator<Sequence<Row>>>(
new BaseSequence.IteratorMaker<Sequence<Row>, Iterator<Sequence<Row>>>()
{
@Override
public Iterator<Sequence<Row>> make()
{
return FunctionalIterator
.create(cursors.iterator())
.transform(
new Function<Cursor, Sequence<Row>>()
{
@Override
public Sequence<Row> apply(@Nullable final Cursor cursor)
{
return new BaseSequence<Row, CloseableIterator<Row>>(
new BaseSequence.IteratorMaker<Row, CloseableIterator<Row>>()
return new BaseSequence<Row, RowIterator>(
new BaseSequence.IteratorMaker<Row, RowIterator>()
{
@Override
public CloseableIterator<Row> make()
public RowIterator make()
{
return new RowIterator(query, cursor, bufferHolder.get());
}
@Override
public void cleanup(CloseableIterator iterFromMake)
public void cleanup(RowIterator iterFromMake)
{
Closeables.closeQuietly(iterFromMake);
}
}
);
}
});
}
}
);
}
@Override
public void cleanup(Iterator<Sequence<Row>> iterFromMake)
{
Closeables.closeQuietly(bufferHolder);
}
})
@Override
public void cleanup(Iterator<Sequence<Row>> iterFromMake)
{
Closeables.closeQuietly(bufferHolder);
}
}
)
);
}