Skip to content

Commit 270a572

Browse files
cfmcgradyturboFei
authored andcommitted
[KYUUBI #2571] Release connection to prevent the engine leak
### _Why are the changes needed?_ close #2571 ### _How was this patch tested?_ - [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible - [ ] Add screenshots for manual tests if appropriate - [ ] [Run test](https://kyuubi.apache.org/docs/latest/develop_tools/testing.html#running-tests) locally before make a pull request Closes #2574 from cfmcgrady/kyuubi-2571. Closes #2571 21c22c6 [Fu Chen] address comment 46911ed [Fu Chen] release connection to prevent the engine leak Authored-by: Fu Chen <cfmcgrady@gmail.com> Signed-off-by: Fei Wang <fwang12@ebay.com>
1 parent 6e17e79 commit 270a572

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

kyuubi-server/src/test/scala/org/apache/kyuubi/operation/KyuubiOperationPerConnectionSuite.scala

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,15 @@ class KyuubiOperationPerConnectionSuite extends WithKyuubiServer with HiveJDBCTe
136136
val connection = driver.connect(jdbcUrlWithConf, new Properties())
137137

138138
val stmt = connection.createStatement()
139-
stmt.execute("select engine_name()")
140-
val resultSet = stmt.getResultSet
141-
assert(resultSet.next())
142-
assert(resultSet.getString(1).nonEmpty)
139+
try {
140+
stmt.execute("select engine_name()")
141+
val resultSet = stmt.getResultSet
142+
assert(resultSet.next())
143+
assert(resultSet.getString(1).nonEmpty)
144+
} finally {
145+
stmt.close()
146+
connection.close()
147+
}
143148
}
144149

145150
withSessionConf(Map.empty)(Map.empty)(Map(
@@ -148,10 +153,15 @@ class KyuubiOperationPerConnectionSuite extends WithKyuubiServer with HiveJDBCTe
148153
val connection = driver.connect(jdbcUrlWithConf, new Properties())
149154

150155
val stmt = connection.createStatement()
151-
stmt.execute("select engine_name()")
152-
val resultSet = stmt.getResultSet
153-
assert(resultSet.next())
154-
assert(resultSet.getString(1).nonEmpty)
156+
try {
157+
stmt.execute("select engine_name()")
158+
val resultSet = stmt.getResultSet
159+
assert(resultSet.next())
160+
assert(resultSet.getString(1).nonEmpty)
161+
} finally {
162+
stmt.close()
163+
connection.close()
164+
}
155165
}
156166
}
157167

0 commit comments

Comments
 (0)