Java Code Examples for org.apache.flink.streaming.api.operators.StreamOperator#dispose()

The following examples show how to use org.apache.flink.streaming.api.operators.StreamOperator#dispose() . 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: StreamTask.java    From flink with Apache License 2.0 6 votes vote down vote up
/**
 * Execute @link StreamOperator#dispose()} of each operator in the chain of this
 * {@link StreamTask}. Disposing happens from <b>tail to head</b> operator in the chain.
 */
private void disposeAllOperators() throws Exception {
	if (operatorChain != null && !disposedOperators) {
		Exception disposalException = null;
		for (StreamOperatorWrapper<?, ?> operatorWrapper : operatorChain.getAllOperators(true)) {
			StreamOperator<?> operator = operatorWrapper.getStreamOperator();
			try {
				operator.dispose();
			}
			catch (Exception e) {
				disposalException = ExceptionUtils.firstOrSuppressed(e, disposalException);
			}
		}
		disposedOperators = true;
		if (disposalException != null) {
			throw disposalException;
		}
	}
}
 
Example 2
Source File: StreamTask.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
/**
 * Execute {@link StreamOperator#dispose()} of each operator in the chain of this
 * {@link StreamTask}. Disposing happens from <b>tail to head</b> operator in the chain.
 */
private void tryDisposeAllOperators() throws Exception {
	for (StreamOperator<?> operator : operatorChain.getAllOperators()) {
		if (operator != null) {
			operator.dispose();
		}
	}
}
 
Example 3
Source File: StreamTask.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
/**
 * Execute @link StreamOperator#dispose()} of each operator in the chain of this
 * {@link StreamTask}. Disposing happens from <b>tail to head</b> operator in the chain.
 *
 * <p>The difference with the {@link #tryDisposeAllOperators()} is that in case of an
 * exception, this method catches it and logs the message.
 */
private void disposeAllOperators() {
	if (operatorChain != null) {
		for (StreamOperator<?> operator : operatorChain.getAllOperators()) {
			try {
				if (operator != null) {
					operator.dispose();
				}
			}
			catch (Throwable t) {
				LOG.error("Error during disposal of stream operator.", t);
			}
		}
	}
}
 
Example 4
Source File: StreamTask.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Execute {@link StreamOperator#dispose()} of each operator in the chain of this
 * {@link StreamTask}. Disposing happens from <b>tail to head</b> operator in the chain.
 */
private void tryDisposeAllOperators() throws Exception {
	for (StreamOperator<?> operator : operatorChain.getAllOperators()) {
		if (operator != null) {
			operator.dispose();
		}
	}
}
 
Example 5
Source File: StreamTask.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Execute @link StreamOperator#dispose()} of each operator in the chain of this
 * {@link StreamTask}. Disposing happens from <b>tail to head</b> operator in the chain.
 *
 * <p>The difference with the {@link #tryDisposeAllOperators()} is that in case of an
 * exception, this method catches it and logs the message.
 */
private void disposeAllOperators() {
	if (operatorChain != null) {
		for (StreamOperator<?> operator : operatorChain.getAllOperators()) {
			try {
				if (operator != null) {
					operator.dispose();
				}
			}
			catch (Throwable t) {
				LOG.error("Error during disposal of stream operator.", t);
			}
		}
	}
}