Fixing the bug in the file
The max values should be set before setting core values. Otherwise the core values will be compared with the default max values which is 8. The stacktrace as below Caused by: java.lang.IllegalArgumentException: Min simultaneous requests per connection for LOCAL hosts must be less than max (110 > 100) at com.datastax.driver.core.PoolingOptions.checkRequestsPerConnectionOrder(PoolingOptions.java:317) at com.datastax.driver.core.PoolingOptions.setMinSimultaneousRequestsPerConnectionThreshold(PoolingOptions.java:118) at org.springframework.cassandra.config.PoolingOptionsFactoryBean.afterPropertiesSet(PoolingOptionsFactoryBean.java:62) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1613) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1550) ... 19 more
This commit is contained in:
@@ -58,40 +58,40 @@ public class PoolingOptionsFactoryBean implements FactoryBean<PoolingOptions>, I
|
||||
|
||||
poolingOptions = new PoolingOptions();
|
||||
|
||||
if (localMinSimultaneousRequests != null) {
|
||||
poolingOptions.setMinSimultaneousRequestsPerConnectionThreshold(HostDistance.LOCAL, localMinSimultaneousRequests);
|
||||
}
|
||||
|
||||
if (localMaxSimultaneousRequests != null) {
|
||||
poolingOptions.setMaxSimultaneousRequestsPerConnectionThreshold(HostDistance.LOCAL, localMaxSimultaneousRequests);
|
||||
}
|
||||
|
||||
if (localCoreConnections != null) {
|
||||
poolingOptions.setCoreConnectionsPerHost(HostDistance.LOCAL, localCoreConnections);
|
||||
}
|
||||
|
||||
if (localMaxConnections != null) {
|
||||
poolingOptions.setMaxConnectionsPerHost(HostDistance.LOCAL, localMaxConnections);
|
||||
}
|
||||
|
||||
if (remoteMinSimultaneousRequests != null) {
|
||||
poolingOptions.setMinSimultaneousRequestsPerConnectionThreshold(HostDistance.REMOTE,
|
||||
remoteMinSimultaneousRequests);
|
||||
|
||||
if (localCoreConnections != null) {
|
||||
poolingOptions.setCoreConnectionsPerHost(HostDistance.LOCAL, localCoreConnections);
|
||||
}
|
||||
|
||||
if (remoteMaxSimultaneousRequests != null) {
|
||||
poolingOptions.setMaxSimultaneousRequestsPerConnectionThreshold(HostDistance.REMOTE,
|
||||
remoteMaxSimultaneousRequests);
|
||||
|
||||
if (localMaxSimultaneousRequests != null) {
|
||||
poolingOptions.setMaxSimultaneousRequestsPerConnectionThreshold(HostDistance.LOCAL, localMaxSimultaneousRequests);
|
||||
}
|
||||
|
||||
if (remoteCoreConnections != null) {
|
||||
poolingOptions.setCoreConnectionsPerHost(HostDistance.REMOTE, remoteCoreConnections);
|
||||
|
||||
if (localMinSimultaneousRequests != null) {
|
||||
poolingOptions.setMinSimultaneousRequestsPerConnectionThreshold(HostDistance.LOCAL, localMinSimultaneousRequests);
|
||||
}
|
||||
|
||||
if (remoteMaxConnections != null) {
|
||||
poolingOptions.setMaxConnectionsPerHost(HostDistance.REMOTE, remoteMaxConnections);
|
||||
}
|
||||
|
||||
|
||||
if (remoteCoreConnections != null) {
|
||||
poolingOptions.setCoreConnectionsPerHost(HostDistance.REMOTE, remoteCoreConnections);
|
||||
}
|
||||
|
||||
if (remoteMaxSimultaneousRequests != null) {
|
||||
poolingOptions.setMaxSimultaneousRequestsPerConnectionThreshold(HostDistance.REMOTE,
|
||||
remoteMaxSimultaneousRequests);
|
||||
}
|
||||
|
||||
if (remoteMinSimultaneousRequests != null) {
|
||||
poolingOptions.setMinSimultaneousRequestsPerConnectionThreshold(HostDistance.REMOTE,
|
||||
remoteMinSimultaneousRequests);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user