Java Code Examples for org.apache.flink.runtime.memory.MemoryManager#release()
The following examples show how to use
org.apache.flink.runtime.memory.MemoryManager#release() .
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: SeekableFileChannelInputView.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
public SeekableFileChannelInputView(IOManager ioManager, FileIOChannel.ID channelId, MemoryManager memManager, List<MemorySegment> memory, int sizeOfLastBlock) throws IOException { super(0); checkNotNull(ioManager); checkNotNull(channelId); checkNotNull(memManager); checkNotNull(memory); this.ioManager = ioManager; this.channelId = channelId; this.memManager = memManager; this.memory = memory; this.sizeOfLastBlock = sizeOfLastBlock; this.segmentSize = memManager.getPageSize(); this.reader = ioManager.createBlockChannelReader(channelId); try { final long channelLength = reader.getSize(); final int blockCount = MathUtils.checkedDownCast(channelLength / segmentSize); this.numBlocksTotal = (channelLength % segmentSize == 0) ? blockCount : blockCount + 1; this.numBlocksRemaining = this.numBlocksTotal; this.numRequestsRemaining = numBlocksRemaining; for (int i = 0; i < memory.size(); i++) { sendReadRequest(memory.get(i)); } advance(); } catch (IOException e) { memManager.release(memory); throw e; } }
Example 2
Source File: FileChannelInputView.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
public FileChannelInputView(BlockChannelReader<MemorySegment> reader, MemoryManager memManager, List<MemorySegment> memory, int sizeOfLastBlock) throws IOException { super(0); checkNotNull(reader); checkNotNull(memManager); checkNotNull(memory); checkArgument(!reader.isClosed()); checkArgument(memory.size() > 0); this.reader = reader; this.memManager = memManager; this.memory = memory; this.sizeOfLastBlock = sizeOfLastBlock; try { final long channelLength = reader.getSize(); final int segmentSize = memManager.getPageSize(); this.numBlocksRemaining = MathUtils.checkedDownCast(channelLength / segmentSize); if (channelLength % segmentSize != 0) { this.numBlocksRemaining++; } this.numRequestsRemaining = numBlocksRemaining; for (int i = 0; i < memory.size(); i++) { sendReadRequest(memory.get(i)); } advance(); } catch (IOException e) { memManager.release(memory); throw e; } }
Example 3
Source File: SeekableFileChannelInputView.java From flink with Apache License 2.0 | 5 votes |
public SeekableFileChannelInputView(IOManager ioManager, FileIOChannel.ID channelId, MemoryManager memManager, List<MemorySegment> memory, int sizeOfLastBlock) throws IOException { super(0); checkNotNull(ioManager); checkNotNull(channelId); checkNotNull(memManager); checkNotNull(memory); this.ioManager = ioManager; this.channelId = channelId; this.memManager = memManager; this.memory = memory; this.sizeOfLastBlock = sizeOfLastBlock; this.segmentSize = memManager.getPageSize(); this.reader = ioManager.createBlockChannelReader(channelId); try { final long channelLength = reader.getSize(); final int blockCount = MathUtils.checkedDownCast(channelLength / segmentSize); this.numBlocksTotal = (channelLength % segmentSize == 0) ? blockCount : blockCount + 1; this.numBlocksRemaining = this.numBlocksTotal; this.numRequestsRemaining = numBlocksRemaining; for (int i = 0; i < memory.size(); i++) { sendReadRequest(memory.get(i)); } advance(); } catch (IOException e) { memManager.release(memory); throw e; } }
Example 4
Source File: FileChannelInputView.java From flink with Apache License 2.0 | 5 votes |
public FileChannelInputView(BlockChannelReader<MemorySegment> reader, MemoryManager memManager, List<MemorySegment> memory, int sizeOfLastBlock) throws IOException { super(0); checkNotNull(reader); checkNotNull(memManager); checkNotNull(memory); checkArgument(!reader.isClosed()); checkArgument(memory.size() > 0); this.reader = reader; this.memManager = memManager; this.memory = memory; this.sizeOfLastBlock = sizeOfLastBlock; try { final long channelLength = reader.getSize(); final int segmentSize = memManager.getPageSize(); this.numBlocksRemaining = MathUtils.checkedDownCast(channelLength / segmentSize); if (channelLength % segmentSize != 0) { this.numBlocksRemaining++; } this.numRequestsRemaining = numBlocksRemaining; for (int i = 0; i < memory.size(); i++) { sendReadRequest(memory.get(i)); } advance(); } catch (IOException e) { memManager.release(memory); throw e; } }
Example 5
Source File: SeekableFileChannelInputView.java From flink with Apache License 2.0 | 5 votes |
public SeekableFileChannelInputView(IOManager ioManager, FileIOChannel.ID channelId, MemoryManager memManager, List<MemorySegment> memory, int sizeOfLastBlock) throws IOException { super(0); checkNotNull(ioManager); checkNotNull(channelId); checkNotNull(memManager); checkNotNull(memory); this.ioManager = ioManager; this.channelId = channelId; this.memManager = memManager; this.memory = memory; this.sizeOfLastBlock = sizeOfLastBlock; this.segmentSize = memManager.getPageSize(); this.reader = ioManager.createBlockChannelReader(channelId); try { final long channelLength = reader.getSize(); final int blockCount = MathUtils.checkedDownCast(channelLength / segmentSize); this.numBlocksTotal = (channelLength % segmentSize == 0) ? blockCount : blockCount + 1; this.numBlocksRemaining = this.numBlocksTotal; this.numRequestsRemaining = numBlocksRemaining; for (int i = 0; i < memory.size(); i++) { sendReadRequest(memory.get(i)); } advance(); } catch (IOException e) { memManager.release(memory); throw e; } }
Example 6
Source File: FileChannelInputView.java From flink with Apache License 2.0 | 5 votes |
public FileChannelInputView(BlockChannelReader<MemorySegment> reader, MemoryManager memManager, List<MemorySegment> memory, int sizeOfLastBlock) throws IOException { super(0); checkNotNull(reader); checkNotNull(memManager); checkNotNull(memory); checkArgument(!reader.isClosed()); checkArgument(memory.size() > 0); this.reader = reader; this.memManager = memManager; this.memory = memory; this.sizeOfLastBlock = sizeOfLastBlock; try { final long channelLength = reader.getSize(); final int segmentSize = memManager.getPageSize(); this.numBlocksRemaining = MathUtils.checkedDownCast(channelLength / segmentSize); if (channelLength % segmentSize != 0) { this.numBlocksRemaining++; } this.numRequestsRemaining = numBlocksRemaining; for (int i = 0; i < memory.size(); i++) { sendReadRequest(memory.get(i)); } advance(); } catch (IOException e) { memManager.release(memory); throw e; } }