Skip to content

Commit

Permalink
Add finally block #3
Browse files Browse the repository at this point in the history
  • Loading branch information
Danil42Russia committed May 9, 2019
1 parent c812948 commit f4979c2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/main/kotlin/ru/danil42russia/aaa/service/DBService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ class DBService {
} catch (ex: Exception) {
log.debug("Connection failed $ex")
connection = null
} finally {
if (connection == null) {
close()
}
}

}
Expand All @@ -32,5 +36,6 @@ class DBService {

fun close() {
connection?.close()
log.debug("Connection close")
}
}

0 comments on commit f4979c2

Please sign in to comment.