Alexis Hernandez
7 years ago
4 changed files with 44 additions and 2 deletions
@ -0,0 +1,15 @@ |
|||||
|
package com.xsn.explorer.executors |
||||
|
|
||||
|
import javax.inject.{Inject, Singleton} |
||||
|
|
||||
|
import akka.actor.ActorSystem |
||||
|
import play.api.libs.concurrent.CustomExecutionContext |
||||
|
|
||||
|
import scala.concurrent.ExecutionContext |
||||
|
|
||||
|
trait DatabaseExecutionContext extends ExecutionContext |
||||
|
|
||||
|
@Singleton |
||||
|
class DatabaseAkkaExecutionContext @Inject()(system: ActorSystem) |
||||
|
extends CustomExecutionContext(system, "database.dispatcher") |
||||
|
with DatabaseExecutionContext |
@ -1,11 +1,12 @@ |
|||||
package com.xsn.explorer.modules |
package com.xsn.explorer.modules |
||||
|
|
||||
import com.google.inject.AbstractModule |
import com.google.inject.AbstractModule |
||||
import com.xsn.explorer.executors.{ExternalServiceAkkaExecutionContext, ExternalServiceExecutionContext} |
import com.xsn.explorer.executors.{DatabaseAkkaExecutionContext, DatabaseExecutionContext, ExternalServiceAkkaExecutionContext, ExternalServiceExecutionContext} |
||||
|
|
||||
class ExecutorsModule extends AbstractModule { |
class ExecutorsModule extends AbstractModule { |
||||
|
|
||||
override def configure(): Unit = { |
override def configure(): Unit = { |
||||
bind(classOf[ExternalServiceExecutionContext]).to(classOf[ExternalServiceAkkaExecutionContext]) |
bind(classOf[ExternalServiceExecutionContext]).to(classOf[ExternalServiceAkkaExecutionContext]) |
||||
|
bind(classOf[DatabaseExecutionContext]).to(classOf[DatabaseAkkaExecutionContext]) |
||||
} |
} |
||||
} |
} |
||||
|
Loading…
Reference in new issue