@Override public void close() throws IOException { reader.close(); }
@Override public List<MemorySegment> close() throws IOException { reader.close(); return Collections.emptyList(); }
void close() throws IOException { this.reader.close(); this.freeSegments.clear(); } }
@Override public void releaseAllResources() throws IOException { if (isReleased.compareAndSet(false, true)) { // TODO This can block until all buffers are written out to // disk if a spill is in-progress before deleting the file. // It is possibly called from the Netty event loop threads, // which can bring down the network. spillWriter.closeAndDelete(); fileReader.close(); bufferPool.destroy(); } }
@Override public void releaseAllResources() throws IOException { if (isReleased.compareAndSet(false, true)) { // TODO This can block until all buffers are written out to // disk if a spill is in-progress before deleting the file. // It is possibly called from the Netty event loop threads, // which can bring down the network. spillWriter.closeAndDelete(); synchronized (this) { fileReader.close(); if (nextBuffer != null) { nextBuffer.recycleBuffer(); nextBuffer = null; } } bufferPool.destroy(); } }
@Override public void releaseAllResources() throws IOException { if (isReleased.compareAndSet(false, true)) { // TODO This can block until all buffers are written out to // disk if a spill is in-progress before deleting the file. // It is possibly called from the Netty event loop threads, // which can bring down the network. spillWriter.closeAndDelete(); synchronized (this) { fileReader.close(); if (nextBuffer != null) { nextBuffer.recycleBuffer(); nextBuffer = null; } } bufferPool.destroy(); } }
@Override public void releaseAllResources() throws IOException { if (isReleased.compareAndSet(false, true)) { // TODO This can block until all buffers are written out to // disk if a spill is in-progress before deleting the file. // It is possibly called from the Netty event loop threads, // which can bring down the network. spillWriter.closeAndDelete(); synchronized (this) { fileReader.close(); if (nextBuffer != null) { nextBuffer.recycleBuffer(); nextBuffer = null; } } bufferPool.lazyDestroy(); } }
@Override protected MemorySegment nextSegment(MemorySegment current) throws IOException { if (cause.get() != null) { throw cause.get(); } // check for end-of-stream if (this.numBlocksRemaining <= 0) { this.reader.close(); throw new EOFException(); } try { Buffer buffer; while ((buffer = retBuffers.poll(1, TimeUnit.SECONDS)) == null) { if (cause.get() != null) { throw cause.get(); } } this.currentSegmentLimit = decompressor.decompress( buffer.getMemorySegment().getArray(), 0, buffer.getSize(), uncompressedBuffer.getArray(), 0); buffer.recycleBuffer(); this.numBlocksRemaining--; return uncompressedBuffer; } catch (InterruptedException e) { throw new IOException(e); } }