Class PythonFunctionInvoker

java.lang.Object
io.higson.runtime.invoker.python.PythonFunctionInvoker
All Implemented Interfaces:
FunctionInvoker

public class PythonFunctionInvoker extends Object implements FunctionInvoker
  • Constructor Details

  • Method Details

    • invoke

      public Object invoke(Function function, Object... args)
      Description copied from interface: FunctionInvoker
      Invoke function, it is a good practice to wrap any outgoing exceptions with SmartParamException with FUNCTION_INVOKE_ERROR reason.
      Specified by:
      invoke in interface FunctionInvoker
      Parameters:
      function - description of function to invoke
      args - arguments
      Returns:
      evaluated value (can be null)
    • validate

      public void validate(String name, String body, String args)
      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

      public void addGlobalObject(FunctionCode code, Object obj)
    • getThreadContext

      public ThreadContext getThreadContext()
    • getInterpreterType

      public PythonInterpreterType getInterpreterType()
    • getGlobalObjects

      public Map<FunctionCode,Object> getGlobalObjects()
    • getPreparedFunctionCache

      public Map<Integer,PreparedPythonFunction> getPreparedFunctionCache()