All Downloads are FREE. Search and download functionalities are using the official Maven repository.

markatta.futiles.CallingThreadExecutionContext.scala Maven / Gradle / Ivy

The newest version!
/*
 * Copyright (C) 2016 Lightbend Inc. 
 */
package markatta.futiles

import scala.concurrent.ExecutionContext

/**
 * This is a common optimization that allows us to avoid scheduling future transformations
 * for execution on the execution context but instead just run them on the calling thread.
 * Should never be used for anything but simple quick transformations.
 */
private[futiles] object CallingThreadExecutionContext extends ExecutionContext {
  override def execute(runnable: Runnable): Unit = runnable.run()
  override def reportFailure(cause: Throwable): Unit = throw cause
  implicit def Implicit: ExecutionContext = this
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy