Multiple clients were created or what?

21 views
Skip to first unread message

Xi Shen

unread,
Aug 21, 2016, 4:10:58 AM8/21/16
to Dispatch
Hi,

I am new to dispatch library. I have some problem shutting down my application if I am using a customized client. I started with

val http = Http

After I finished my request, I did 
http.shutdown()

And everything went smoothly. But if I started with:

val http = Http.configure(_.setFollowRedirect(true))

The app will not exit even after I have called http.shutdown(). Accidentally, I found if I also call Http.shutdown() , the app would exit.

So I think when I do Http.configure(...), a second client were created. Is it a by design behavior? How could I know how many clients were created in the system, and make sure all of them are closed properly when I want my app to exit?


Thanks,
David
   

Aaron Hawley

unread,
Aug 31, 2016, 1:12:28 AM8/31/16
to Dispatch
Looks like you're using version 0.11.3 of dispatch?

Application shut downs successfully for me using version 0.11.2 of dispatch:

object Main extends App {
  val http = Http.configure(_.setFollowRedirects(true))
  val target = url("http://www.google.com")
  val f = Http(target OK as.String)
  f.foreach { s: String =>
    println(s.length)
  }
  Await.ready(f, Duration.Inf)
  println("FINISHED")
}
Reply all
Reply to author
Forward
0 new messages