You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by ki...@apache.org on 2021/09/24 10:39:14 UTC

[dolphinscheduler] branch dev updated: [BUG-6331][WorkerServer] fix preparedStatement auto close by try with resource (#6334)

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

kirs pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git


The following commit(s) were added to refs/heads/dev by this push:
     new 61c6461  [BUG-6331][WorkerServer] fix preparedStatement auto close by try with resource (#6334)
61c6461 is described below

commit 61c64619949b2098f7efcd2cfcc701ef98564083
Author: caishunfeng <ca...@users.noreply.github.com>
AuthorDate: Fri Sep 24 18:39:04 2021 +0800

    [BUG-6331][WorkerServer] fix preparedStatement auto close by try with resource (#6334)
    
    Co-authored-by: caishunfeng <53...@qq.com>
---
 .../main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java
index 0712a7c..3846c35 100644
--- a/dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java
+++ b/dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java
@@ -372,7 +372,8 @@ public class SqlTask extends AbstractTaskExecutor {
         // is the timeout set
         boolean timeoutFlag = taskExecutionContext.getTaskTimeoutStrategy() == TaskTimeoutStrategy.FAILED
                 || taskExecutionContext.getTaskTimeoutStrategy() == TaskTimeoutStrategy.WARNFAILED;
-        try (PreparedStatement stmt = connection.prepareStatement(sqlBinds.getSql())) {
+        try {
+            PreparedStatement stmt = connection.prepareStatement(sqlBinds.getSql());
             if (timeoutFlag) {
                 stmt.setQueryTimeout(taskExecutionContext.getTaskTimeout());
             }