!493 HA-AA network delay of coordinator

Merge pull request !493 from jackguo/ha-network-delay-coordinator
This commit is contained in:
i-robot 2020-12-24 09:51:20 +08:00 committed by Gitee
commit 224dc8dc70
3 changed files with 23 additions and 0 deletions

View File

@ -127,6 +127,17 @@ public final class HazelcastConstants
*/
public static final String SSL_PROTOCOLS = "hazelcast.ssl.protocols";
/**
* Hazelcast heartbeat interval
*/
public static final int HEARTBEAT_INTERVAL_SECONDS = 5;
/**
* Hazelcast heartbeat timeout
*/
// !Important change the value if the heartbeat timeout value of Hetu nodes changed
public static final int HEARTBEAT_TIMEOUT_SECONDS = 10;
private HazelcastConstants()
{
}

View File

@ -72,6 +72,8 @@ public class HazelcastStateStoreBootstrapper
{
private HazelcastInstance hzInstance;
private static final String MERGED_DYNAMIC_FILTERS = "merged-dynamic-filters";
private static final String HEARTBEAT_INTERVAL_SECONDS = "hazelcast.heartbeat.interval.seconds";
private static final String HEARTBEAT_TIMEOUT_SECONDS = "hazelcast.max.no.heartbeat.seconds";
private static final int MAXIDLESECONDS = 30;
private static final int EVICTIONSIZE = 200;
private static final int TIMETOLIVESECONDS = 300;
@ -103,6 +105,10 @@ public class HazelcastStateStoreBootstrapper
// Set discovery port
hzConfig = setPortConfigs(config, hzConfig);
// Set timeout rules
hzConfig.setProperty(HEARTBEAT_INTERVAL_SECONDS, String.valueOf(HazelcastConstants.HEARTBEAT_INTERVAL_SECONDS));
hzConfig.setProperty(HEARTBEAT_TIMEOUT_SECONDS, String.valueOf(HazelcastConstants.HEARTBEAT_TIMEOUT_SECONDS + HazelcastConstants.HEARTBEAT_INTERVAL_SECONDS));
// Set hazelcast authentication config
if (Boolean.parseBoolean(config.get(KERBEROS_ENABLED))) {
hzConfig.getSecurityConfig().setEnabled(true);

View File

@ -80,6 +80,8 @@ public class HazelcastStateStoreFactory
private static final int SEED_IP_FETCHING_RETRY_TIMES = 10;
private static final long SEED_IP_FETCHING_INITIAL_RETRY_INTERVAL = 500L;
private static final String COMMA = ",";
private static final String CLIENT_HEARTBEAT_TIMEOUT = "hazelcast.client.heartbeat.timeout";
private static final String CLIENT_HEARTBEAT_INTERVAL = "hazelcast.client.heartbeat.interval";
private String name = "hazelcast";
private final Map<String, StateStoreFactory> stateStoreFactories = new ConcurrentHashMap<>(0);
@ -128,6 +130,10 @@ public class HazelcastStateStoreFactory
SslConfig.setProtocols(properties.get(SSL_PROTOCOLS));
}
// Set heartbeat config
clientConfig.setProperty(CLIENT_HEARTBEAT_TIMEOUT, String.valueOf(HazelcastConstants.HEARTBEAT_TIMEOUT_SECONDS * 1000));
clientConfig.setProperty(CLIENT_HEARTBEAT_INTERVAL, String.valueOf(HazelcastConstants.HEARTBEAT_INTERVAL_SECONDS * 1000));
final String discoveryMode = properties.get(DISCOVERY_MODE_CONFIG_NAME);
if (discoveryMode == null || discoveryMode.equalsIgnoreCase(DISCOVERY_MODE_MULTICAST)) {