aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/com/drivergrp/core/execution.scala
blob: 7274f007a316c52df3ef78e336f4c25a9c3dc315 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package com.drivergrp.core


object execution {

  import scala.concurrent.ExecutionContext
  import java.util.concurrent.Executors
  import akka.actor.ActorSystem


  trait ExecutionContextModule {

    def executionContext: ExecutionContext
  }

  trait FixedThreadsExecutionContext extends ExecutionContextModule {

    def threadsNumber: Int

    val executionContext: ExecutionContext =
      ExecutionContext.fromExecutor(Executors.newFixedThreadPool(threadsNumber))
  }

  trait ActorSystemModule {

    def actorSystem: ActorSystem
  }
}