报错信息:Exception in thread "main" redis.clients.jedis.exceptions.JedisExhaustedPoolException: Could not get a resource since the pool is exhausted
在网上找了很久没有找到,现在看来提示已经讲的很明白了,Jedis池耗尽异常:由于池已耗尽,无法获取资源
原因就是最大连接数不够使用,我在类中启动了60个并发线程,然而连接池最大连接数只有50,所以报错。
package com.wang.distributedlock.utils;
import org.springframework.beans.factory.annotation.Value;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;
/**
* @author wzq
* @date 2020/05/29/11:09
*/
public class JedisPoolUtil {
@Value("${redis.host}")
private static final String HOST = "127.0.0.1";
@Value("${redis.port}")
private static final int PORT = 6379;
@Value("${redis.password}")
private static final String PASSWORD = "123456";
priva