@ -1,5 +1,5 @@
@@ -1,5 +1,5 @@
/ *
* Copyright 2012 - 2016 the original author or authors .
* Copyright 2012 - 2017 the original author or authors .
*
* Licensed under the Apache License , Version 2 . 0 ( the "License" ) ;
* you may not use this file except in compliance with the License .
@ -16,12 +16,7 @@
@@ -16,12 +16,7 @@
package org.springframework.boot.autoconfigure.cassandra ;
import java.util.HashMap ;
import java.util.Map ;
import com.datastax.driver.core.ConsistencyLevel ;
import com.datastax.driver.core.HostDistance ;
import com.datastax.driver.core.PoolingOptions ;
import com.datastax.driver.core.ProtocolOptions ;
import com.datastax.driver.core.ProtocolOptions.Compression ;
import com.datastax.driver.core.QueryOptions ;
@ -38,6 +33,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
@@ -38,6 +33,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
* @author Julien Dubois
* @author Phillip Webb
* @author Mark Paluch
* @author Stephane Nicoll
* @since 1 . 3 . 0
* /
@ConfigurationProperties ( prefix = "spring.data.cassandra" )
@ -118,21 +114,6 @@ public class CassandraProperties {
@@ -118,21 +114,6 @@ public class CassandraProperties {
* /
private int readTimeoutMillis = SocketOptions . DEFAULT_READ_TIMEOUT_MILLIS ;
/ * *
* Pooling option : heartbeat interval .
* /
private int heartbeatIntervalSeconds = PoolingOptions . DEFAULT_HEARTBEAT_INTERVAL_SECONDS ;
/ * *
* Pooling option : max queue size .
* /
private int maxQueueSize = PoolingOptions . DEFAULT_MAX_QUEUE_SIZE ;
/ * *
* Pooling option : max requests per connection .
* /
private Map < HostDistance , Integer > maxRequestsPerConnection = new HashMap < HostDistance , Integer > ( ) ;
/ * *
* Schema action to take at startup .
* /
@ -143,6 +124,11 @@ public class CassandraProperties {
@@ -143,6 +124,11 @@ public class CassandraProperties {
* /
private boolean ssl = false ;
/ * *
* Pool configuration .
* /
private final Pool pool = new Pool ( ) ;
public String getKeyspaceName ( ) {
return this . keyspaceName ;
}
@ -265,30 +251,6 @@ public class CassandraProperties {
@@ -265,30 +251,6 @@ public class CassandraProperties {
this . readTimeoutMillis = readTimeoutMillis ;
}
public int getHeartbeatIntervalSeconds ( ) {
return this . heartbeatIntervalSeconds ;
}
public void setHeartbeatIntervalSeconds ( int heartbeatIntervalSeconds ) {
this . heartbeatIntervalSeconds = heartbeatIntervalSeconds ;
}
public int getMaxQueueSize ( ) {
return this . maxQueueSize ;
}
public void setMaxQueueSize ( int maxQueueSize ) {
this . maxQueueSize = maxQueueSize ;
}
public Map < HostDistance , Integer > getMaxRequestsPerConnection ( ) {
return this . maxRequestsPerConnection ;
}
public void setMaxRequestsPerConnection ( Map < HostDistance , Integer > maxRequestsPerConnection ) {
this . maxRequestsPerConnection = maxRequestsPerConnection ;
}
public boolean isSsl ( ) {
return this . ssl ;
}
@ -305,4 +267,69 @@ public class CassandraProperties {
@@ -305,4 +267,69 @@ public class CassandraProperties {
this . schemaAction = schemaAction ;
}
public Pool getPool ( ) {
return this . pool ;
}
/ * *
* Pool properties .
* /
public static class Pool {
/ * *
* Idle timeout ( in seconds ) before an idle connection is removed .
* /
private int idleTimeout = 120 ;
/ * *
* Pool timeout ( in milliseconds ) when trying to acquire a connection from a
* host ' s pool .
* /
private int poolTimeout = 5000 ;
/ * *
* Heartbeat interval ( in seconds ) after which a message is sent on an idle
* connection to make sure it ' s still alive .
* /
private int heartbeatInterval = 30 ;
/ * *
* Maximum number of requests that get enqueued if no connection is available .
* /
private int maxQueueSize = 256 ;
public int getIdleTimeout ( ) {
return this . idleTimeout ;
}
public void setIdleTimeout ( int idleTimeout ) {
this . idleTimeout = idleTimeout ;
}
public int getPoolTimeout ( ) {
return this . poolTimeout ;
}
public void setPoolTimeout ( int poolTimeout ) {
this . poolTimeout = poolTimeout ;
}
public int getHeartbeatInterval ( ) {
return this . heartbeatInterval ;
}
public void setHeartbeatInterval ( int heartbeatInterval ) {
this . heartbeatInterval = heartbeatInterval ;
}
public int getMaxQueueSize ( ) {
return this . maxQueueSize ;
}
public void setMaxQueueSize ( int maxQueueSize ) {
this . maxQueueSize = maxQueueSize ;
}
}
}