Java Code Examples for org.apache.flink.runtime.io.network.api.writer.ResultPartitionWriter#fail()

The following examples show how to use org.apache.flink.runtime.io.network.api.writer.ResultPartitionWriter#fail() . 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: Task.java    From flink with Apache License 2.0 6 votes vote down vote up
/**
 * Releases resources before task exits. We should also fail the partition to release if the task
 * has failed, is canceled, or is being canceled at the moment.
 */
private void releaseResources() {
	LOG.debug("Release task {} network resources (state: {}).", taskNameWithSubtask, getExecutionState());

	for (ResultPartitionWriter partitionWriter : consumableNotifyingPartitionWriters) {
		taskEventDispatcher.unregisterPartition(partitionWriter.getPartitionId());
		if (isCanceledOrFailed()) {
			partitionWriter.fail(getFailureCause());
		}
	}

	closeNetworkResources();
	try {
		taskStateManager.close();
	} catch (Exception e) {
		LOG.error("Failed to close task state manager for task {}.", taskNameWithSubtask, e);
	}
}
 
Example 2
Source File: Task.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Releases network resources before task exits. We should also fail the partition to release if the task
 * has failed, is canceled, or is being canceled at the moment.
 */
private void releaseNetworkResources() {
	LOG.debug("Release task {} network resources (state: {}).", taskNameWithSubtask, getExecutionState());

	for (ResultPartitionWriter partitionWriter : consumableNotifyingPartitionWriters) {
		taskEventDispatcher.unregisterPartition(partitionWriter.getPartitionId());
		if (isCanceledOrFailed()) {
			partitionWriter.fail(getFailureCause());
		}
	}

	closeNetworkResources();
}