Skip to content

Commit

Permalink
Closed lift#966. No more inifinite loop closing connections
Browse files Browse the repository at this point in the history
  • Loading branch information
dpp committed Apr 27, 2011
1 parent afb0260 commit 0e17bce
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions persistence/db/src/main/scala/net/liftweb/db/DB.scala
Expand Up @@ -1166,16 +1166,19 @@ trait ProtoDBVendor extends ConnectionManager {
notifyAll
}

def closeAllConnections_!(): Unit = synchronized {
def closeAllConnections_!(): Unit = _closeAllConnections_!(0)


private def _closeAllConnections_!(cnt: Int): Unit = synchronized {
logger.info("Closing all connections")
if (poolSize == 0) ()
if (poolSize <= 0 || cnt > 10) ()
else {
pool.foreach {c => tryo(c.close); poolSize -= 1}
pool = Nil

if (poolSize > 0) wait(250)

closeAllConnections_!()
_closeAllConnections_!(cnt + 1)
}
}
}

0 comments on commit 0e17bce

Please sign in to comment.