【问题标题】:Closing hazelcast client connection关闭 hazelcast 客户端连接
【发布时间】:2014-10-26 06:09:56
【问题描述】:

我刚开始使用 hazelcast [3.3.1]。按照 hazelcast 应用程序和客户端教程,我创建了一个 hazelcast 应用程序实例和一个客户端(使用 eclipse IDE)。

从客户端,我能够将对象添加到地图并成功获取它们。但是,我在实例的控制台上看到以下警告,它们似乎警告客户端断开连接。这是每个客户端 get/put 的正常行为吗?

在退出客户端程序之前,是否有适当的方法断开客户端与实例的连接?

HazelcastInstance 日志

com.hazelcast.nio.tcp.TcpIpConnection INFO: Connection [Address[x.x.x.x]:58266] lost. Reason: java.io.IOException[An existing connection was forcibly closed by the remote host]
com.hazelcast.nio.tcp.TcpIpConnection INFO: Connection [Address[127.0.0.1]:58263] lost. Reason: java.io.IOException[An existing connection was forcibly closed by the remote host]
com.hazelcast.nio.tcp.ReadHandler WARNING: hz._hzInstance_1_dev.IO.thread-in-0 Closing socket to endpoint Address[x.x.x.x]:58266, Cause:java.io.IOException: An existing connection was forcibly closed by the remote host
com.hazelcast.nio.tcp.ReadHandler WARNING: hz._hzInstance_1_dev.IO.thread-in-2 Closing socket to endpoint Address[127.0.0.1]:58263, Cause:java.io.IOException: An existing connection was forcibly closed by the remote host

【问题讨论】:

    标签: hazelcast


    【解决方案1】:

    hazelCastInstance.shutdown();是关闭 hazelcast 实例的正确方法...

    【讨论】:

    • 这是正确的;客户端也是 hazelcastinstance,可以使用 shutdown 方法关闭。
    • 如果只是想清除地图的内容,那么使用下面的,hazelcastInstance.get(mapName).clear();
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-04-01
    • 1970-01-01
    • 2013-08-10
    • 2013-08-13
    • 1970-01-01
    • 2015-03-01
    相关资源
    最近更新 更多