Created
August 9, 2013 14:05
-
-
Save jostick/6193846 to your computer and use it in GitHub Desktop.
Demonstrates an issue in finagle-mysql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name := "Finagle-mysql issue" | |
scalaVersion in ThisBuild := "2.10.1" | |
libraryDependencies in ThisBuild ++= Seq( | |
"com.twitter" %% "finagle-mysql" % "6.5.2" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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