本文整理匯總了Java中org.apache.flink.runtime.io.disk.iomanager.IOManager.createBlockChannelReader方法的典型用法代碼示例。如果您正苦於以下問題:Java IOManager.createBlockChannelReader方法的具體用法?Java IOManager.createBlockChannelReader怎麽用?Java IOManager.createBlockChannelReader使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.flink.runtime.io.disk.iomanager.IOManager
的用法示例。
在下文中一共展示了IOManager.createBlockChannelReader方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: ChannelReaderInputViewIterator
import org.apache.flink.runtime.io.disk.iomanager.IOManager; //導入方法依賴的package包/類
public ChannelReaderInputViewIterator(IOManager ioAccess, FileIOChannel.ID channel, LinkedBlockingQueue<MemorySegment> returnQueue,
List<MemorySegment> segments, List<MemorySegment> freeMemTarget, TypeSerializer<E> accessors, int numBlocks)
throws IOException
{
this(ioAccess.createBlockChannelReader(channel, returnQueue), returnQueue,
segments, freeMemTarget, accessors, numBlocks);
}
示例2: SeekableFileChannelInputView
import org.apache.flink.runtime.io.disk.iomanager.IOManager; //導入方法依賴的package包/類
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;
}
}
示例3: testCloseAndDeleteInputView
import org.apache.flink.runtime.io.disk.iomanager.IOManager; //導入方法依賴的package包/類
@Test
public void testCloseAndDeleteInputView() {
final IOManager ioManager = new IOManagerAsync();
try {
MemoryManager memMan = new MemoryManager(4 * 16*1024, 1, 16*1024, MemoryType.HEAP, true);
List<MemorySegment> memory = new ArrayList<MemorySegment>();
memMan.allocatePages(new DummyInvokable(), memory, 4);
FileIOChannel.ID channel = ioManager.createChannel();
// add some test data
try (FileWriter wrt = new FileWriter(channel.getPath())) {
wrt.write("test data");
}
BlockChannelReader<MemorySegment> reader = ioManager.createBlockChannelReader(channel);
FileChannelInputView in = new FileChannelInputView(reader, memMan, memory, 9);
// read just something
in.readInt();
// close for the first time, make sure all memory returns
in.close();
assertTrue(memMan.verifyEmpty());
// close again, should not cause an exception
in.close();
// delete, make sure file is removed
in.closeAndDelete();
assertFalse(new File(channel.getPath()).exists());
}
catch (Exception e) {
e.printStackTrace();
fail(e.getMessage());
}
finally {
ioManager.shutdown();
}
}