aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/src/main/scala/org/apache/spark/rdd/JdbcRDD.scala13
1 files changed, 10 insertions, 3 deletions
diff --git a/core/src/main/scala/org/apache/spark/rdd/JdbcRDD.scala b/core/src/main/scala/org/apache/spark/rdd/JdbcRDD.scala
index a76a070b5b..8947e66f45 100644
--- a/core/src/main/scala/org/apache/spark/rdd/JdbcRDD.scala
+++ b/core/src/main/scala/org/apache/spark/rdd/JdbcRDD.scala
@@ -96,17 +96,23 @@ class JdbcRDD[T: ClassTag](
override def close() {
try {
- if (null != rs && ! rs.isClosed()) rs.close()
+ if (null != rs && ! rs.isClosed()) {
+ rs.close()
+ }
} catch {
case e: Exception => logWarning("Exception closing resultset", e)
}
try {
- if (null != stmt && ! stmt.isClosed()) stmt.close()
+ if (null != stmt && ! stmt.isClosed()) {
+ stmt.close()
+ }
} catch {
case e: Exception => logWarning("Exception closing statement", e)
}
try {
- if (null != conn && ! stmt.isClosed()) conn.close()
+ if (null != conn && ! conn.isClosed()) {
+ conn.close()
+ }
logInfo("closed connection")
} catch {
case e: Exception => logWarning("Exception closing connection", e)
@@ -120,3 +126,4 @@ object JdbcRDD {
Array.tabulate[Object](rs.getMetaData.getColumnCount)(i => rs.getObject(i + 1))
}
}
+