Java Code Examples for org.apache.flink.runtime.io.network.partition.ResultSubpartitionView#releaseAllResources()

The following examples show how to use org.apache.flink.runtime.io.network.partition.ResultSubpartitionView#releaseAllResources() . 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: LocalInputChannelTest.java    From flink with Apache License 2.0 6 votes vote down vote up
/**
 * Tests that reading from a channel when after the partition has been
 * released are handled and don't lead to NPEs.
 */
@Test
public void testGetNextAfterPartitionReleased() throws Exception {
	ResultSubpartitionView subpartitionView = createResultSubpartitionView(false);
	TestingResultPartitionManager partitionManager = new TestingResultPartitionManager(subpartitionView);
	LocalInputChannel channel = createLocalInputChannel(new SingleInputGateBuilder().build(), partitionManager);

	channel.requestSubpartition(0);
	assertFalse(channel.getNextBuffer().isPresent());

	// release the subpartition view
	subpartitionView.releaseAllResources();

	try {
		channel.getNextBuffer();
		fail("Did not throw expected CancelTaskException");
	} catch (CancelTaskException ignored) {
	}

	channel.releaseAllResources();
	assertFalse(channel.getNextBuffer().isPresent());
}
 
Example 2
Source File: LocalInputChannel.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
/**
 * Releases the partition reader.
 */
@Override
void releaseAllResources() throws IOException {
	if (!isReleased) {
		isReleased = true;

		ResultSubpartitionView view = subpartitionView;
		if (view != null) {
			view.releaseAllResources();
			subpartitionView = null;
		}
	}
}
 
Example 3
Source File: LocalInputChannel.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Releases the partition reader.
 */
@Override
void releaseAllResources() throws IOException {
	if (!isReleased) {
		isReleased = true;

		ResultSubpartitionView view = subpartitionView;
		if (view != null) {
			view.releaseAllResources();
			subpartitionView = null;
		}
	}
}
 
Example 4
Source File: LocalInputChannel.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Releases the partition reader.
 */
@Override
void releaseAllResources() throws IOException {
	if (!isReleased) {
		isReleased = true;

		ResultSubpartitionView view = subpartitionView;
		if (view != null) {
			view.releaseAllResources();
			subpartitionView = null;
		}
	}
}