Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: 4839dc01da
Fetching contributors…

Cannot retrieve contributors at this time

29 lines (22 sloc) 0.773 kB
package com.twitter.querulous.database
import java.sql.Connection
class StatsCollectingDatabaseFactory(
databaseFactory: DatabaseFactory,
stats: StatsCollector) extends DatabaseFactory {
def apply(dbhosts: List[String], dbname: String, username: String, password: String, urlOptions: Map[String, String]) = {
new StatsCollectingDatabase(databaseFactory(dbhosts, dbname, username, password, urlOptions), stats)
}
}
class StatsCollectingDatabase(database: Database, stats: StatsCollector)
extends Database {
override def open(): Connection = {
stats.time("database-open-timing") {
database.open()
}
}
override def close(connection: Connection) = {
stats.time("database-close-timing") {
database.close(connection)
}
}
}
Jump to Line
Something went wrong with that request. Please try again.