DATACASS-275 - Don't use deprecated methods.
The method DataType.deserialize(ByteBuffer) is deprecated and throws an `UnsupportedOperationException`. This methods will be removed in future versions of the driver. By not using them anymore we make it easier to upgrade the driver afterwards. Original pull request: #49. Related ticket: DATACASS-198 CLA: 172420160413064110 (Stefan Birkner)
This commit is contained in:
committed by
Mark Paluch
parent
a1feafef67
commit
b3289af1e2
@@ -71,16 +71,15 @@ public class PoolingOptionsFactoryBean implements FactoryBean<PoolingOptions>, I
|
||||
* If the new min is greater than the current Max, set the current max to the new min first.
|
||||
* This is enforced by the DSE Driver so you cannot set a new min/max together if either one falls outside of the default 25-100 range.
|
||||
*/
|
||||
int currentMax = poolingOptions.getMaxSimultaneousRequestsPerConnectionThreshold(HostDistance.LOCAL);
|
||||
int currentMax = poolingOptions.getNewConnectionThreshold(HostDistance.LOCAL);
|
||||
if (currentMax < localMinSimultaneousRequests) {
|
||||
poolingOptions.setMaxSimultaneousRequestsPerConnectionThreshold(HostDistance.LOCAL,
|
||||
poolingOptions.setNewConnectionThreshold(HostDistance.LOCAL,
|
||||
localMinSimultaneousRequests);
|
||||
}
|
||||
poolingOptions.setMinSimultaneousRequestsPerConnectionThreshold(HostDistance.LOCAL, localMinSimultaneousRequests);
|
||||
}
|
||||
|
||||
if (localMaxSimultaneousRequests != null) {
|
||||
poolingOptions.setMaxSimultaneousRequestsPerConnectionThreshold(HostDistance.LOCAL, localMaxSimultaneousRequests);
|
||||
poolingOptions.setNewConnectionThreshold(HostDistance.LOCAL, localMaxSimultaneousRequests);
|
||||
}
|
||||
|
||||
if (remoteMaxConnections != null) {
|
||||
@@ -96,17 +95,15 @@ public class PoolingOptionsFactoryBean implements FactoryBean<PoolingOptions>, I
|
||||
* If the new min is greater than the current Max, set the current max to the new min first.
|
||||
* This is enforced by the DSE Driver so you cannot set a new min/max together if either one falls outside of the default 25-100 range.
|
||||
*/
|
||||
int currentMax = poolingOptions.getMaxSimultaneousRequestsPerConnectionThreshold(HostDistance.REMOTE);
|
||||
int currentMax = poolingOptions.getNewConnectionThreshold(HostDistance.REMOTE);
|
||||
if (currentMax < remoteMinSimultaneousRequests) {
|
||||
poolingOptions.setMaxSimultaneousRequestsPerConnectionThreshold(HostDistance.REMOTE,
|
||||
poolingOptions.setNewConnectionThreshold(HostDistance.REMOTE,
|
||||
remoteMinSimultaneousRequests);
|
||||
}
|
||||
poolingOptions.setMinSimultaneousRequestsPerConnectionThreshold(HostDistance.REMOTE,
|
||||
remoteMinSimultaneousRequests);
|
||||
}
|
||||
|
||||
if (remoteMaxSimultaneousRequests != null) {
|
||||
poolingOptions.setMaxSimultaneousRequestsPerConnectionThreshold(HostDistance.REMOTE,
|
||||
poolingOptions.setNewConnectionThreshold(HostDistance.REMOTE,
|
||||
remoteMaxSimultaneousRequests);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.util.List;
|
||||
import org.springframework.core.convert.converter.Converter;
|
||||
|
||||
import com.datastax.driver.core.ColumnDefinitions;
|
||||
import com.datastax.driver.core.ProtocolVersion;
|
||||
import com.datastax.driver.core.Row;
|
||||
import com.datastax.driver.core.ColumnDefinitions.Definition;
|
||||
|
||||
@@ -23,7 +24,8 @@ public class RowToListConverter implements Converter<Row, List<Object>> {
|
||||
|
||||
for (Definition def : cols.asList()) {
|
||||
String name = def.getName();
|
||||
list.add(row.isNull(name) ? null : def.getType().deserialize(row.getBytesUnsafe(name)));
|
||||
list.add(row.isNull(name) ? null : def.getType().deserialize(
|
||||
row.getBytesUnsafe(name), ProtocolVersion.NEWEST_SUPPORTED));
|
||||
}
|
||||
|
||||
return list;
|
||||
|
||||
@@ -22,6 +22,7 @@ import org.springframework.expression.PropertyAccessor;
|
||||
import org.springframework.expression.TypedValue;
|
||||
|
||||
import com.datastax.driver.core.DataType;
|
||||
import com.datastax.driver.core.ProtocolVersion;
|
||||
import com.datastax.driver.core.Row;
|
||||
|
||||
/**
|
||||
@@ -51,7 +52,7 @@ enum RowReaderPropertyAccessor implements PropertyAccessor {
|
||||
}
|
||||
DataType columnType = row.getColumnDefinitions().getType(name);
|
||||
ByteBuffer bytes = row.getBytes(name);
|
||||
Object object = columnType.deserialize(bytes);
|
||||
Object object = columnType.deserialize(bytes, ProtocolVersion.NEWEST_SUPPORTED);
|
||||
return new TypedValue(object);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user