private Cluster buildClusterSpecs ( ) { Cluster . Builder builder = Cluster . builder ( ) ; // dbhost String dbhost = getParamString ( "dbhost" ) ; String [ ] nodeAddresses = dbhost . split ( "," ) ; for ( String address : nodeAddresses ) { builder . addContactPoint ( address ) ; } // dbport builder . withPort ( getParamInt ( "dbport" , 9042 ) ) ; // db_timeout_millis and db_connect_retry_wait_millis SocketOptions socketOpts = new SocketOptions ( ) ; socketOpts . setReadTimeoutMillis ( getParamInt ( "db_timeout_millis" , 10000 ) ) ; socketOpts . setConnectTimeoutMillis ( getParamInt ( "db_connect_retry_wait_millis" , 5000 ) ) ; builder . withSocketOptions ( socketOpts ) ; // dbuser/dbpassword String dbuser = getParamString ( "dbuser" ) ; if ( ! Utils . isEmpty ( dbuser ) ) { builder . withCredentials ( dbuser , getParamString ( "dbpassword" ) ) ; } // compression builder . withCompression ( Compression . SNAPPY ) ; // TLS/SSL if ( getParamBoolean ( "dbtls" ) ) { builder . withSSL ( getSSLOptions ( ) ) ; } return builder . build ( ) ; }
Build Cluster object from ServerConfig settings .