Interface PythonContextExecutor

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface PythonContextExecutor
Executes a callback with exclusive access to a Python-owned polyglot context.

The context, and any context-owned Value, is valid only for the duration of the callback and must not be retained by the callback or its result.

Since:
5.2.0
Author:
Micronaut Team
  • Method Summary

    Modifier and Type
    Method
    Description
    <T extends @Nullable Object>
    T
    withContext(Function<org.graalvm.polyglot.Context, T> callback)
    Execute a callback using an exclusively owned Python context.
  • Method Details

    • withContext

      <T extends @Nullable Object> T withContext(Function<org.graalvm.polyglot.Context, T> callback)
      Execute a callback using an exclusively owned Python context.
      Type Parameters:
      T - The callback result type
      Parameters:
      callback - The callback
      Returns:
      The callback result, possibly null