Scala - Global Execution Context

In scala, running some asynchronous code requires a execution context. Choosing a thread pool isn’t easy and thats why scala comes with its global ExecutionContext. When I try to put some code in a Future without specifying where to run it, Scala tells me what to do:

case class Employee(id:Int, name:String)
case class Role(name:String, department :String)
case class EmployeeWithRole(id :Int, name :String, role :Role)

trait EmployeeGrabberBabber {
def rawEmployee(id :Int) :Employee
def rawRole(e :Employee) :Role
def employee(id: Int)(implicit e :ExecutionContext) :Future[Employee]
def role(employee :Employee)(implicit e :ExecutionContext) :Future[Role]
}



comments powered by Disqus