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

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

There is a newer version: 3.10.1
Show newest version
package sttp.client3.internal.httpclient

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

private[client3] 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