小编Joh*_*n W的帖子

如何处理在我的Hazelcast客户端bean的实例化(通过Spring)期间ClusterListenerThread抛出的错误?

我使用Spring来配置连接到2个成员集群的(延迟加载的)Hazelcast客户端.

<hz:client id="hazelcast" lazy-init="true">
    <hz:group name="${HzName}" password="${HzPassword}"/>
    <hz:properties>
        <hz:property name="hazelcast.client.connection.timeout">10000</hz:property>
        <hz:property name="hazelcast.client.retry.count">600</hz:property>
        <hz:property name="hazelcast.jmx">true</hz:property>
        <hz:property name="hazelcast.logging.type">slf4j</hz:property>
    </hz:properties>
    <hz:network smart-routing="true" redo-operation="true" connection-attempt-period="5000"
                connection-attempt-limit="2">
        <hz:member>${HzMember1}</hz:member>
        <hz:member>${HzMember2}</hz:member>
    </hz:network>
</hz:client>
Run Code Online (Sandbox Code Playgroud)

我的问题是:

如果,在我的应用程序启动时,群集成员的两个碰巧都不可用,那么我看到ClusterListenerThread抛出了一个SEVERE异常:

WARNING: Unable to get alive cluster connection, try in 4945 ms later, attempt 1 of 2.
16-Apr-2015 14:57:34 com.hazelcast.client.spi.impl.ClusterListenerThread
WARNING: Unable to get alive cluster connection, try in 4987 ms later, attempt 2 of 2.
16-Apr-2015 14:57:39 com.hazelcast.client.spi.impl.ClusterListenerThread
SEVERE: Error while connecting to cluster!
java.lang.IllegalStateException: Unable to connect to any address in …
Run Code Online (Sandbox Code Playgroud)

hazelcast

4
推荐指数
1
解决办法
729
查看次数

标签 统计

hazelcast ×1