Java Code Examples for org.apache.flink.runtime.memory.MemoryManager#DEFAULT_PAGE_SIZE
The following examples show how to use
org.apache.flink.runtime.memory.MemoryManager#DEFAULT_PAGE_SIZE .
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: UnilateralSortMergerTest.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
@Test public void testInMemorySorterDisposal() throws Exception { final TestingInMemorySorterFactory<Tuple2<Integer, Integer>> inMemorySorterFactory = new TestingInMemorySorterFactory<>(); final int numPages = 32; final MemoryManager memoryManager = new MemoryManager(MemoryManager.DEFAULT_PAGE_SIZE * numPages, 1); final IOManagerAsync ioManager = new IOManagerAsync(); final DummyInvokable parentTask = new DummyInvokable(); try { final List<MemorySegment> memory = memoryManager.allocatePages(parentTask, numPages); final UnilateralSortMerger<Tuple2<Integer, Integer>> unilateralSortMerger = new UnilateralSortMerger<>( memoryManager, memory, ioManager, EmptyMutableObjectIterator.get(), parentTask, TestData.getIntIntTupleSerializerFactory(), TestData.getIntIntTupleComparator(), 10, 2, 1.0f, true, false, false, inMemorySorterFactory); final Collection<TestingInMemorySorter<?>> inMemorySorters = inMemorySorterFactory.getInMemorySorters(); assertThat(inMemorySorters, is(not(empty()))); unilateralSortMerger.close(); assertThat(unilateralSortMerger.closed, is(true)); for (TestingInMemorySorter<?> inMemorySorter : inMemorySorters) { assertThat(inMemorySorter.isDisposed(), is(true)); } } finally { ioManager.shutdown(); memoryManager.shutdown(); } }
Example 2
Source File: UnilateralSortMergerTest.java From flink with Apache License 2.0 | 4 votes |
@Test public void testInMemorySorterDisposal() throws Exception { final TestingInMemorySorterFactory<Tuple2<Integer, Integer>> inMemorySorterFactory = new TestingInMemorySorterFactory<>(); final int numPages = 32; final MemoryManager memoryManager = new MemoryManager(MemoryManager.DEFAULT_PAGE_SIZE * numPages, 1); final DummyInvokable parentTask = new DummyInvokable(); try (final IOManagerAsync ioManager = new IOManagerAsync()) { final List<MemorySegment> memory = memoryManager.allocatePages(parentTask, numPages); final UnilateralSortMerger<Tuple2<Integer, Integer>> unilateralSortMerger = new UnilateralSortMerger<>( memoryManager, memory, ioManager, EmptyMutableObjectIterator.get(), parentTask, TestData.getIntIntTupleSerializerFactory(), TestData.getIntIntTupleComparator(), 10, 2, 1.0f, true, false, false, inMemorySorterFactory); final Collection<TestingInMemorySorter<?>> inMemorySorters = inMemorySorterFactory.getInMemorySorters(); assertThat(inMemorySorters, is(not(empty()))); unilateralSortMerger.close(); assertThat(unilateralSortMerger.closed, is(true)); for (TestingInMemorySorter<?> inMemorySorter : inMemorySorters) { assertThat(inMemorySorter.isDisposed(), is(true)); } } finally { memoryManager.shutdown(); } }