private PingFailureDetector createIcmpFailureDetectorIfNeeded(HazelcastProperties properties) { IcmpFailureDetectorConfig icmpFailureDetectorConfig = node.getConfig().getNetworkConfig().getIcmpFailureDetectorConfig(); boolean icmpEchoFailFast = icmpFailureDetectorConfig == null ? properties.getBoolean(GroupProperty.ICMP_ECHO_FAIL_FAST) : icmpFailureDetectorConfig.isFailFastOnStartup(); if (icmpParallelMode) { if (icmpEchoFailFast) { logger.info("Checking that ICMP failure-detector is permitted. Attempting to create a raw-socket using JNI."); if (!ICMPHelper.isRawSocketPermitted()) { throw new IllegalStateException("ICMP failure-detector can't be used in this environment. " + "Check Hazelcast Documentation Chapter on the Ping Failure Detector for supported platforms " + "and how to enable this capability for your operating system"); } logger.info("ICMP failure-detector is supported, enabling."); } return new PingFailureDetector(icmpMaxAttempts); } return null; }
private PingFailureDetector createIcmpFailureDetectorIfNeeded(HazelcastProperties properties) { IcmpFailureDetectorConfig icmpFailureDetectorConfig = node.getConfig().getNetworkConfig().getIcmpFailureDetectorConfig(); boolean icmpEchoFailFast = icmpFailureDetectorConfig == null ? properties.getBoolean(GroupProperty.ICMP_ECHO_FAIL_FAST) : icmpFailureDetectorConfig.isFailFastOnStartup(); if (icmpParallelMode) { if (icmpEchoFailFast) { logger.info("Checking that ICMP failure-detector is permitted. Attempting to create a raw-socket using JNI."); if (!ICMPHelper.isRawSocketPermitted()) { throw new IllegalStateException("ICMP failure-detector can't be used in this environment. " + "Check Hazelcast Documentation Chapter on the Ping Failure Detector for supported platforms " + "and how to enable this capability for your operating system"); } logger.info("ICMP failure-detector is supported, enabling."); } return new PingFailureDetector(icmpMaxAttempts); } return null; }
@Override public void setHazelcastInstance(HazelcastInstance hazelcastInstance) { Config config = hazelcastInstance.getConfig(); IcmpFailureDetectorConfig icmpFailureDetectorConfig = config.getNetworkConfig().getIcmpFailureDetectorConfig(); HazelcastProperties hazelcastProperties = new HazelcastProperties(config); boolean icmpEnabled = icmpFailureDetectorConfig == null ? hazelcastProperties.getBoolean(GroupProperty.ICMP_ENABLED) : icmpFailureDetectorConfig.isEnabled(); boolean icmpParallelMode = icmpEnabled && (icmpFailureDetectorConfig == null ? hazelcastProperties.getBoolean(GroupProperty.ICMP_PARALLEL_MODE) : icmpFailureDetectorConfig.isParallelMode()); // only take into account ping information if ICMP parallel mode is enabled if (!icmpEnabled || !icmpParallelMode) { return; } int icmpMaxAttempts = icmpFailureDetectorConfig == null ? hazelcastProperties.getInteger(GroupProperty.ICMP_MAX_ATTEMPTS) : icmpFailureDetectorConfig.getMaxAttempts(); this.pingFailureDetector = new PingFailureDetector<Member>(icmpMaxAttempts); this.pingFDEnabled = true; }
@Override public void setHazelcastInstance(HazelcastInstance hazelcastInstance) { Config config = hazelcastInstance.getConfig(); IcmpFailureDetectorConfig icmpFailureDetectorConfig = config.getNetworkConfig().getIcmpFailureDetectorConfig(); HazelcastProperties hazelcastProperties = new HazelcastProperties(config); boolean icmpEnabled = icmpFailureDetectorConfig == null ? hazelcastProperties.getBoolean(GroupProperty.ICMP_ENABLED) : icmpFailureDetectorConfig.isEnabled(); boolean icmpParallelMode = icmpEnabled && (icmpFailureDetectorConfig == null ? hazelcastProperties.getBoolean(GroupProperty.ICMP_PARALLEL_MODE) : icmpFailureDetectorConfig.isParallelMode()); // only take into account ping information if ICMP parallel mode is enabled if (!icmpEnabled || !icmpParallelMode) { return; } int icmpMaxAttempts = icmpFailureDetectorConfig == null ? hazelcastProperties.getInteger(GroupProperty.ICMP_MAX_ATTEMPTS) : icmpFailureDetectorConfig.getMaxAttempts(); this.pingFailureDetector = new PingFailureDetector<Member>(icmpMaxAttempts); this.pingFDEnabled = true; }
legacyIcmpCheckThresholdMillis = heartbeatIntervalMillis * HEART_BEAT_INTERVAL_FACTOR; IcmpFailureDetectorConfig icmpFailureDetectorConfig = node.getConfig().getNetworkConfig().getIcmpFailureDetectorConfig();
legacyIcmpCheckThresholdMillis = heartbeatIntervalMillis * HEART_BEAT_INTERVAL_FACTOR; IcmpFailureDetectorConfig icmpFailureDetectorConfig = node.getConfig().getNetworkConfig().getIcmpFailureDetectorConfig();
private static void failureDetectorConfigXmlGenerator(XmlGenerator gen, NetworkConfig networkConfig) { IcmpFailureDetectorConfig icmpFailureDetectorConfig = networkConfig.getIcmpFailureDetectorConfig(); if (icmpFailureDetectorConfig == null) { return; } gen.open("failure-detector"); gen.open("icmp", "enabled", icmpFailureDetectorConfig.isEnabled()) .node("ttl", icmpFailureDetectorConfig.getTtl()) .node("interval-milliseconds", icmpFailureDetectorConfig.getIntervalMilliseconds()) .node("max-attempts", icmpFailureDetectorConfig.getMaxAttempts()) .node("timeout-milliseconds", icmpFailureDetectorConfig.getTimeoutMilliseconds()) .node("fail-fast-on-startup", icmpFailureDetectorConfig.isFailFastOnStartup()) .node("parallel-mode", icmpFailureDetectorConfig.isParallelMode()) .close(); gen.close(); }
private static void failureDetectorConfigXmlGenerator(XmlGenerator gen, NetworkConfig networkConfig) { IcmpFailureDetectorConfig icmpFailureDetectorConfig = networkConfig.getIcmpFailureDetectorConfig(); if (icmpFailureDetectorConfig == null) { return; } gen.open("failure-detector"); gen.open("icmp", "enabled", icmpFailureDetectorConfig.isEnabled()) .node("ttl", icmpFailureDetectorConfig.getTtl()) .node("interval-milliseconds", icmpFailureDetectorConfig.getIntervalMilliseconds()) .node("max-attempts", icmpFailureDetectorConfig.getMaxAttempts()) .node("timeout-milliseconds", icmpFailureDetectorConfig.getTimeoutMilliseconds()) .node("fail-fast-on-startup", icmpFailureDetectorConfig.isFailFastOnStartup()) .node("parallel-mode", icmpFailureDetectorConfig.isParallelMode()) .close(); gen.close(); }