Croway commented on code in PR #26311:
URL: https://github.com/apache/camel/pull/26311#discussion_r3990417784
##########
components/camel-python/src/main/java/org/apache/camel/language/python/PythonLanguage.java:
##########
@@ -75,19 +75,22 @@ public <T> T evaluate(String script, Map<String, Object>
bindings, Class<T> resu
}
}
- try {
- if (bindings != null) {
- bindings.forEach(compiler::set);
- }
- PyObject out = compiler.eval(code);
- if (out != null) {
- String value = out.toString();
- return
getCamelContext().getTypeConverter().convertTo(resultType, value);
+ // the interpreter is shared by every caller of this method: bind, run
and clean up under one lock
+ synchronized (compiler) {
Review Comment:
Applied in 596fde80b580: the cache miss and compile now run inside the same
lock as the bind/eval/cleanup, and both classes lock a private Object instead
of the interpreter.
_Claude Code on behalf of Croway_
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]