本文共 879 字,大约阅读时间需要 2 分钟。
java.net.SocketTimeoutException: Read timed out
exceptionTry 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 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 which has a lot of configuration parameters. We've set some defined ones which suit most of the cases. In case, you experience tuning these parameters may help.
https://github.com/xetorthio/jedis/wiki/FAQ#jedispool-blocks-after-getting-8-connections
转载地址:http://lxfyl.baihongyu.com/