org.apache.flink.runtime.iterative.concurrent.BlockingBackChannel Java Examples

The following examples show how to use org.apache.flink.runtime.iterative.concurrent.BlockingBackChannel. 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: IterationHeadTask.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
/**
 * The iteration head prepares the backchannel: it allocates memory, instantiates a {@link BlockingBackChannel} and
 * hands it to the iteration tail via a {@link Broker} singleton.
 **/
private BlockingBackChannel initBackChannel() throws Exception {

	/* get the size of the memory available to the backchannel */
	int backChannelMemoryPages = getMemoryManager().computeNumberOfPages(this.config.getRelativeBackChannelMemory());

	/* allocate the memory available to the backchannel */
	List<MemorySegment> segments = new ArrayList<MemorySegment>();
	int segmentSize = getMemoryManager().getPageSize();
	getMemoryManager().allocatePages(this, segments, backChannelMemoryPages);

	/* instantiate the backchannel */
	BlockingBackChannel backChannel = new BlockingBackChannel(new SerializedUpdateBuffer(segments, segmentSize,
		getIOManager()));

	/* hand the backchannel over to the iteration tail */
	Broker<BlockingBackChannel> broker = BlockingBackChannelBroker.instance();
	broker.handIn(brokerKey(), backChannel);

	return backChannel;
}
 
Example #2
Source File: IterationHeadTask.java    From flink with Apache License 2.0 6 votes vote down vote up
/**
 * The iteration head prepares the backchannel: it allocates memory, instantiates a {@link BlockingBackChannel} and
 * hands it to the iteration tail via a {@link Broker} singleton.
 **/
private BlockingBackChannel initBackChannel() throws Exception {

	/* get the size of the memory available to the backchannel */
	int backChannelMemoryPages = getMemoryManager().computeNumberOfPages(this.config.getRelativeBackChannelMemory());

	/* allocate the memory available to the backchannel */
	List<MemorySegment> segments = new ArrayList<MemorySegment>();
	int segmentSize = getMemoryManager().getPageSize();
	getMemoryManager().allocatePages(this, segments, backChannelMemoryPages);

	/* instantiate the backchannel */
	BlockingBackChannel backChannel = new BlockingBackChannel(new SerializedUpdateBuffer(segments, segmentSize,
		getIOManager()));

	/* hand the backchannel over to the iteration tail */
	Broker<BlockingBackChannel> broker = BlockingBackChannelBroker.instance();
	broker.handIn(brokerKey(), backChannel);

	return backChannel;
}
 
Example #3
Source File: IterationHeadTask.java    From flink with Apache License 2.0 6 votes vote down vote up
/**
 * The iteration head prepares the backchannel: it allocates memory, instantiates a {@link BlockingBackChannel} and
 * hands it to the iteration tail via a {@link Broker} singleton.
 **/
private BlockingBackChannel initBackChannel() throws Exception {

	/* get the size of the memory available to the backchannel */
	int backChannelMemoryPages = getMemoryManager().computeNumberOfPages(this.config.getRelativeBackChannelMemory());

	/* allocate the memory available to the backchannel */
	List<MemorySegment> segments = new ArrayList<MemorySegment>();
	int segmentSize = getMemoryManager().getPageSize();
	getMemoryManager().allocatePages(this, segments, backChannelMemoryPages);

	/* instantiate the backchannel */
	BlockingBackChannel backChannel = new BlockingBackChannel(new SerializedUpdateBuffer(segments, segmentSize,
		getIOManager()));

	/* hand the backchannel over to the iteration tail */
	Broker<BlockingBackChannel> broker = BlockingBackChannelBroker.instance();
	broker.handIn(brokerKey(), backChannel);

	return backChannel;
}