Skip to content

[runtime] Support async execution for cross language resources.#571

Open
wenjin272 wants to merge 1 commit intoapache:mainfrom
wenjin272:cross-async
Open

[runtime] Support async execution for cross language resources.#571
wenjin272 wants to merge 1 commit intoapache:mainfrom
wenjin272:cross-async

Conversation

@wenjin272
Copy link
Collaborator

@wenjin272 wenjin272 commented Mar 17, 2026

Linked issue: #448

Purpose of change

When invoking a Java method via Pemja from a Python async thread, if that Java method creates objects using reflection, a ClassNotFoundException may occur because the Python async thread lacks the necessary Java environment context.

In Flink agents, this issue occurs when the Python API calls a Java resource that depends on other Java resources in async thread. For example, the python chat model action call chat of a java chat model setup, and the setup will get the correspond chat model connection, which will construct the connection object by reflection.

To resolve this issue, this patch moves the construction from the python async thread to the python pemja thread.

This patch depends on alibaba/pemja#95 in pemja. Therefore, we need to wait for the fix versions for Pemja and Flink 1.20, 2.0, 2.1, and 2.2.

Tests

existed e2e test for cross language resources

API

Yes. Add open for Resource

Documentation

  • doc-needed
  • doc-not-needed
  • doc-included

@github-actions github-actions bot added priority/major Default priority of the PR or issue. fixVersion/0.3.0 The feature or bug should be implemented/fixed in the 0.3.0 version. doc-needed Your PR changes impact docs. labels Mar 17, 2026
@wenjin272 wenjin272 force-pushed the cross-async branch 2 times, most recently from 4ae7f02 to d6497a7 Compare March 18, 2026 09:28
@wenjin272
Copy link
Collaborator Author

After the code review is complete with no issues, I will add the corresponding documentation updates to this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc-needed Your PR changes impact docs. fixVersion/0.3.0 The feature or bug should be implemented/fixed in the 0.3.0 version. priority/major Default priority of the PR or issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant