Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch database connection pool from DBCP2 to HikariCP #449

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion project/Project.scala
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ object Zipkin extends Build {
).settings(
libraryDependencies ++= Seq(
"com.typesafe.play" %% "anorm" % "2.3.7",
"org.apache.commons" % "commons-dbcp2" % "2.1",
"com.zaxxer" % "HikariCP-java6" % "2.3.8",
anormDriverDependencies("sqlite-persistent")
) ++ testDependencies ++ scalaTestDeps,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import anorm.SqlParser._
import java.sql.{Blob, Connection, DriverManager, SQLException, SQLRecoverableException, PreparedStatement}
import com.twitter.util.{Try, Return, Throw, Future}
import AnormThreads.inNewThread
import org.apache.commons.dbcp2.BasicDataSource
import com.zaxxer.hikari.HikariDataSource

/**
* Provides SQL database access via Anorm from the Play framework.
Expand All @@ -38,10 +38,10 @@ case class DB(dbconfig: DBConfig = new DBConfig()) {
if (dbconfig.install) this.install().close()

// Initialize connection pool
private val connpool = new BasicDataSource()
private val connpool = new HikariDataSource()
connpool.setDriverClassName(dbconfig.driver)
connpool.setUrl(dbconfig.location)
connpool.setMaxTotal(32)
connpool.setJdbcUrl(dbconfig.location)
connpool.setMaximumPoolSize(32)

/**
* Gets a dedicated java.sql.Connection to the SQL database. Note that auto-commit is
Expand Down