Java Code Examples for org.apache.flink.runtime.memory.MemoryManager#shutdown()
The following examples show how to use
org.apache.flink.runtime.memory.MemoryManager#shutdown() .
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: DriverTestBase.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
@After public void shutdownAll() throws Exception { // 1st, shutdown sorters for (UnilateralSortMerger<?> sorter : this.sorters) { if (sorter != null) { sorter.close(); } } this.sorters.clear(); // 2nd, shutdown I/O this.ioManager.shutdown(); Assert.assertTrue("I/O Manager has not properly shut down.", this.ioManager.isProperlyShutDown()); // last, verify all memory is returned and shutdown mem manager MemoryManager memMan = getMemoryManager(); if (memMan != null) { Assert.assertTrue("Memory Manager managed memory was not completely freed.", memMan.verifyEmpty()); memMan.shutdown(); } }
Example 2
Source File: UnaryOperatorTestBase.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
@After public void shutdownAll() throws Exception { // 1st, shutdown sorters if (this.sorter != null) { sorter.close(); } // 2nd, shutdown I/O this.ioManager.shutdown(); Assert.assertTrue("I/O Manager has not properly shut down.", this.ioManager.isProperlyShutDown()); // last, verify all memory is returned and shutdown mem manager MemoryManager memMan = getMemoryManager(); if (memMan != null) { Assert.assertTrue("Memory Manager managed memory was not completely freed.", memMan.verifyEmpty()); memMan.shutdown(); } }
Example 3
Source File: BinaryOperatorTestBase.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
@After public void shutdownAll() throws Exception { // 1st, shutdown sorters for (UnilateralSortMerger<?> sorter : this.sorters) { if (sorter != null) { sorter.close(); } } this.sorters.clear(); // 2nd, shutdown I/O this.ioManager.shutdown(); Assert.assertTrue("I/O Manager has not properly shut down.", this.ioManager.isProperlyShutDown()); // last, verify all memory is returned and shutdown mem manager MemoryManager memMan = getMemoryManager(); if (memMan != null) { Assert.assertTrue("Memory Manager managed memory was not completely freed.", memMan.verifyEmpty()); memMan.shutdown(); } }
Example 4
Source File: DriverTestBase.java From flink with Apache License 2.0 | 6 votes |
@After public void shutdownAll() throws Exception { // 1st, shutdown sorters for (UnilateralSortMerger<?> sorter : this.sorters) { if (sorter != null) { sorter.close(); } } this.sorters.clear(); // 2nd, shutdown I/O this.ioManager.close(); // last, verify all memory is returned and shutdown mem manager MemoryManager memMan = getMemoryManager(); if (memMan != null) { Assert.assertTrue("Memory Manager managed memory was not completely freed.", memMan.verifyEmpty()); memMan.shutdown(); } }
Example 5
Source File: UnaryOperatorTestBase.java From flink with Apache License 2.0 | 6 votes |
@After public void shutdownAll() throws Exception { // 1st, shutdown sorters if (this.sorter != null) { sorter.close(); } // 2nd, shutdown I/O this.ioManager.close(); // last, verify all memory is returned and shutdown mem manager MemoryManager memMan = getMemoryManager(); if (memMan != null) { Assert.assertTrue("Memory Manager managed memory was not completely freed.", memMan.verifyEmpty()); memMan.shutdown(); } }
Example 6
Source File: BinaryOperatorTestBase.java From flink with Apache License 2.0 | 6 votes |
@After public void shutdownAll() throws Exception { // 1st, shutdown sorters for (UnilateralSortMerger<?> sorter : this.sorters) { if (sorter != null) { sorter.close(); } } this.sorters.clear(); // 2nd, shutdown I/O this.ioManager.close(); // last, verify all memory is returned and shutdown mem manager MemoryManager memMan = getMemoryManager(); if (memMan != null) { Assert.assertTrue("Memory Manager managed memory was not completely freed.", memMan.verifyEmpty()); memMan.shutdown(); } }
Example 7
Source File: DriverTestBase.java From flink with Apache License 2.0 | 6 votes |
@After public void shutdownAll() throws Exception { // 1st, shutdown sorters for (UnilateralSortMerger<?> sorter : this.sorters) { if (sorter != null) { sorter.close(); } } this.sorters.clear(); // 2nd, shutdown I/O this.ioManager.close(); // last, verify all memory is returned and shutdown mem manager MemoryManager memMan = getMemoryManager(); if (memMan != null) { Assert.assertTrue("Memory Manager managed memory was not completely freed.", memMan.verifyEmpty()); memMan.shutdown(); } }
Example 8
Source File: UnaryOperatorTestBase.java From flink with Apache License 2.0 | 6 votes |
@After public void shutdownAll() throws Exception { // 1st, shutdown sorters if (this.sorter != null) { sorter.close(); } // 2nd, shutdown I/O this.ioManager.close(); // last, verify all memory is returned and shutdown mem manager MemoryManager memMan = getMemoryManager(); if (memMan != null) { Assert.assertTrue("Memory Manager managed memory was not completely freed.", memMan.verifyEmpty()); memMan.shutdown(); } }
Example 9
Source File: BinaryOperatorTestBase.java From flink with Apache License 2.0 | 6 votes |
@After public void shutdownAll() throws Exception { // 1st, shutdown sorters for (UnilateralSortMerger<?> sorter : this.sorters) { if (sorter != null) { sorter.close(); } } this.sorters.clear(); // 2nd, shutdown I/O this.ioManager.close(); // last, verify all memory is returned and shutdown mem manager MemoryManager memMan = getMemoryManager(); if (memMan != null) { Assert.assertTrue("Memory Manager managed memory was not completely freed.", memMan.verifyEmpty()); memMan.shutdown(); } }
Example 10
Source File: StreamTaskTestHarness.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
private void shutdownMemoryManager() throws Exception { if (this.memorySize > 0) { MemoryManager memMan = this.mockEnv.getMemoryManager(); if (memMan != null) { Assert.assertTrue("Memory Manager managed memory was not completely freed.", memMan.verifyEmpty()); memMan.shutdown(); } } }
Example 11
Source File: StreamTaskTestHarness.java From flink with Apache License 2.0 | 5 votes |
private void shutdownMemoryManager() throws Exception { if (this.memorySize > 0) { MemoryManager memMan = this.mockEnv.getMemoryManager(); if (memMan != null) { Assert.assertTrue("Memory Manager managed memory was not completely freed.", memMan.verifyEmpty()); memMan.shutdown(); } } }
Example 12
Source File: StreamTaskTestHarness.java From flink with Apache License 2.0 | 5 votes |
private void shutdownMemoryManager() { if (this.memorySize > 0) { MemoryManager memMan = this.mockEnv.getMemoryManager(); if (memMan != null) { Assert.assertTrue("Memory Manager managed memory was not completely freed.", memMan.verifyEmpty()); memMan.shutdown(); } } }
Example 13
Source File: StreamTaskMailboxTestHarness.java From flink with Apache License 2.0 | 5 votes |
@Override public void close() throws Exception { streamTask.cancel(); streamTask.afterInvoke(); streamTask.cleanUpInvoke(); streamMockEnvironment.getIOManager().close(); MemoryManager memMan = this.streamMockEnvironment.getMemoryManager(); if (memMan != null) { assertTrue("Memory Manager managed memory was not completely freed.", memMan.verifyEmpty()); memMan.shutdown(); } }
Example 14
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 15
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(); } }
Example 16
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 = MemoryManagerBuilder .newBuilder() .setMemorySize(MemoryManager.DEFAULT_PAGE_SIZE * numPages) .build(); 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(); } }