【问题标题】:Scala Databinder Dispatch Http shutdownScala Databinder Dispatch Http 关闭
【发布时间】: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 并挂在那里......

标签: scala future


【解决方案1】:

Dispatch 版本有问题。 0.11.1 工作正常。

【讨论】:

  • 我用的是 0.11.2,它也挂了
猜你喜欢
  • 1970-01-01
  • 2011-12-05
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-01-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多