【发布时间】:2014-08-06 02:28:29
【问题描述】:
为什么http.shutdown() 没有停止程序?
这是一个例子:
package hello
import dispatch._, Defaults._
import scala.concurrent.Await
import scala.concurrent.duration._
object Main extends App {
val h = host("maps.googleapis.com")
val req = h / "maps" / "api" / "distancematrix" / "xml"
val params = req <<? Map("origins" -> "Berlin",
"destinations" -> "Warsaw",
"language" -> "pl")
val http = new Http
val ratioHttp: Future[xml.Elem] =
http(params OK as.xml.Elem)
println(Await.result(ratioHttp, 60.seconds))
http.shutdown()
}
【问题讨论】:
-
你确定它挂在那里而不是
Await.result?这对我来说很好。 -
它等待结果,打印它,关闭 http 并挂在那里......