use of com.hazelcast.client.config.YamlClientConfigBuilder in project hazelcast by hazelcast.
the class HazelcastCommandLine method getClientConfig.
@SuppressFBWarnings(value = "DLS_DEAD_LOCAL_STORE", justification = "Generates false positive")
private ClientConfig getClientConfig(boolean retryClusterConnectForever) throws IOException {
ClientConfig config;
if (isYaml()) {
config = new YamlClientConfigBuilder(this.config).build();
} else if (isConfigFileNotNull()) {
config = new XmlClientConfigBuilder(this.config).build();
} else {
config = ClientConfig.load();
}
if (targetsMixin.getTargets() != null) {
config.getNetworkConfig().setAddresses(targetsMixin.getAddresses());
config.setClusterName(targetsMixin.getClusterName());
}
if (retryClusterConnectForever) {
final double expBackoffMultiplier = 1.25;
final long clusterConnectTimeoutMillis = Long.MAX_VALUE;
final int maxBackOffMillis = (int) SECONDS.toMillis(15);
config.getConnectionStrategyConfig().getConnectionRetryConfig().setClusterConnectTimeoutMillis(clusterConnectTimeoutMillis).setMultiplier(expBackoffMultiplier).setMaxBackoffMillis(maxBackOffMillis);
}
return config;
}
use of com.hazelcast.client.config.YamlClientConfigBuilder in project hazelcast by hazelcast.
the class YamlClientFailoverDomConfigProcessor method handleClients.
@Override
protected void handleClients(Node node) {
boolean clientConfigDefined = false;
for (Node child : childElements(node)) {
String clientPath = getTextContent(child);
try {
ClientConfig config = new YamlClientConfigBuilder(clientPath).build();
clientFailoverConfig.addClientConfig(config);
clientConfigDefined = true;
} catch (IOException e) {
throw new InvalidConfigurationException("Could not create the config from given path : " + clientPath, e);
}
}
if (!clientConfigDefined) {
String path = ((YamlElementAdapter) node).getYamlNode().path();
throw new InvalidConfigurationException(String.format("At least one client configuration must be defined " + "under '%s'", path));
}
}
Aggregations