tine out configuration not used 53/50053/2
authorMichael Lando <ml636r@att.com>
Sat, 2 Jun 2018 18:35:48 +0000 (21:35 +0300)
committerMichael Lando <ml636r@att.com>
Sat, 2 Jun 2018 19:11:22 +0000 (19:11 +0000)
Change-Id: I55c81975cd40b81510b18865e32e2f5394718349
Issue-ID: SDC-1344
Signed-off-by: Michael Lando <ml636r@att.com>
catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/CassandraClient.java
catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/SdcSchemaUtils.java
sdc-os-chef/scripts/docker_run.sh

index 38606d0..c343765 100644 (file)
@@ -24,6 +24,7 @@ import java.util.List;
 
 import javax.annotation.PreDestroy;
 
+import com.datastax.driver.core.SocketOptions;
 import org.apache.commons.lang3.tuple.ImmutablePair;
 import org.openecomp.sdc.be.config.ConfigurationManager;
 import org.slf4j.Logger;
@@ -65,6 +66,7 @@ public class CassandraClient {
                                        .withRetryPolicy(DefaultRetryPolicy.INSTANCE);
 
                        cassandraHosts.forEach(host -> clusterBuilder.addContactPoint(host));
+                       setSocketOptions(clusterBuilder);
                        enableAuthentication(clusterBuilder);
                        enableSsl(clusterBuilder);
                        setLocalDc(clusterBuilder);
@@ -78,6 +80,21 @@ public class CassandraClient {
                logger.info("** CassandraClient created");
        }
 
+       private void setSocketOptions(Cluster.Builder clusterBuilder) {
+               SocketOptions socketOptions =new SocketOptions();
+               Integer socketConnectTimeout = ConfigurationManager.getConfigurationManager().getConfiguration().getCassandraConfig().getSocketConnectTimeout();
+               if( socketConnectTimeout!=null ){
+                       logger.info("SocketConnectTimeout was provided, setting Cassandra client to use SocketConnectTimeout: {} .",socketConnectTimeout);
+                       socketOptions.setConnectTimeoutMillis(socketConnectTimeout);
+               }
+               Integer socketReadTimeout = ConfigurationManager.getConfigurationManager().getConfiguration().getCassandraConfig().getSocketReadTimeout();
+               if( socketReadTimeout != null ){
+                       logger.info("SocketReadTimeout was provided, setting Cassandra client to use SocketReadTimeout: {} .",socketReadTimeout);
+                       socketOptions.setReadTimeoutMillis(socketReadTimeout);
+               }
+               clusterBuilder.withSocketOptions(socketOptions);
+       }
+
        private void setLocalDc(Cluster.Builder clusterBuilder) {
                String localDataCenter = ConfigurationManager.getConfigurationManager().getConfiguration().getCassandraConfig()
                                .getLocalDataCenter();
index e1e3387..ca737b2 100644 (file)
@@ -22,6 +22,7 @@ package org.openecomp.sdc.be.dao.cassandra.schema;
 
 import java.util.List;
 
+import com.datastax.driver.core.SocketOptions;
 import org.openecomp.sdc.be.config.ConfigurationManager;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -73,6 +74,18 @@ public class SdcSchemaUtils {
             System.setProperty("javax.net.ssl.trustStorePassword", truststorePassword);
             clusterBuilder.withSSL();
         }
+        SocketOptions socketOptions =new SocketOptions();
+        Integer socketConnectTimeout = ConfigurationManager.getConfigurationManager().getConfiguration().getCassandraConfig().getSocketConnectTimeout();
+        if( socketConnectTimeout!=null ){
+            log.info("SocketConnectTimeout was provided, setting Cassandra client to use SocketConnectTimeout: {} .",socketConnectTimeout);
+            socketOptions.setConnectTimeoutMillis(socketConnectTimeout);
+        }
+        Integer socketReadTimeout = ConfigurationManager.getConfigurationManager().getConfiguration().getCassandraConfig().getSocketReadTimeout();
+        if( socketReadTimeout != null ){
+            log.info("SocketReadTimeout was provided, setting Cassandra client to use SocketReadTimeout: {} .",socketReadTimeout);
+            socketOptions.setReadTimeoutMillis(socketReadTimeout);
+        }
+        clusterBuilder.withSocketOptions(socketOptions);
         return clusterBuilder.build();
     }
 
index 2cbf191..db9a674 100755 (executable)
@@ -322,8 +322,6 @@ function sdc-cs {
 
 #Cassandra-init
 function sdc-cs-init {
-    #fix for csit failuer
-    sleep 30
     echo "docker run sdc-cassandra-init..."
     if [ ${LOCAL} = false ]; then
         docker pull ${PREFIX}/sdc-cassandra-init:${RELEASE}