Java Code Examples for org.apache.flink.api.common.functions.RichFunction#setRuntimeContext()

The following examples show how to use org.apache.flink.api.common.functions.RichFunction#setRuntimeContext() . 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: PythonIteratorFunction.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
public void open(Configuration parameters) throws Exception {
	this.fun = InterpreterUtils.deserializeFunction(getRuntimeContext(), this.serFun);
	if (this.fun instanceof RichFunction) {
		try {
			final RichFunction winFun = (RichFunction) this.fun;
			winFun.setRuntimeContext(getRuntimeContext());
			winFun.open(parameters);
		} catch (PyException pe) {
			throw AbstractPythonUDF.createAndLogException(pe, LOG);
		}
	}
}
 
Example 2
Source File: AbstractPythonUDF.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
public void open(Configuration parameters) throws Exception {
	this.fun = InterpreterUtils.deserializeFunction(getRuntimeContext(), this.serFun);
	if (this.fun instanceof RichFunction) {
		try {
			final RichFunction rf = (RichFunction) this.fun;
			rf.setRuntimeContext(getRuntimeContext());
			rf.open(parameters);
		} catch (PyException pe) {
			throw createAndLogException(pe);
		}
	}
}
 
Example 3
Source File: FunctionUtils.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
public static void setFunctionRuntimeContext(Function function, RuntimeContext context){
	if (function instanceof RichFunction) {
		RichFunction richFunction = (RichFunction) function;
		richFunction.setRuntimeContext(context);
	}
}
 
Example 4
Source File: FunctionUtils.java    From flink with Apache License 2.0 4 votes vote down vote up
public static void setFunctionRuntimeContext(Function function, RuntimeContext context){
	if (function instanceof RichFunction) {
		RichFunction richFunction = (RichFunction) function;
		richFunction.setRuntimeContext(context);
	}
}
 
Example 5
Source File: FunctionUtils.java    From flink with Apache License 2.0 4 votes vote down vote up
public static void setFunctionRuntimeContext(Function function, RuntimeContext context){
	if (function instanceof RichFunction) {
		RichFunction richFunction = (RichFunction) function;
		richFunction.setRuntimeContext(context);
	}
}