[CALCITE-1949] CalciteStatement should call AvaticaStatement close_(), to avoid memory leak (Kevin Risden)
Close apache/calcite#671 Project: http://git-wip-us.apache.org/repos/asf/calcite/repo Commit: http://git-wip-us.apache.org/repos/asf/calcite/commit/b1e3c82c Tree: http://git-wip-us.apache.org/repos/asf/calcite/tree/b1e3c82c Diff: http://git-wip-us.apache.org/repos/asf/calcite/diff/b1e3c82c Branch: refs/heads/master Commit: b1e3c82cb1f25396eb41a106b805f3cff90a5346 Parents: 570aca3 Author: Kevin Risden <kris...@apache.org> Authored: Thu Apr 19 22:33:55 2018 -0500 Committer: Julian Hyde <jh...@apache.org> Committed: Fri Apr 20 12:52:32 2018 -0700 ---------------------------------------------------------------------- .../org/apache/calcite/jdbc/CalciteStatement.java | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/calcite/blob/b1e3c82c/core/src/main/java/org/apache/calcite/jdbc/CalciteStatement.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/calcite/jdbc/CalciteStatement.java b/core/src/main/java/org/apache/calcite/jdbc/CalciteStatement.java index e759944..f73640e 100644 --- a/core/src/main/java/org/apache/calcite/jdbc/CalciteStatement.java +++ b/core/src/main/java/org/apache/calcite/jdbc/CalciteStatement.java @@ -16,7 +16,6 @@ */ package org.apache.calcite.jdbc; -import org.apache.calcite.avatica.AvaticaResultSet; import org.apache.calcite.avatica.AvaticaStatement; import org.apache.calcite.avatica.Meta; import org.apache.calcite.avatica.NoSuchStatementException; @@ -81,18 +80,8 @@ public abstract class CalciteStatement extends AvaticaStatement { @Override protected void close_() { if (!closed) { - closed = true; - final CalciteConnectionImpl connection1 = - (CalciteConnectionImpl) connection; - connection1.server.removeStatement(handle); - if (openResultSet != null) { - AvaticaResultSet c = openResultSet; - openResultSet = null; - c.close(); - } - // If onStatementClose throws, this method will throw an exception (later - // converted to SQLException), but this statement still gets closed. - connection1.getDriver().handler.onStatementClose(this); + ((CalciteConnectionImpl) connection).server.removeStatement(handle); + super.close_(); } } }