Skip to content

Commit

Permalink
Prevent retry of lazy Connection acquisition attempt in BaseSession:
Browse files Browse the repository at this point in the history
We used to mark the Session as open as soon as `conn` is accessed. If
the actual initialization (i.e. getting a JDBC Connection from the pool)
fails, an attempt to `close()` the Session would trigger another
initialization attempt. This change marks the Session as open only after
initialization has succeeded.

Fixes #1181.
  • Loading branch information
szeiger committed Aug 27, 2015
1 parent ed954e5 commit bcdeeaa
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion slick/src/main/scala/slick/jdbc/JdbcBackend.scala
Expand Up @@ -427,7 +427,12 @@ trait JdbcBackend extends RelationalBackend {
def isOpen = open
def isInTransaction = inTransactionally > 0

lazy val conn = { open = true; database.source.createConnection }
lazy val conn = {
val c = database.source.createConnection
open = true
c
}

lazy val metaData = conn.getMetaData()

def capabilities = {
Expand Down

0 comments on commit bcdeeaa

Please sign in to comment.