Class PythonAsyncioRuntime

java.lang.Object
io.micronaut.context.python.PythonAsyncioRuntime

@Internal public final class PythonAsyncioRuntime extends Object
Runtime helpers for Python coroutine bridge methods.
  • Method Details

    • toCompletionStage

      public static CompletionStage toCompletionStage(org.graalvm.polyglot.Value value)
      Convert a Python coroutine or awaitable value into a Java CompletionStage.
      Parameters:
      value - The Python result value.
      Returns:
      A stage that completes when the Python awaitable completes.
    • toAwaitable

      public static org.graalvm.polyglot.Value toAwaitable(org.graalvm.polyglot.Context context, CompletionStage<?> stage)
      Wrap a Java CompletionStage as an asyncio future for Python await.
      Parameters:
      context - The Python context.
      stage - The Java completion stage.
      Returns:
      An asyncio future.
    • setEnabled

      public static void setEnabled(boolean enabled)
      Set whether Python asyncio bridge execution is enabled.
      Parameters:
      enabled - Whether async bridge execution is enabled.