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

The following examples show how to use org.apache.flink.runtime.io.network.NetworkSequenceViewReader#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: PartitionRequestQueue.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
public void close() throws IOException {
	if (ctx != null) {
		ctx.channel().close();
	}

	for (NetworkSequenceViewReader reader : allReaders.values()) {
		reader.notifySubpartitionConsumed();
		reader.releaseAllResources();
		markAsReleased(reader.getReceiverId());
	}
	allReaders.clear();
}
 
Example 2
Source File: PartitionRequestQueue.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
public void userEventTriggered(ChannelHandlerContext ctx, Object msg) throws Exception {
	// The user event triggered event loop callback is used for thread-safe
	// hand over of reader queues and cancelled producers.

	if (msg instanceof NetworkSequenceViewReader) {
		enqueueAvailableReader((NetworkSequenceViewReader) msg);
	} else if (msg.getClass() == InputChannelID.class) {
		// Release partition view that get a cancel request.
		InputChannelID toCancel = (InputChannelID) msg;
		if (released.contains(toCancel)) {
			return;
		}

		// Cancel the request for the input channel
		int size = availableReaders.size();
		for (int i = 0; i < size; i++) {
			NetworkSequenceViewReader reader = pollAvailableReader();
			if (reader.getReceiverId().equals(toCancel)) {
				reader.releaseAllResources();
				markAsReleased(reader.getReceiverId());
			} else {
				registerAvailableReader(reader);
			}
		}

		allReaders.remove(toCancel);
	} else {
		ctx.fireUserEventTriggered(msg);
	}
}
 
Example 3
Source File: PartitionRequestQueue.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
private void releaseAllResources() throws IOException {
	// note: this is only ever executed by one thread: the Netty IO thread!
	for (NetworkSequenceViewReader reader : allReaders.values()) {
		reader.releaseAllResources();
		markAsReleased(reader.getReceiverId());
	}

	availableReaders.clear();
	allReaders.clear();
}
 
Example 4
Source File: PartitionRequestQueue.java    From flink with Apache License 2.0 4 votes vote down vote up
private void releaseViewReader(NetworkSequenceViewReader reader) throws IOException {
	reader.notifySubpartitionConsumed();
	reader.setRegisteredAsAvailable(false);
	reader.releaseAllResources();
}
 
Example 5
Source File: PartitionRequestQueue.java    From flink with Apache License 2.0 4 votes vote down vote up
private void releaseViewReader(NetworkSequenceViewReader reader) throws IOException {
	reader.setRegisteredAsAvailable(false);
	reader.releaseAllResources();
}