cpool.setAuthenticationCredentials(new SimpleAuthenticationCredentials(username, password));
private ConnectionPoolConfiguration getConnectionPoolConfig ( final String poolName, final int poolSize ){ ConnectionPoolConfiguration config; final String username = cassandraFig.getUsername(); final String password = cassandraFig.getPassword(); if ( username != null && !username.isEmpty() && password != null && !password.isEmpty() ){ config = new ConnectionPoolConfigurationImpl( poolName ) .setPort( cassandraFig.getThriftPort() ) .setLocalDatacenter( cassandraFig.getLocalDataCenter() ) .setMaxConnsPerHost( poolSize ) .setSeeds( cassandraFig.getHosts() ) .setConnectTimeout( cassandraFig.getTimeout() ) .setSocketTimeout( cassandraFig.getTimeout() ) .setAuthenticationCredentials(new SimpleAuthenticationCredentials( username, password)); } else { // create instance of the connection pool without credential if they are not set config = new ConnectionPoolConfigurationImpl( poolName ) .setPort( cassandraFig.getThriftPort() ) .setLocalDatacenter( cassandraFig.getLocalDataCenter() ) .setMaxConnsPerHost( poolSize ) .setSeeds( cassandraFig.getHosts() ) .setSocketTimeout( cassandraFig.getTimeout() ) .setConnectTimeout( cassandraFig.getTimeout() ); } return config; }
(String) config.get(StormCassandraConstants.CASSANDRA_PASSWORD) : "password"; cpConfig.setAuthenticationCredentials( new SimpleAuthenticationCredentials(new String(user), new String(password)));
.setRetryMaxDelaySlice(poolConfig.getRetryMaxDelaySlice().or(getRetryMaxDelaySlice()).or(ConnectionPoolConfigurationImpl.DEFAULT_RETRY_MAX_DELAY_SLICE)) .setMaxTimeoutWhenExhausted(poolConfig.getMaxTimeoutWhenExhausted().or(getMaxTimeoutWhenExhausted()).or(ConnectionPoolConfigurationImpl.DEFAULT_MAX_TIME_WHEN_EXHAUSTED)) .setAuthenticationCredentials(_authenticationCredentials) .setLatencyScoreStrategy(latencyScoreStrategy);
.setRetryMaxDelaySlice(poolConfig.getRetryMaxDelaySlice().or(getRetryMaxDelaySlice()).or(ConnectionPoolConfigurationImpl.DEFAULT_RETRY_MAX_DELAY_SLICE)) .setMaxTimeoutWhenExhausted(poolConfig.getMaxTimeoutWhenExhausted().or(getMaxTimeoutWhenExhausted()).or(ConnectionPoolConfigurationImpl.DEFAULT_MAX_TIME_WHEN_EXHAUSTED)) .setAuthenticationCredentials(_authenticationCredentials) .setLatencyScoreStrategy(latencyScoreStrategy);
cpool.setAuthenticationCredentials(new SimpleAuthenticationCredentials(username, password));
cpool.setAuthenticationCredentials(new SimpleAuthenticationCredentials(username, password));
connectionPoolConfiguration.setAuthenticationCredentials(new SimpleAuthenticationCredentials(username, password));