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

sttp.client3.httpclient.FutureSequencer.scala Maven / Gradle / Ivy

The newest version!
package sttp.client3.httpclient

import java.util.concurrent.Semaphore
import scala.concurrent.{ExecutionContext, Future, blocking}

private[httpclient] class FutureSequencer(implicit ec: ExecutionContext) extends Sequencer[Future] {
  private val semaphore = new Semaphore(1)

  def apply[T](t: => Future[T]): Future[T] = {
    blocking {
      semaphore.acquire()
    }
    t.andThen { case _ => semaphore.release() }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy