@@ -4,22 +4,23 @@ import java.sql.Connection
4
4
import java .util .concurrent ._
5
5
import javax .inject .{Singleton , Inject }
6
6
import play .api .db .Database
7
- import play .api .Play . current
7
+ import play .api .Configuration
8
8
import play .core .NamedThreadFactory
9
9
import play .db .NamedDatabase
10
10
import scala .concurrent ._
11
11
import scala .concurrent .Future
12
12
13
13
@ Singleton
14
- class DbOperation @ Inject ()(@ NamedDatabase (" hello_world" ) protected val db : Database ) {
14
+ class DbOperation @ Inject () (@ NamedDatabase (" hello_world" ) protected val db : Database ,
15
+ configuration : Configuration ) {
15
16
16
- private val maxDbOperations = current. configuration.underlying.getInt(" max-db-ops" )
17
+ private val maxDbOperations = configuration.underlying.getInt(" max-db-ops" )
17
18
18
- private val partitionCount = current. configuration.getInt(" db.hello_world.partitionCount" ).getOrElse(2 )
19
+ private val partitionCount = configuration.getInt(" db.hello_world.partitionCount" ).getOrElse(2 )
19
20
private val maxConnections =
20
- partitionCount * current. configuration.getInt(" db.hello_world.maxConnectionsPerPartition" ).getOrElse(5 )
21
+ partitionCount * configuration.getInt(" db.hello_world.maxConnectionsPerPartition" ).getOrElse(5 )
21
22
private val minConnections =
22
- partitionCount * current. configuration.getInt(" db.hello_world.minConnectionsPerPartition" ).getOrElse(5 )
23
+ partitionCount * configuration.getInt(" db.hello_world.minConnectionsPerPartition" ).getOrElse(5 )
23
24
24
25
private val tpe = new ThreadPoolExecutor (minConnections, maxConnections,
25
26
0L , TimeUnit .MILLISECONDS ,
0 commit comments