Permalink
Browse files

fix proxies

  • Loading branch information...
1 parent 11dee94 commit 386a1503b862c50a1d084a17467032ab00a142f4 @freels freels committed Sep 8, 2010
@@ -6,12 +6,12 @@ import java.sql.{Connection, SQLException, SQLIntegrityConstraintViolationExcept
class AutoDisablingDatabaseFactory(databaseFactory: DatabaseFactory, disableErrorCount: Int, disableDuration: Duration) extends DatabaseFactory {
- def apply(dbhosts: List[String], dbname: String, username: String, password: String) = {
- new AutoDisablingDatabase(databaseFactory(dbhosts, dbname, username, password), dbhosts.first, disableErrorCount, disableDuration)
- }
-
- def apply(dbhosts: List[String], username: String, password: String) = {
- new AutoDisablingDatabase(databaseFactory(dbhosts, username, password), dbhosts.first, disableErrorCount, disableDuration)
+ def apply(dbhosts: List[String], dbname: String, username: String, password: String, urlOptions: String) = {
+ new AutoDisablingDatabase(
+ databaseFactory(dbhosts, dbname, username, password, urlOptions),
+ dbhosts.first,
+ disableErrorCount,
+ disableDuration)
}
}
@@ -5,11 +5,12 @@ import scala.collection.mutable
class MemoizingDatabaseFactory(databaseFactory: DatabaseFactory) extends DatabaseFactory {
private val databases = new mutable.HashMap[String, Database] with mutable.SynchronizedMap[String, Database]
- def apply(dbhosts: List[String], dbname: String, username: String, password: String) = synchronized {
+ def apply(dbhosts: List[String], dbname: String, username: String, password: String, urlOptions: String) = synchronized {
databases.getOrElseUpdate(
dbhosts.first + "/" + dbname,
- databaseFactory(dbhosts, dbname, username, password))
+ databaseFactory(dbhosts, dbname, username, password, urlOptions))
}
- def apply(dbhosts: List[String], username: String, password: String) = databaseFactory(dbhosts, username, password)
+ // cannot memoize a connection without specifying a database
+ override def apply(dbhosts: List[String], username: String, password: String) = databaseFactory(dbhosts, username, password)
}
@@ -6,12 +6,8 @@ class StatsCollectingDatabaseFactory(
databaseFactory: DatabaseFactory,
stats: StatsCollector) extends DatabaseFactory {
- def apply(dbhosts: List[String], dbname: String, username: String, password: String) = {
- new StatsCollectingDatabase(databaseFactory(dbhosts, dbname, username, password), stats)
- }
-
- def apply(dbhosts: List[String], username: String, password: String) = {
- new StatsCollectingDatabase(databaseFactory(dbhosts, username, password), stats)
+ def apply(dbhosts: List[String], dbname: String, username: String, password: String, urlOptions: String) = {
+ new StatsCollectingDatabase(databaseFactory(dbhosts, dbname, username, password, urlOptions), stats)
}
}
@@ -9,11 +9,11 @@ import net.lag.logging.Logger
class SqlDatabaseTimeoutException(msg: String) extends SQLException(msg)
class TimingOutDatabaseFactory(databaseFactory: DatabaseFactory, poolSize: Int, queueSize: Int, openTimeout: Duration, initialTimeout: Duration, maxConnections: Int) extends DatabaseFactory {
- def apply(dbhosts: List[String], dbname: String, username: String, password: String) = {
- new TimingOutDatabase(databaseFactory(dbhosts, dbname, username, password), dbhosts, dbname, poolSize, queueSize, openTimeout, initialTimeout, maxConnections)
+ def apply(dbhosts: List[String], dbname: String, username: String, password: String, urlOptions: String) = {
+ new TimingOutDatabase(databaseFactory(dbhosts, dbname, username, password, urlOptions), dbhosts, dbname, poolSize, queueSize, openTimeout, initialTimeout, maxConnections)
}
- def apply(dbhosts: List[String], username: String, password: String) = {
+ override def apply(dbhosts: List[String], username: String, password: String) = {
new TimingOutDatabase(databaseFactory(dbhosts, username, password), dbhosts, "(null)", poolSize, queueSize, openTimeout, initialTimeout, maxConnections)
}
}

0 comments on commit 386a150

Please sign in to comment.