【问题标题】:connection termination for cassandra with phantom带有幻象的 cassandra 的连接终止
【发布时间】:2015-11-09 17:40:21
【问题描述】:

我正在尝试使用 phantom(websudos) 的 scala cassendra。这是我的代码。

  def main(args: Array[String]) {
    val hosts = Seq("localhost")
    val connector = ContactPoints(hosts).keySpace("demo")
    val i = connector.session.execute("select * from demo.events")
    println(i.all())
  }

这将转储表格中的内容,但程序永远不会退出。

但是,我将此代码放入 FlatSpec 代码工作并正确退出。

 class SongsTest extends FlatSpec{
  "test" should "Test" in {
    val hosts = Seq("localhost")
    val connector = ContactPoints(hosts).keySpace("demo")
    val i = connector.session.execute("select * from demo.events")
    println(i.all())
  }

我错过了什么?

【问题讨论】:

标签: scala cassandra


【解决方案1】:

你可以使用 connector.provider.cluster.close()

这种行为在幻像库之后。 出于某种原因,我在使用纯 datastax java 驱动程序时遇到了同样的问题。

测试运行器最后可能会调用System.exit

【讨论】:

    猜你喜欢
    • 2016-08-07
    • 1970-01-01
    • 2011-03-07
    • 2023-03-21
    • 2021-08-06
    • 2016-07-08
    • 1970-01-01
    • 2016-09-14
    • 1970-01-01
    相关资源
    最近更新 更多