tine out configuration not used
[sdc.git] / catalog-dao / src / main / java / org / openecomp / sdc / be / dao / cassandra / schema / SdcSchemaUtils.java
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();
     }