3 changed files with 39 additions and 0 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 ExternalServiceExecutionContext extends ExecutionContext |
|||
|
|||
@Singleton |
|||
class ExternalServiceAkkaExecutionContext @Inject()(system: ActorSystem) |
|||
extends CustomExecutionContext(system, "externalService.dispatcher") |
|||
with ExternalServiceExecutionContext |
@ -0,0 +1,16 @@ |
|||
package com.xsn.explorer.helpers |
|||
|
|||
import com.xsn.explorer.executors.ExternalServiceExecutionContext |
|||
|
|||
import scala.concurrent.ExecutionContext |
|||
|
|||
object Executors { |
|||
|
|||
implicit val globalEC: ExecutionContext = scala.concurrent.ExecutionContext.global |
|||
|
|||
implicit val externalServiceEC: ExternalServiceExecutionContext = new ExternalServiceExecutionContext { |
|||
override def execute(runnable: Runnable): Unit = globalEC.execute(runnable) |
|||
|
|||
override def reportFailure(cause: Throwable): Unit = globalEC.reportFailure(cause) |
|||
} |
|||
} |
Loading…
Reference in new issue