diff --git a/pom.xml b/pom.xml
index 08270dfb1..02877e232 100644
--- a/pom.xml
+++ b/pom.xml
@@ -21,25 +21,6 @@
Spring Data Cassandra
http://projects.spring.io/spring-data-cassandra/
-
- multi
- spring-data-cassandra
- 1.13.0.BUILD-SNAPSHOT
- 3.0.0.1
- 1.0
- 2.16
- 0.3.1
- 3.0.0
- 3.0.0-rc1
-
- embedded
- localhost
- 19042
- 19160
- 17000
- 17001
-
-
madams
@@ -83,6 +64,22 @@
spring-data-cassandra-distribution
+
+ localhost
+ embedded
+ 19042
+ 19160
+ 17001
+ 17000
+ 3.0.0
+ 3.0.1
+ spring-data-cassandra
+ 1.0
+ 2.16
+ multi
+ 1.13.0.BUILD-SNAPSHOT
+
+
spring-libs-snapshot
@@ -99,38 +96,24 @@
+
+
com.datastax.cassandra
- cassandra-driver-dse
- ${cassandra-driver-dse.version}
+ cassandra-driver-core
+ ${cassandra-driver.version}
- slf4j-log4j12
- org.slf4j
-
-
- log4j
- log4j
-
-
- guava
- com.google.guava
-
-
- netty-handler
io.netty
+ netty-handler
+
+
+ com.google.guava
+ guava
-
-
- org.slf4j
- jul-to-slf4j
- ${slf4j}
- test
-
-
javax.enterprise
@@ -140,6 +123,24 @@
true
+
+
+ org.apache.cassandra
+ cassandra-all
+ ${cassandra.version}
+ test
+
+
+ ch.qos.logback
+ logback-core
+
+
+ guava
+ com.google.guava
+
+
+
+
org.xerial.snappy
snappy-java
@@ -194,7 +195,7 @@
com.datastax.cassandra
- cassandra-driver-dse
+ cassandra-driver-core
diff --git a/spring-cql/pom.xml b/spring-cql/pom.xml
index 97eb9341f..d37c3e33d 100644
--- a/spring-cql/pom.xml
+++ b/spring-cql/pom.xml
@@ -50,7 +50,7 @@
com.datastax.cassandra
- cassandra-driver-dse
+ cassandra-driver-core
javax.enterprise
@@ -76,18 +76,6 @@
org.apache.cassandra
cassandra-all
- ${cassandra.version}
- test
-
-
- ch.qos.logback
- logback-core
-
-
- guava
- com.google.guava
-
-
com.google.guava
diff --git a/spring-cql/src/main/java/org/springframework/cassandra/config/CassandraCqlClusterFactoryBean.java b/spring-cql/src/main/java/org/springframework/cassandra/config/CassandraCqlClusterFactoryBean.java
index aae08bdce..901e2192a 100644
--- a/spring-cql/src/main/java/org/springframework/cassandra/config/CassandraCqlClusterFactoryBean.java
+++ b/spring-cql/src/main/java/org/springframework/cassandra/config/CassandraCqlClusterFactoryBean.java
@@ -42,6 +42,7 @@ import com.datastax.driver.core.AuthProvider;
import com.datastax.driver.core.Cluster;
import com.datastax.driver.core.Host;
import com.datastax.driver.core.LatencyTracker;
+import com.datastax.driver.core.NettyOptions;
import com.datastax.driver.core.PoolingOptions;
import com.datastax.driver.core.ProtocolOptions.Compression;
import com.datastax.driver.core.ProtocolVersion;
@@ -93,6 +94,7 @@ public class CassandraCqlClusterFactoryBean
private AuthProvider authProvider;
private String username;
private String password;
+ private NettyOptions nettyOptions;
private ProtocolVersion protocolVersion;
// Policies
@@ -189,6 +191,10 @@ public class CassandraCqlClusterFactoryBean
}
}
+ if (nettyOptions != null) {
+ builder.withNettyOptions(nettyOptions);
+ }
+
if (loadBalancingPolicy != null) {
builder.withLoadBalancingPolicy(loadBalancingPolicy);
}
@@ -275,8 +281,8 @@ public class CassandraCqlClusterFactoryBean
for (Object spec : specs) {
String cql = (spec instanceof CreateKeyspaceSpecification)
- ? new CreateKeyspaceCqlGenerator((CreateKeyspaceSpecification) spec).toCql()
- : new DropKeyspaceCqlGenerator((DropKeyspaceSpecification) spec).toCql();
+ ? new CreateKeyspaceCqlGenerator((CreateKeyspaceSpecification) spec).toCql()
+ : new DropKeyspaceCqlGenerator((DropKeyspaceSpecification) spec).toCql();
if (log.isDebugEnabled()) {
log.debug("executing raw CQL [{}]", cql);
@@ -329,7 +335,7 @@ public class CassandraCqlClusterFactoryBean
}
/**
- * Set the {@link PoolingOptions}.
+ * Set the {@link PoolingOptions} to configure the connection pooling behavior.
*/
public void setPoolingOptions(PoolingOptions poolingOptions) {
this.poolingOptions = poolingOptions;
@@ -352,7 +358,7 @@ public class CassandraCqlClusterFactoryBean
}
/**
- * Set the {@link QueryOptions}.
+ * Set the {@link QueryOptions} to tune to defaults for individual queries.
*/
public void setQueryOptions(QueryOptions queryOptions) {
this.queryOptions = queryOptions;
@@ -366,21 +372,31 @@ public class CassandraCqlClusterFactoryBean
}
/**
- * Set the {@link LoadBalancingPolicy}.
+ * Set the {@link NettyOptions} used by a client to customize the driver's underlying Netty layer.
+ *
+ * @param nettyOptions
+ * @since 1.5
+ */
+ public void setNettyOptions(NettyOptions nettyOptions) {
+ this.nettyOptions = nettyOptions;
+ }
+
+ /**
+ * Set the {@link LoadBalancingPolicy} that decides which Cassandra hosts to contact for each new query.
*/
public void setLoadBalancingPolicy(LoadBalancingPolicy loadBalancingPolicy) {
this.loadBalancingPolicy = loadBalancingPolicy;
}
/**
- * Set the {@link ReconnectionPolicy}.
+ * Set the {@link ReconnectionPolicy} that decides how often the reconnection to a dead node is attempted.
*/
public void setReconnectionPolicy(ReconnectionPolicy reconnectionPolicy) {
this.reconnectionPolicy = reconnectionPolicy;
}
/**
- * Set the {@link RetryPolicy}.
+ * Set the {@link RetryPolicy} that defines a default behavior to adopt when a request fails.
*/
public void setRetryPolicy(RetryPolicy retryPolicy) {
this.retryPolicy = retryPolicy;
diff --git a/spring-cql/src/main/java/org/springframework/cassandra/config/PoolingOptionsFactoryBean.java b/spring-cql/src/main/java/org/springframework/cassandra/config/PoolingOptionsFactoryBean.java
index a2dde2f44..e332e92fe 100644
--- a/spring-cql/src/main/java/org/springframework/cassandra/config/PoolingOptionsFactoryBean.java
+++ b/spring-cql/src/main/java/org/springframework/cassandra/config/PoolingOptionsFactoryBean.java
@@ -1,12 +1,12 @@
/*
- * Copyright 2013-2014 the original author or authors.
- *
+ * Copyright 2013-2016 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.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -24,9 +24,10 @@ import com.datastax.driver.core.PoolingOptions;
/**
* Pooling Options Factory Bean.
- *
+ *
* @author Matthew T. Adams
* @author David Webb
+ * @author Mark Paluch
*/
public class PoolingOptionsFactoryBean implements FactoryBean, InitializingBean, DisposableBean {
@@ -79,7 +80,7 @@ public class PoolingOptionsFactoryBean implements FactoryBean, I
}
if (localMaxSimultaneousRequests != null) {
- poolingOptions.setNewConnectionThreshold(HostDistance.LOCAL, localMaxSimultaneousRequests);
+ poolingOptions.setMaxRequestsPerConnection(HostDistance.LOCAL, localMaxSimultaneousRequests);
}
if (remoteMaxConnections != null) {
@@ -103,7 +104,7 @@ public class PoolingOptionsFactoryBean implements FactoryBean, I
}
if (remoteMaxSimultaneousRequests != null) {
- poolingOptions.setNewConnectionThreshold(HostDistance.REMOTE,
+ poolingOptions.setMaxRequestsPerConnection(HostDistance.REMOTE,
remoteMaxSimultaneousRequests);
}
diff --git a/spring-cql/src/main/java/org/springframework/cassandra/config/java/AbstractClusterConfiguration.java b/spring-cql/src/main/java/org/springframework/cassandra/config/java/AbstractClusterConfiguration.java
index b5c5c7663..a7d895119 100644
--- a/spring-cql/src/main/java/org/springframework/cassandra/config/java/AbstractClusterConfiguration.java
+++ b/spring-cql/src/main/java/org/springframework/cassandra/config/java/AbstractClusterConfiguration.java
@@ -26,6 +26,7 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import com.datastax.driver.core.AuthProvider;
+import com.datastax.driver.core.NettyOptions;
import com.datastax.driver.core.PoolingOptions;
import com.datastax.driver.core.ProtocolVersion;
import com.datastax.driver.core.QueryOptions;
@@ -61,6 +62,7 @@ public abstract class AbstractClusterConfiguration {
bean.setReconnectionPolicy(getReconnectionPolicy());
bean.setRetryPolicy(getRetryPolicy());
bean.setMetricsEnabled(getMetricsEnabled());
+ bean.setNettyOptions(getNettyOptions());
bean.setPoolingOptions(getPoolingOptions());
bean.setQueryOptions(getQueryOptions());
@@ -158,6 +160,16 @@ public abstract class AbstractClusterConfiguration {
return CassandraCqlClusterFactoryBean.DEFAULT_METRICS_ENABLED;
}
+ /**
+ * Returns the {@link NettyOptions}. Defaults to {@link NettyOptions#DEFAULT_INSTANCE}.
+ *
+ * @return
+ * @since 1.5
+ */
+ protected NettyOptions getNettyOptions() {
+ return NettyOptions.DEFAULT_INSTANCE;
+ }
+
/**
* Returns the {@link PoolingOptions}.
*
diff --git a/spring-cql/src/main/java/org/springframework/cassandra/config/java/AbstractCqlTemplateConfiguration.java b/spring-cql/src/main/java/org/springframework/cassandra/config/java/AbstractCqlTemplateConfiguration.java
index 433fd06b9..1b26b22f7 100644
--- a/spring-cql/src/main/java/org/springframework/cassandra/config/java/AbstractCqlTemplateConfiguration.java
+++ b/spring-cql/src/main/java/org/springframework/cassandra/config/java/AbstractCqlTemplateConfiguration.java
@@ -1,8 +1,34 @@
+/*
+ * Copyright 2016 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.springframework.cassandra.config.java;
import org.springframework.cassandra.core.CqlTemplate;
import org.springframework.context.annotation.Bean;
+/**
+ * Abstract configuration class to create a {@link CqlTemplate} and inheriting {@link com.datastax.driver.core.Session}
+ * and {@link com.datastax.driver.core.Cluster} creation. This class is usually extended by user configuration classes.
+ *
+ * @author Matthew T. Adams
+ * @see org.springframework.cassandra.config.java.AbstractClusterConfiguration
+ * @see org.springframework.cassandra.config.java.AbstractSessionConfiguration
+ * @see com.datastax.driver.core.Session
+ * @see com.datastax.driver.core.Cluster
+ * @see CqlTemplate
+ */
public abstract class AbstractCqlTemplateConfiguration extends AbstractSessionConfiguration {
@Bean
diff --git a/spring-cql/src/main/java/org/springframework/cassandra/core/CqlTemplate.java b/spring-cql/src/main/java/org/springframework/cassandra/core/CqlTemplate.java
index ea9441b7e..1cd145a67 100644
--- a/spring-cql/src/main/java/org/springframework/cassandra/core/CqlTemplate.java
+++ b/spring-cql/src/main/java/org/springframework/cassandra/core/CqlTemplate.java
@@ -89,6 +89,7 @@ import com.datastax.driver.core.querybuilder.Update;
* @author David Webb
* @author Matthew Adams
* @author Ryan Scheidter
+ * @author Antoine Toulme
*/
public class CqlTemplate extends CassandraAccessor implements CqlOperations {
diff --git a/spring-cql/src/main/java/org/springframework/cassandra/core/converter/RowToListConverter.java b/spring-cql/src/main/java/org/springframework/cassandra/core/converter/RowToListConverter.java
index e572e063f..f3ca6fe40 100644
--- a/spring-cql/src/main/java/org/springframework/cassandra/core/converter/RowToListConverter.java
+++ b/spring-cql/src/main/java/org/springframework/cassandra/core/converter/RowToListConverter.java
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.springframework.cassandra.core.converter;
import java.util.ArrayList;
@@ -34,6 +33,7 @@ import com.datastax.driver.core.Row;
* @author Matthew T. Adams
* @author Stefan Birkner
* @author Mark Paluch
+ * @author Antoine Toulme
*/
@ReadingConverter
public class RowToListConverter implements Converter> {
@@ -47,13 +47,16 @@ public class RowToListConverter implements Converter> {
return null;
}
+ CodecRegistry codecRegistry = CodecRegistry.DEFAULT_INSTANCE;
ColumnDefinitions cols = row.getColumnDefinitions();
List