Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
GnssServer
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhushanglei
GnssServer
Commits
47dad390
Commit
47dad390
authored
Aug 19, 2022
by
zhushanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gps数据采集修改redis
parent
1c60a80a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
0 deletions
+34
-0
JedisConnectFactory.java
src/main/java/client/JedisConnectFactory.java
+34
-0
No files found.
src/main/java/client/JedisConnectFactory.java
0 → 100644
View file @
47dad390
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment