vincentpoon commented on a change in pull request #460: PHOENIX-5184: HBase and Phoenix connection leaks in Indexing code path, OrphanViewTool and PhoenixConfigurationUtil URL: https://github.com/apache/phoenix/pull/460#discussion_r263980171
########## File path: phoenix-core/src/main/java/org/apache/phoenix/mapreduce/PhoenixRecordWriter.java ########## @@ -52,10 +52,20 @@ public PhoenixRecordWriter(final Configuration configuration) throws SQLExceptio } public PhoenixRecordWriter(final Configuration configuration, Set<String> propsToIgnore) throws SQLException { - this.conn = ConnectionUtil.getOutputConnectionWithoutTheseProps(configuration, propsToIgnore); - this.batchSize = PhoenixConfigurationUtil.getBatchSize(configuration); - final String upsertQuery = PhoenixConfigurationUtil.getUpsertStatement(configuration); - this.statement = this.conn.prepareStatement(upsertQuery); + Connection connection = null; + try { + connection = ConnectionUtil.getOutputConnectionWithoutTheseProps(configuration, propsToIgnore); + this.batchSize = PhoenixConfigurationUtil.getBatchSize(configuration); + final String upsertQuery = PhoenixConfigurationUtil.getUpsertStatement(configuration); + this.statement = connection.prepareStatement(upsertQuery); Review comment: should we also close the Statement in the catch block? ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services