This is an automated email from the ASF dual-hosted git repository.

loogn pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/geaflow.git


The following commit(s) were added to refs/heads/master by this push:
     new d1167757b Minor: Add try-with-resources block around 
ProcessLoggerManager (#687)
d1167757b is described below

commit d1167757b6f053b953994f9e6f993ea8994600ea
Author: vamossagar12 <[email protected]>
AuthorDate: Thu Nov 27 14:03:59 2025 +0530

    Minor: Add try-with-resources block around ProcessLoggerManager (#687)
---
 .../org/apache/geaflow/infer/InferTaskRunImpl.java | 27 +++++++++++-----------
 1 file changed, 14 insertions(+), 13 deletions(-)

diff --git 
a/geaflow/geaflow-infer/src/main/java/org/apache/geaflow/infer/InferTaskRunImpl.java
 
b/geaflow/geaflow-infer/src/main/java/org/apache/geaflow/infer/InferTaskRunImpl.java
index a778b4790..bfd02c7a4 100644
--- 
a/geaflow/geaflow-infer/src/main/java/org/apache/geaflow/infer/InferTaskRunImpl.java
+++ 
b/geaflow/geaflow-infer/src/main/java/org/apache/geaflow/infer/InferTaskRunImpl.java
@@ -76,19 +76,20 @@ public class InferTaskRunImpl implements InferTaskRun {
         try {
             inferTask = inferTaskBuilder.start();
             this.inferTaskStatus = InferTaskStatus.RUNNING;
-            ProcessLoggerManager processLogger = new 
ProcessLoggerManager(inferTask, new 
Slf4JProcessOutputConsumer(this.getClass().getSimpleName()));
-            processLogger.startLogging();
-            int exitValue = 0;
-            if (inferTask.waitFor(TIMEOUT_SECOND, TimeUnit.SECONDS)) {
-                exitValue = inferTask.exitValue();
-                this.inferTaskStatus = FAILED;
-            } else {
-                this.inferTaskStatus = InferTaskStatus.RUNNING;
-            }
-            if (exitValue != 0) {
-                throw new GeaflowRuntimeException(
-                    String.format("infer task [%s] run failed, exitCode is %d, 
message is "
-                        + "%s", inferScript, exitValue, 
processLogger.getErrorOutputLogger().get()));
+            try (ProcessLoggerManager processLogger = new 
ProcessLoggerManager(inferTask, new 
Slf4JProcessOutputConsumer(this.getClass().getSimpleName()))) {
+                processLogger.startLogging();
+                int exitValue = 0;
+                if (inferTask.waitFor(TIMEOUT_SECOND, TimeUnit.SECONDS)) {
+                    exitValue = inferTask.exitValue();
+                    this.inferTaskStatus = FAILED;
+                } else {
+                    this.inferTaskStatus = InferTaskStatus.RUNNING;
+                }
+                if (exitValue != 0) {
+                    throw new GeaflowRuntimeException(
+                        String.format("infer task [%s] run failed, exitCode is 
%d, message is "
+                                      + "%s", inferScript, exitValue, 
processLogger.getErrorOutputLogger().get()));
+                }
             }
         } catch (Exception e) {
             throw new GeaflowRuntimeException("infer task run failed", e);


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to