jedis常见问题 Frequently Asked Questions

本文解答了在使用Jedis进行数据库连接时遇到SocketTimeoutException的问题,通过设置自定义超时时间来解决。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 

jedis常见问题

如果你遇到 java.net.SocketTimeoutException: Read timed out exception的异常信息

请尝试在构造JedisPool的时候设置自己的超时值 JedisPool默认的超时时间是2秒

代码如下

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

poolConfig 配置文件   host 连接ip或域名 port连接端口  timeout 超时值 

 

原文:

Frequently Asked Questions

Page History

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.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值