Permalink
Browse files

Closed #966. No more inifinite loop closing connections

  • Loading branch information...
1 parent afb0260 commit 0e17bced224bbbf5bf16b1cb172f9a3be5a445a6 @dpp dpp committed Apr 27, 2011
Showing with 6 additions and 3 deletions.
  1. +6 −3 persistence/db/src/main/scala/net/liftweb/db/DB.scala
View
9 persistence/db/src/main/scala/net/liftweb/db/DB.scala
@@ -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.