This is an automated email from the ASF dual-hosted git repository.
chaokunyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/fory.git
The following commit(s) were added to refs/heads/main by this push:
new 2a435adcf fix(java): stop compilation service when shutdowning compile
service (#3138)
2a435adcf is described below
commit 2a435adcfe84f56f5af2eb7f9945129dc38305b6
Author: Shawn Yang <[email protected]>
AuthorDate: Tue Jan 13 13:13:50 2026 +0800
fix(java): stop compilation service when shutdowning compile service (#3138)
## Why?
## What does this PR do?
## Related issues
## Does this PR introduce any user-facing change?
- [ ] Does this PR introduce any public API change?
- [ ] Does this PR introduce any binary protocol compatibility change?
## Benchmark
---
.../main/java/org/apache/fory/codegen/CodeGenerator.java | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git
a/java/fory-core/src/main/java/org/apache/fory/codegen/CodeGenerator.java
b/java/fory-core/src/main/java/org/apache/fory/codegen/CodeGenerator.java
index c1d22a24e..ac55a4d66 100644
--- a/java/fory-core/src/main/java/org/apache/fory/codegen/CodeGenerator.java
+++ b/java/fory-core/src/main/java/org/apache/fory/codegen/CodeGenerator.java
@@ -249,6 +249,21 @@ public class CodeGenerator {
// in such cases we just ignore the reject exception by log it.
executor.allowCoreThreadTimeOut(true);
compilationExecutorService = executor;
+ Runtime.getRuntime()
+ .addShutdownHook(
+ new Thread(
+ () -> {
+ executor.shutdown();
+ try {
+ if (!executor.awaitTermination(1, TimeUnit.SECONDS)) {
+ executor.shutdownNow();
+ }
+ } catch (InterruptedException e) {
+ executor.shutdownNow();
+ Thread.currentThread().interrupt();
+ }
+ },
+ "fory-jit-compiler-shutdown"));
}
return compilationExecutorService;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]