码迷,mamicode.com
首页 > 编程语言 > 详细

java.net.SocketTimeoutException: Read timed out

时间:2016-08-11 00:31:03      阅读:189      评论:0      收藏:0      [点我收藏+]

标签:

If you get java.net.SocketTimeoutException: Read timed out exception

Try setting own timeout value when constructing JedisPool using the following constructor:

JedisPool(GenericObjectPool.Config poolConfig, String host, int port, int timeout)

Default timeout value is 2 seconds.

JedisPool blocks after getting 8 connections

JedisPool defaults to 8 connections, you can change this in the PoolConfig:

JedisPoolConfig poolConfig = new JedisPoolConfig();
poolConfig.setMaxTotal(maxTotal); // maximum active connections
poolConfig.setMaxIdle(maxIdle);  // maximum idle connections

Take into account that JedisPool inherits commons-pool BaseObjectPoolConfig which has a lot of configuration parameters. We‘ve set some defined ones which suit most of the cases. In case, you experience issues tuning these parameters may help.

 

https://github.com/xetorthio/jedis/wiki/FAQ#jedispool-blocks-after-getting-8-connections

 

java.net.SocketTimeoutException: Read timed out

标签:

原文地址:http://www.cnblogs.com/softidea/p/5759359.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!