Skip to content

Instantly share code, notes, and snippets.

@jostick
Created August 9, 2013 14:05
Show Gist options
  • Save jostick/6193846 to your computer and use it in GitHub Desktop.
Save jostick/6193846 to your computer and use it in GitHub Desktop.
Demonstrates an issue in finagle-mysql
name := "Finagle-mysql issue"
scalaVersion in ThisBuild := "2.10.1"
libraryDependencies in ThisBuild ++= Seq(
"com.twitter" %% "finagle-mysql" % "6.5.2"
)
import com.twitter.finagle.builder.ClientBuilder
import com.twitter.finagle.exp.mysql._
import com.twitter.finagle.exp.mysql.MySQL
import com.twitter.util.Future
import com.twitter.util.Await
object Main {
def main(args: Array[String]) {
val factory = ClientBuilder()
.codec(new MySQL("gutefrage2", "gutefrage2", Some("gutefrage2")))
.hosts("gutefrage-app:3306")
.name("mysql")
.daemon(true)
.hostConnectionCoresize(2)
.hostConnectionLimit(2)
.buildFactory()
val client = Client(factory)
val s1 = client.prepareAndExecute("SELECT 1")
val s2 = client.prepareAndExecute("SELECT 1")
Await.result(Future.collect(List(s1, s2)))
val s3 = client.prepareAndExecute("SELECT 1")
Await.result(s3)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment