Commit 47dad390 authored by zhushanglei's avatar zhushanglei

gps数据采集修改redis

parent 1c60a80a
package client;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;
import server.TcpServer;
public class JedisConnectFactory {
private static final JedisPool jedisPoll;
static {
// 配置连接池
JedisPoolConfig poolConfig = new JedisPoolConfig();
// 最大连接数
poolConfig.setMaxTotal(100);
// 最大空闲连接(没有人访问,池子中仍存在的连接数)
poolConfig.setMaxIdle(100);
// 最小空闲时间(超过一段时间,要是一直没有访问...)
poolConfig.setMinIdle(10);
// 等待时长
poolConfig.setMaxWaitMillis(2000);
//创建连接池对象
jedisPoll = new JedisPool(poolConfig,
TcpClient.redisHost,
TcpClient.redisPort,
1000,
TcpClient.redisPass);
}
public static Jedis getJedis() {
return jedisPoll.getResource();
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment