You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by GitBox <gi...@apache.org> on 2020/01/03 12:41:33 UTC

[GitHub] [incubator-dolphinscheduler] Jave-Chen commented on a change in pull request #1689: Fix bug : Use try-with-resources or close this "ResultSet" in a "finally" clause

Jave-Chen commented on a change in pull request #1689: Fix bug : Use try-with-resources or close this "ResultSet" in a "finally" clause
URL: https://github.com/apache/incubator-dolphinscheduler/pull/1689#discussion_r362795935
 
 

 ##########
 File path: dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/utils/PostgrePerformance.java
 ##########
 @@ -50,26 +50,30 @@ public MonitorRecord getMonitorRecord(Connection conn) {
         Statement pstmt= null;
         try{
             pstmt = conn.createStatement();
-            ResultSet rs1 = pstmt.executeQuery("select count(*) from pg_stat_activity;");
-            while(rs1.next()){
-                monitorRecord.setThreadsConnections(rs1.getInt("count"));
-                break;
+            
+            try (ResultSet rs1 = pstmt.executeQuery("select count(*) from pg_stat_activity;")) {
+                while(rs1.next()){
 
 Review comment:
   done

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services