3
爲什麼http.shutdown()
不停止該程序?斯卡拉Databinder調度Http關機
這是例子:
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並掛在那裏... – Etam