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> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <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> <apache.curator.version>2.1.0-incubating</apache.curator.version>
</properties> </properties>

View File

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