Java Code Examples for org.apache.flink.runtime.io.disk.iomanager.BlockChannelReader#closeAndDelete()
The following examples show how to use
org.apache.flink.runtime.io.disk.iomanager.BlockChannelReader#closeAndDelete() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BaseHybridHashTable.java From flink with Apache License 2.0 | 6 votes |
protected List<MemorySegment> readAllBuffers(FileIOChannel.ID id, int blockCount) throws IOException { // we are guaranteed to stay in memory ensureNumBuffersReturned(blockCount); LinkedBlockingQueue<MemorySegment> retSegments = new LinkedBlockingQueue<>(); BlockChannelReader<MemorySegment> reader = FileChannelUtil.createBlockChannelReader( ioManager, id, retSegments, compressionEnable, compressionCodecFactory, compressionBlockSize, segmentSize); for (int i = 0; i < blockCount; i++) { reader.readBlock(availableMemory.remove(availableMemory.size() - 1)); } reader.closeAndDelete(); final List<MemorySegment> buffers = new ArrayList<>(); retSegments.drainTo(buffers); return buffers; }
Example 2
Source File: BaseHybridHashTable.java From flink with Apache License 2.0 | 6 votes |
protected List<MemorySegment> readAllBuffers(FileIOChannel.ID id, int blockCount) throws IOException { // we are guaranteed to stay in memory ensureNumBuffersReturned(blockCount); LinkedBlockingQueue<MemorySegment> retSegments = new LinkedBlockingQueue<>(); BlockChannelReader<MemorySegment> reader = FileChannelUtil.createBlockChannelReader( ioManager, id, retSegments, compressionEnable, compressionCodecFactory, compressionBlockSize, segmentSize); for (int i = 0; i < blockCount; i++) { reader.readBlock(internalPool.nextSegment()); } reader.closeAndDelete(); final List<MemorySegment> buffers = new ArrayList<>(); retSegments.drainTo(buffers); return buffers; }