Package io.higson.runtime.invoker.python
Class PythonFunctionInvoker
java.lang.Object
io.higson.runtime.invoker.python.PythonFunctionInvoker
- All Implemented Interfaces:
FunctionInvoker
-
Constructor Summary
ConstructorsConstructorDescriptionPythonFunctionInvoker(PythonProvider pythonProvider, FunctionLoggerCreator functionLoggerCreator) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddGlobalObject(FunctionCode code, Object obj) voidclean()Cleans up all resources associated with the current threadvoidinvalidate(int implId) Invoke function, it is a good practice to wrap any outgoing exceptions withSmartParamExceptionwith FUNCTION_INVOKE_ERROR reason.voidValidates function syntax using current, thread-bound interpreter.
-
Constructor Details
-
PythonFunctionInvoker
public PythonFunctionInvoker(PythonProvider pythonProvider, FunctionLoggerCreator functionLoggerCreator)
-
-
Method Details
-
invoke
Description copied from interface:FunctionInvokerInvoke function, it is a good practice to wrap any outgoing exceptions withSmartParamExceptionwith FUNCTION_INVOKE_ERROR reason.- Specified by:
invokein interfaceFunctionInvoker- Parameters:
function- description of function to invokeargs- arguments- Returns:
- evaluated value (can be null)
-
validate
Validates function syntax using current, thread-bound interpreter. The exception is thrown if function's syntax is not correct. -
clean
public void clean()Cleans up all resources associated with the current thread. - runs python gc inside the CPython interpreter - closes the CPyton interpreter - using this method before the thread terminates is necessary to prevent a memory leak -
invalidate
public void invalidate(int implId) -
addGlobalObject
-
getThreadContext
-
getInterpreterType
-
getGlobalObjects
-
getPreparedFunctionCache
-