Skip to content

Instantly share code, notes, and snippets.

@j14159
Created July 29, 2014 00:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save j14159/d5355107ebb0aad59930 to your computer and use it in GitHub Desktop.
Save j14159/d5355107ebb0aad59930 to your computer and use it in GitHub Desktop.
val pool = new BoneCP(config)
val getConn = () => pool.getConnection()
val relConn = (c: Connection) => pool.releaseConnection(c)
class MyActor(get: () => Connection, rel: (c: Connection) => Unit) extends Actor {
lazy val c = get()
override def preRestart(why: Throwable, msg: Option[Any]): Unit = {
rel(c)
}
def receive = ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment