diff options
author | k.kedron <k.kedron@partner.samsung.com> | 2020-03-13 17:15:14 +0100 |
---|---|---|
committer | Ofir Sonsino <ofir.sonsino@intl.att.com> | 2020-03-16 12:41:32 +0000 |
commit | 4654da998f4cd9390e2e1a02f4aa2bdf198893c0 (patch) | |
tree | d3db0f41c25d8a8eaedb53dcdcf3d780034cc472 /catalog-dao/src/main/java/org | |
parent | a2abf6ea18d512d367277bacaf7476754dc0eff5 (diff) |
Remove hardcoded timeout
Added configuration for wait seconds for Cassandra connector.
Also, increase the timeout value to prevent tests failed.
Issue-ID: SDC-2759
Signed-off-by: Krystian Kedron <k.kedron@partner.samsung.com>
Change-Id: I1008ecce98efdd8627ac3232b35fecd2a41a9c79
Diffstat (limited to 'catalog-dao/src/main/java/org')
-rw-r--r-- | catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/SdcSchemaUtils.java | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/SdcSchemaUtils.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/SdcSchemaUtils.java index 3d68980d73..76532f6ed8 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/SdcSchemaUtils.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/SdcSchemaUtils.java @@ -23,7 +23,6 @@ package org.openecomp.sdc.be.dao.cassandra.schema; import com.datastax.driver.core.Cluster; import com.datastax.driver.core.Metadata; -import com.datastax.driver.core.ProtocolVersion; import com.datastax.driver.core.Session; import com.datastax.driver.core.SocketOptions; import com.datastax.driver.core.policies.DCAwareRoundRobinPolicy; @@ -51,7 +50,7 @@ public class SdcSchemaUtils { cluster = createCluster(); isConnected = true; } catch (Exception e) { - log.info("** CassandraClient isn't connected. error is {}", e); + log.info("** CassandraClient isn't connected. error is", e); } log.info("** cluster created"); @@ -70,25 +69,26 @@ public class SdcSchemaUtils { List<String> nodes = config.getCassandraHosts(); Integer cassandraPort = config.getCassandraPort(); if (nodes == null || cassandraPort == null) { - log.info("no nodes or port were supplied in configuration."); + log.info("No nodes or port were supplied in configuration."); return null; } - log.info("connecting to node:{} port{}.", nodes, cassandraPort); + log.info("Connecting to node: {} port: {}.", nodes, cassandraPort); Cluster.Builder clusterBuilder = Cluster.builder(); nodes.forEach(node -> clusterBuilder.addContactPoint(node).withPort(cassandraPort)); - clusterBuilder.withMaxSchemaAgreementWaitSeconds(60); - - setSocketOptions(clusterBuilder, config); - if(!enableAuthentication(clusterBuilder, config)){ + log.info("Connection timeout in seconds : {}", config.getMaxWaitSeconds()); + clusterBuilder.withMaxSchemaAgreementWaitSeconds(config.getMaxWaitSeconds()); + + setSocketOptions(clusterBuilder, config); + if (!enableAuthentication(clusterBuilder, config)) { return null; } - - if(!enableSsl(clusterBuilder, config)){ + + if (!enableSsl(clusterBuilder, config)) { return null; } setLocalDc(clusterBuilder, config); - + return clusterBuilder.build(); } |