您的位置:首页 > 编程语言 > Java开发

java.net.SocketTimeoutException: Read timed out

2016-08-10 23:55 555 查看

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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: