當前位置: 首頁>>代碼示例>>Java>>正文


Java IOManager類代碼示例

本文整理匯總了Java中org.apache.flink.runtime.io.disk.iomanager.IOManager的典型用法代碼示例。如果您正苦於以下問題:Java IOManager類的具體用法?Java IOManager怎麽用?Java IOManager使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


IOManager類屬於org.apache.flink.runtime.io.disk.iomanager包,在下文中一共展示了IOManager類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getMockEnvironment

import org.apache.flink.runtime.io.disk.iomanager.IOManager; //導入依賴的package包/類
static Environment getMockEnvironment(File[] tempDirs) {
	final String[] tempDirStrings = new String[tempDirs.length];
	for (int i = 0; i < tempDirs.length; i++) {
		tempDirStrings[i] = tempDirs[i].getAbsolutePath();
	}

	IOManager ioMan = mock(IOManager.class);
	when(ioMan.getSpillingDirectories()).thenReturn(tempDirs);

	Environment env = mock(Environment.class);
	when(env.getJobID()).thenReturn(new JobID());
	when(env.getUserClassLoader()).thenReturn(RocksDBStateBackendConfigTest.class.getClassLoader());
	when(env.getIOManager()).thenReturn(ioMan);
	when(env.getTaskKvStateRegistry()).thenReturn(new KvStateRegistry().createTaskRegistry(new JobID(), new JobVertexID()));

	TaskInfo taskInfo = mock(TaskInfo.class);
	when(env.getTaskInfo()).thenReturn(taskInfo);
	when(taskInfo.getIndexOfThisSubtask()).thenReturn(0);

	TaskManagerRuntimeInfo tmInfo = new TestingTaskManagerRuntimeInfo(new Configuration(), tempDirStrings);
	when(env.getTaskManagerInfo()).thenReturn(tmInfo);

	return env;
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:25,代碼來源:RocksDBStateBackendConfigTest.java

示例2: TaskManagerServices

import org.apache.flink.runtime.io.disk.iomanager.IOManager; //導入依賴的package包/類
private TaskManagerServices(
	TaskManagerLocation taskManagerLocation,
	MemoryManager memoryManager,
	IOManager ioManager,
	NetworkEnvironment networkEnvironment,
	BroadcastVariableManager broadcastVariableManager,
	FileCache fileCache,
	TaskSlotTable taskSlotTable,
	JobManagerTable jobManagerTable,
	JobLeaderService jobLeaderService) {

	this.taskManagerLocation = Preconditions.checkNotNull(taskManagerLocation);
	this.memoryManager = Preconditions.checkNotNull(memoryManager);
	this.ioManager = Preconditions.checkNotNull(ioManager);
	this.networkEnvironment = Preconditions.checkNotNull(networkEnvironment);
	this.broadcastVariableManager = Preconditions.checkNotNull(broadcastVariableManager);
	this.fileCache = Preconditions.checkNotNull(fileCache);
	this.taskSlotTable = Preconditions.checkNotNull(taskSlotTable);
	this.jobManagerTable = Preconditions.checkNotNull(jobManagerTable);
	this.jobLeaderService = Preconditions.checkNotNull(jobLeaderService);
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:22,代碼來源:TaskManagerServices.java

示例3: SpillingResettableMutableObjectIterator

import org.apache.flink.runtime.io.disk.iomanager.IOManager; //導入依賴的package包/類
private SpillingResettableMutableObjectIterator(MutableObjectIterator<T> input, TypeSerializer<T> serializer,
		MemoryManager memoryManager, IOManager ioManager,
		List<MemorySegment> memory, boolean releaseMemOnClose)
{
	this.memoryManager = memoryManager;
	this.input = input;
	this.serializer = serializer;
	this.memorySegments = memory;
	this.releaseMemoryOnClose = releaseMemOnClose;
	
	if (LOG.isDebugEnabled()) {
		LOG.debug("Creating spilling resettable iterator with " + memory.size() + " pages of memory.");
	}
	
	this.buffer = new SpillingBuffer(ioManager, new ListMemorySegmentSource(memory), memoryManager.getPageSize());
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:17,代碼來源:SpillingResettableMutableObjectIterator.java

示例4: SpillingResettableIterator

import org.apache.flink.runtime.io.disk.iomanager.IOManager; //導入依賴的package包/類
private SpillingResettableIterator(Iterator<T> input, TypeSerializer<T> serializer,
		MemoryManager memoryManager, IOManager ioManager,
		List<MemorySegment> memory, boolean releaseMemOnClose)
{
	this.memoryManager = memoryManager;
	this.input = input;
	this.instance = serializer.createInstance();
	this.serializer = serializer;
	this.memorySegments = memory;
	this.releaseMemoryOnClose = releaseMemOnClose;
	
	if (LOG.isDebugEnabled()) {
		LOG.debug("Creating spilling resettable iterator with " + memory.size() + " pages of memory.");
	}
	
	this.buffer = new SpillingBuffer(ioManager, new ListMemorySegmentSource(memory), memoryManager.getPageSize());
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:18,代碼來源:SpillingResettableIterator.java

示例5: NonReusingBuildSecondReOpenableHashJoinIterator

import org.apache.flink.runtime.io.disk.iomanager.IOManager; //導入依賴的package包/類
public NonReusingBuildSecondReOpenableHashJoinIterator(
		MutableObjectIterator<V1> firstInput,
		MutableObjectIterator<V2> secondInput,
		TypeSerializer<V1> serializer1,
		TypeComparator<V1> comparator1,
		TypeSerializer<V2> serializer2,
		TypeComparator<V2> comparator2,
		TypePairComparator<V1, V2> pairComparator,
		MemoryManager memManager,
		IOManager ioManager,
		AbstractInvokable ownerTask,
		double memoryFraction,
		boolean probeSideOuterJoin,
		boolean buildSideOuterJoin,
		boolean useBitmapFilters) throws MemoryAllocationException {
	
	super(firstInput, secondInput, serializer1, comparator1, serializer2,
			comparator2, pairComparator, memManager, ioManager, ownerTask,
			memoryFraction, probeSideOuterJoin, buildSideOuterJoin, useBitmapFilters);
	
	reopenHashTable = (ReOpenableMutableHashTable<V2, V1>) hashJoin;
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:23,代碼來源:NonReusingBuildSecondReOpenableHashJoinIterator.java

示例6: getHashJoin

import org.apache.flink.runtime.io.disk.iomanager.IOManager; //導入依賴的package包/類
@Override
public <BT, PT> MutableHashTable<BT, PT> getHashJoin(
		TypeSerializer<BT> buildSideSerializer,
		TypeComparator<BT> buildSideComparator,
		TypeSerializer<PT> probeSideSerializer, TypeComparator<PT> probeSideComparator,
		TypePairComparator<PT, BT> pairComparator,
		MemoryManager memManager, IOManager ioManager,
		AbstractInvokable ownerTask,
		double memoryFraction,
		boolean useBitmapFilters) throws MemoryAllocationException {
	
	final int numPages = memManager.computeNumberOfPages(memoryFraction);
	final List<MemorySegment> memorySegments = memManager.allocatePages(ownerTask, numPages);
	
	return new ReOpenableMutableHashTable<BT, PT>(buildSideSerializer, probeSideSerializer,
			buildSideComparator, probeSideComparator, pairComparator,
			memorySegments, ioManager, useBitmapFilters);
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:19,代碼來源:NonReusingBuildSecondReOpenableHashJoinIterator.java

示例7: ReusingBuildFirstReOpenableHashJoinIterator

import org.apache.flink.runtime.io.disk.iomanager.IOManager; //導入依賴的package包/類
public ReusingBuildFirstReOpenableHashJoinIterator(
		MutableObjectIterator<V1> firstInput,
		MutableObjectIterator<V2> secondInput,
		TypeSerializer<V1> serializer1,
		TypeComparator<V1> comparator1,
		TypeSerializer<V2> serializer2,
		TypeComparator<V2> comparator2,
		TypePairComparator<V2, V1> pairComparator,
		MemoryManager memManager,
		IOManager ioManager,
		AbstractInvokable ownerTask,
		double memoryFraction,
		boolean probeSideOuterJoin,
		boolean buildSideOuterJoin,
		boolean useBitmapFilters)
	throws MemoryAllocationException
{
	super(firstInput, secondInput, serializer1, comparator1, serializer2,
			comparator2, pairComparator, memManager, ioManager, ownerTask,
			memoryFraction, probeSideOuterJoin, buildSideOuterJoin, useBitmapFilters);
	reopenHashTable = (ReOpenableMutableHashTable<V1, V2>) hashJoin;
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:23,代碼來源:ReusingBuildFirstReOpenableHashJoinIterator.java

示例8: getHashJoin

import org.apache.flink.runtime.io.disk.iomanager.IOManager; //導入依賴的package包/類
@Override
public <BT, PT> MutableHashTable<BT, PT> getHashJoin(
		TypeSerializer<BT> buildSideSerializer, TypeComparator<BT> buildSideComparator,
		TypeSerializer<PT> probeSideSerializer, TypeComparator<PT> probeSideComparator,
		TypePairComparator<PT, BT> pairComparator,
		MemoryManager memManager, IOManager ioManager,
		AbstractInvokable ownerTask,
		double memoryFraction,
		boolean useBitmapFilters) throws MemoryAllocationException {
	
	final int numPages = memManager.computeNumberOfPages(memoryFraction);
	final List<MemorySegment> memorySegments = memManager.allocatePages(ownerTask, numPages);
	
	return new ReOpenableMutableHashTable<BT, PT>(buildSideSerializer, probeSideSerializer,
			buildSideComparator, probeSideComparator, pairComparator,
			memorySegments, ioManager, useBitmapFilters);
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:18,代碼來源:ReusingBuildFirstReOpenableHashJoinIterator.java

示例9: getHashJoin

import org.apache.flink.runtime.io.disk.iomanager.IOManager; //導入依賴的package包/類
public <BT, PT> MutableHashTable<BT, PT> getHashJoin(
		TypeSerializer<BT> buildSideSerializer,
		TypeComparator<BT> buildSideComparator,
		TypeSerializer<PT> probeSideSerializer,
		TypeComparator<PT> probeSideComparator,
		TypePairComparator<PT, BT> pairComparator,
		MemoryManager memManager,
		IOManager ioManager,
		AbstractInvokable ownerTask,
		double memoryFraction,
		boolean useBloomFilters) throws MemoryAllocationException {

	final int numPages = memManager.computeNumberOfPages(memoryFraction);
	final List<MemorySegment> memorySegments = memManager.allocatePages(ownerTask, numPages);
	
	return new MutableHashTable<BT, PT>(buildSideSerializer, probeSideSerializer,
			buildSideComparator, probeSideComparator, pairComparator,
			memorySegments, ioManager,
			useBloomFilters);
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:21,代碼來源:HashJoinIteratorBase.java

示例10: spillInMemoryPartition

import org.apache.flink.runtime.io.disk.iomanager.IOManager; //導入依賴的package包/類
/**
 * Spills this partition to disk. This method is invoked once after the initial open() method
 * 
 * @return Number of memorySegments in the writeBehindBuffers!
 */
int spillInMemoryPartition(FileIOChannel.ID targetChannel, IOManager ioManager, LinkedBlockingQueue<MemorySegment> writeBehindBuffers) throws IOException {
	this.initialPartitionBuffersCount = partitionBuffers.length; // for ReOpenableHashMap
	this.initialBuildSideChannel = targetChannel;
	
	initialBuildSideWriter = ioManager.createBlockChannelWriter(targetChannel, writeBehindBuffers);
	
	final int numSegments = this.partitionBuffers.length;
	for (int i = 0; i < numSegments; i++) {
		initialBuildSideWriter.writeBlock(partitionBuffers[i]);
	}
	this.partitionBuffers = null;
	initialBuildSideWriter.close();
	// num partitions are now in the writeBehindBuffers. We propagate this information back
	return numSegments;
	
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:22,代碼來源:ReOpenableHashPartition.java

示例11: finalizeBuildPhase

import org.apache.flink.runtime.io.disk.iomanager.IOManager; //導入依賴的package包/類
public void finalizeBuildPhase(IOManager ioAccess, FileIOChannel.Enumerator probeChannelEnumerator,
		LinkedBlockingQueue<MemorySegment> bufferReturnQueue)
throws IOException
{
	this.finalBufferLimit = this.buildSideWriteBuffer.getCurrentPositionInSegment();
	this.partitionBuffers = this.buildSideWriteBuffer.close();
	
	if (!isInMemory()) {
		// close the channel. note that in the spilled case, the build-side-buffer will have sent off
		// the last segment and it will be returned to the write-behind-buffer queue.
		this.buildSideChannel.close();
		
		// create the channel for the probe side and claim one buffer for it
		this.probeSideChannel = ioAccess.createBlockChannelWriter(probeChannelEnumerator.next(), bufferReturnQueue);
		// creating the ChannelWriterOutputView without memory will cause it to draw one segment from the
		// write behind queue, which is the spare segment we had above.
		this.probeSideBuffer = new ChannelWriterOutputView(this.probeSideChannel, this.memorySegmentSize);
	}
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:20,代碼來源:HashPartition.java

示例12: LargeRecordHandler

import org.apache.flink.runtime.io.disk.iomanager.IOManager; //導入依賴的package包/類
public LargeRecordHandler(TypeSerializer<T> serializer, TypeComparator<T> comparator, 
		IOManager ioManager, MemoryManager memManager, List<MemorySegment> memory,
		AbstractInvokable memoryOwner, int maxFilehandles)
{
	this.serializer = checkNotNull(serializer);
	this.comparator = checkNotNull(comparator);
	this.ioManager = checkNotNull(ioManager);
	this.memManager = checkNotNull(memManager);
	this.memory = checkNotNull(memory);
	this.memoryOwner = checkNotNull(memoryOwner);
	this.maxFilehandles = maxFilehandles;

	this.executionConfig = memoryOwner.getExecutionConfig();

	checkArgument(maxFilehandles >= 2);
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:17,代碼來源:LargeRecordHandler.java

示例13: AbstractMergeOuterJoinIterator

import org.apache.flink.runtime.io.disk.iomanager.IOManager; //導入依賴的package包/類
public AbstractMergeOuterJoinIterator(
		OuterJoinType outerJoinType,
		MutableObjectIterator<T1> input1,
		MutableObjectIterator<T2> input2,
		TypeSerializer<T1> serializer1, TypeComparator<T1> comparator1,
		TypeSerializer<T2> serializer2, TypeComparator<T2> comparator2,
		TypePairComparator<T1, T2> pairComparator,
		MemoryManager memoryManager,
		IOManager ioManager,
		int numMemoryPages,
		AbstractInvokable parentTask)
		throws MemoryAllocationException {
	super(input1, input2, serializer1, comparator1, serializer2, comparator2, pairComparator, memoryManager, ioManager, numMemoryPages, parentTask);

	this.outerJoinType = outerJoinType;
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:17,代碼來源:AbstractMergeOuterJoinIterator.java

示例14: ReusingMergeOuterJoinIterator

import org.apache.flink.runtime.io.disk.iomanager.IOManager; //導入依賴的package包/類
public ReusingMergeOuterJoinIterator(
		OuterJoinType outerJoinType,
		MutableObjectIterator<T1> input1,
		MutableObjectIterator<T2> input2,
		TypeSerializer<T1> serializer1, TypeComparator<T1> comparator1,
		TypeSerializer<T2> serializer2, TypeComparator<T2> comparator2,
		TypePairComparator<T1, T2> pairComparator,
		MemoryManager memoryManager,
		IOManager ioManager,
		int numMemoryPages,
		AbstractInvokable parentTask)
		throws MemoryAllocationException {
	super(outerJoinType, input1, input2, serializer1, comparator1, serializer2, comparator2, pairComparator, memoryManager, ioManager, numMemoryPages, parentTask);

	this.copy1 = serializer1.createInstance();
	this.spillHeadCopy = serializer1.createInstance();
	this.copy2 = serializer2.createInstance();
	this.blockHeadCopy = serializer2.createInstance();
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:20,代碼來源:ReusingMergeOuterJoinIterator.java

示例15: testAddOnSpilledPartitionWithFailingWriter

import org.apache.flink.runtime.io.disk.iomanager.IOManager; //導入依賴的package包/類
/**
 * Tests {@link SpillableSubpartition#add(Buffer)} with a spilled partition where adding the
 * write request fails with an exception.
 */
@Test
public void testAddOnSpilledPartitionWithFailingWriter() throws Exception {
	IOManager ioManager = new IOManagerAsyncWithClosedBufferFileWriter();
	SpillableSubpartition partition = createSubpartition(ioManager);
	assertEquals(0, partition.releaseMemory());

	exception.expect(IOException.class);

	Buffer buffer = TestBufferFactory.createBuffer(4096, 4096);
	boolean bufferRecycled;
	try {
		partition.add(buffer);
	} finally {
		ioManager.shutdown();
		bufferRecycled = buffer.isRecycled();
		if (!bufferRecycled) {
			buffer.recycleBuffer();
		}
	}
	if (!bufferRecycled) {
		Assert.fail("buffer not recycled");
	}
	assertEquals(0, partition.getTotalNumberOfBuffers());
	assertEquals(0, partition.getTotalNumberOfBytes());
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:30,代碼來源:SpillableSubpartitionTest.java


注:本文中的org.apache.flink.runtime.io.disk.iomanager.IOManager類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。