NoSQL客户端超时设置
Redis
PoolJedisConnectionFactory connectionFactory = new PoolJedisConnectionFactory();
//获取连接池连接的超时时间,默认-1L,即不进行限制
connectionFactory.setMaxWaitMillis(maxWaitMillis);
//网络连接/读超时时间:默认2000毫秒
connectionFactory.setTimeout(timeoutInMillis);this.socket.connect(new InetSocketAddress(this.host, this.port),this. timeout);
this.socket.setSoTimeout(this.timeout);-Dsun.net.client.defaultConnectTimeout=60000-Dsun.net.client.defaultReadTimeout=60000MongoDB
<beans>
<mongo:mongo host="localhost" port="27017">
<mongo:options connections-per-host="8"
threads-allowed-to-block-for-connection-multiplier="4"
<!---->
connect-timeout="1000"
max-wait-time="1500"
auto-connect-retry="true"
socket-keep-alive="true"
socket-timeout="1500"
slave-ok="true"
write-number="1"
write-timeout="0"
write-fsync="true"/>
</mongo:mongo/>
</beans>参考
Last updated