Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
manager
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
reyun
manager
Commits
5affa9c3
Commit
5affa9c3
authored
7 years ago
by
manxiaoqiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test pom
parent
b220960f
master
…
0727_bugfix
1082_bugfix
1151_bugfix
1209_bugfix
1315_bugfix
1439_bugfix
1608_bugfix
1608_from_1619
1619_bugfix
1990_bugfix
20180328_sale
20180411
20180525_adi
20180530_bpu
2578_bugfix
2580_fix
31762_2_bugfix
31762_bugfix
31969_bugfix
32400_fix
32599_bugfix
649_bugfix
back_version
back_version2
bigfix_20201028
bugfix_1608_new
bugfix_1760
bugfix_master_1760
change_double
contract_rela
develper
feature_20180116_new
liushaowei
manager_new
master_mv
mobvista_master
month_flow
No related merge requests found
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
177 deletions
+20
-177
workspace.xml
.idea/workspace.xml
+18
-9
pom.xml
pom.xml
+2
-2
RedisUtilNew.java
src/main/java/util/RedisUtilNew.java
+0
-166
No files found.
.idea/workspace.xml
View file @
5affa9c3
...
...
@@ -2,6 +2,7 @@
<project
version=
"4"
>
<component
name=
"ChangeListManager"
>
<list
default=
"true"
id=
"e2e217e2-2dd6-4c6f-ad19-b1cba46bc7ad"
name=
"Default"
comment=
""
>
<change
type=
"DELETED"
beforePath=
"$PROJECT_DIR$/src/main/java/util/RedisUtilNew.java"
afterPath=
""
/>
<change
type=
"MODIFICATION"
beforePath=
"$PROJECT_DIR$/.idea/workspace.xml"
afterPath=
"$PROJECT_DIR$/.idea/workspace.xml"
/>
<change
type=
"MODIFICATION"
beforePath=
"$PROJECT_DIR$/pom.xml"
afterPath=
"$PROJECT_DIR$/pom.xml"
/>
</list>
...
...
@@ -23,8 +24,8 @@
<file
leaf-file-name=
"pom.xml"
pinned=
"false"
current-in-tab=
"true"
>
<entry
file=
"file://$PROJECT_DIR$/pom.xml"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
127
"
>
<caret
line=
"
90"
column=
"116"
lean-forward=
"false"
selection-start-line=
"90"
selection-start-column=
"101"
selection-end-line=
"90"
selection-end-column=
"116
"
/>
<state
relative-caret-position=
"
571
"
>
<caret
line=
"
106"
column=
"101"
lean-forward=
"false"
selection-start-line=
"106"
selection-start-column=
"101"
selection-end-line=
"106"
selection-end-column=
"101
"
/>
<folding
/>
</state>
</provider>
...
...
@@ -45,6 +46,7 @@
<find>
`
</find>
<find>
URI_REPORT_BY_SQL
</find>
<find>
show_sql
</find>
<find>
testreyun.cjxbwnaf9ore.rds.cn-northwest-1.amazonaws.com.cn
</find>
</findStrings>
<replaceStrings>
<replace
/>
...
...
@@ -829,15 +831,22 @@
<option
name=
"project"
value=
"LOCAL"
/>
<updated>
1514873570341
</updated>
</task>
<option
name=
"localTasksCounter"
value=
"7"
/>
<task
id=
"LOCAL-00007"
summary=
"test pom"
>
<created>
1514873706283
</created>
<option
name=
"number"
value=
"00007"
/>
<option
name=
"presentableId"
value=
"LOCAL-00007"
/>
<option
name=
"project"
value=
"LOCAL"
/>
<updated>
1514873706284
</updated>
</task>
<option
name=
"localTasksCounter"
value=
"8"
/>
<servers
/>
</component>
<component
name=
"TimeTrackingManager"
>
<option
name=
"totallyTimeSpent"
value=
"58
574
000"
/>
<option
name=
"totallyTimeSpent"
value=
"58
887
000"
/>
</component>
<component
name=
"ToolWindowManager"
>
<frame
x=
"-8"
y=
"-8"
width=
"1382"
height=
"744"
extended-state=
"0"
/>
<editor
active=
"
tru
e"
/>
<editor
active=
"
fals
e"
/>
<layout>
<window_info
id=
"Palette"
active=
"false"
anchor=
"right"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
show_stripe_button=
"true"
weight=
"0.33"
sideWeight=
"0.5"
order=
"7"
side_tool=
"false"
content_ui=
"tabs"
/>
<window_info
id=
"Nl-Palette"
active=
"false"
anchor=
"left"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
show_stripe_button=
"true"
weight=
"0.33"
sideWeight=
"0.5"
order=
"6"
side_tool=
"false"
content_ui=
"tabs"
/>
...
...
@@ -858,10 +867,10 @@
<window_info
id=
"Java Enterprise"
active=
"false"
anchor=
"bottom"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
show_stripe_button=
"true"
weight=
"0.33"
sideWeight=
"0.5"
order=
"1"
side_tool=
"false"
content_ui=
"tabs"
/>
<window_info
id=
"Capture Analysis"
active=
"false"
anchor=
"right"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
show_stripe_button=
"true"
weight=
"0.33"
sideWeight=
"0.5"
order=
"4"
side_tool=
"false"
content_ui=
"tabs"
/>
<window_info
id=
"Version Control"
active=
"false"
anchor=
"bottom"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
show_stripe_button=
"true"
weight=
"0.3289689"
sideWeight=
"0.5"
order=
"2"
side_tool=
"false"
content_ui=
"tabs"
/>
<window_info
id=
"Run"
active=
"
false"
anchor=
"bottom"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"true"
show_stripe_button=
"true"
weight=
"0.36497545
"
sideWeight=
"0.5"
order=
"9"
side_tool=
"false"
content_ui=
"tabs"
/>
<window_info
id=
"Run"
active=
"
true"
anchor=
"bottom"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"true"
show_stripe_button=
"true"
weight=
"0.42880523
"
sideWeight=
"0.5"
order=
"9"
side_tool=
"false"
content_ui=
"tabs"
/>
<window_info
id=
"Spring"
active=
"false"
anchor=
"bottom"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
show_stripe_button=
"true"
weight=
"0.33"
sideWeight=
"0.5"
order=
"3"
side_tool=
"false"
content_ui=
"tabs"
/>
<window_info
id=
"Terminal"
active=
"false"
anchor=
"bottom"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
show_stripe_button=
"true"
weight=
"0.5581015"
sideWeight=
"0.5"
order=
"5"
side_tool=
"false"
content_ui=
"tabs"
/>
<window_info
id=
"Project"
active=
"false"
anchor=
"left"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"
fals
e"
show_stripe_button=
"true"
weight=
"0.2647504"
sideWeight=
"0.5"
order=
"7"
side_tool=
"false"
content_ui=
"combo"
/>
<window_info
id=
"Project"
active=
"false"
anchor=
"left"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"
tru
e"
show_stripe_button=
"true"
weight=
"0.2647504"
sideWeight=
"0.5"
order=
"7"
side_tool=
"false"
content_ui=
"combo"
/>
<window_info
id=
"Bean Validation"
active=
"false"
anchor=
"right"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
show_stripe_button=
"true"
weight=
"0.33"
sideWeight=
"0.5"
order=
"5"
side_tool=
"false"
content_ui=
"tabs"
/>
<window_info
id=
"Web"
active=
"false"
anchor=
"left"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
show_stripe_button=
"true"
weight=
"0.33"
sideWeight=
"0.5"
order=
"4"
side_tool=
"true"
content_ui=
"tabs"
/>
<window_info
id=
"Theme Preview"
active=
"false"
anchor=
"right"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
show_stripe_button=
"true"
weight=
"0.33"
sideWeight=
"0.5"
order=
"6"
side_tool=
"false"
content_ui=
"tabs"
/>
...
...
@@ -1294,8 +1303,8 @@
</entry>
<entry
file=
"file://$PROJECT_DIR$/pom.xml"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
127
"
>
<caret
line=
"
90"
column=
"116"
lean-forward=
"false"
selection-start-line=
"90"
selection-start-column=
"101"
selection-end-line=
"90"
selection-end-column=
"116
"
/>
<state
relative-caret-position=
"
571
"
>
<caret
line=
"
106"
column=
"101"
lean-forward=
"false"
selection-start-line=
"106"
selection-start-column=
"101"
selection-end-line=
"106"
selection-end-column=
"101
"
/>
<folding
/>
</state>
</provider>
...
...
This diff is collapsed.
Click to expand it.
pom.xml
View file @
5affa9c3
...
...
@@ -88,7 +88,7 @@
<!--数据源配置-->
<datasource.driver>
com.mysql.jdbc.Driver
</datasource.driver>
<!--//office-->
<datasource.url>
jdbc:mysql://testreyun.cjxbwnaf9ore.rds.cn-northwest-1.amazonaws.com.cn:3306/manager
_preview
?characterEncoding=utf-8
</datasource.url>
<datasource.url>
jdbc:mysql://testreyun.cjxbwnaf9ore.rds.cn-northwest-1.amazonaws.com.cn:3306/manager?characterEncoding=utf-8
</datasource.url>
<datasource.username>
reyuntest
</datasource.username>
<datasource.password>
reyuntest
</datasource.password>
...
...
@@ -104,7 +104,7 @@
<track.username>
reyuntest
</track.username>
<track.password>
reyuntest
</track.password>
<dmp.url>
jdbc:mysql://testreyun.cjxbwnaf9ore.rds.cn-northwest-1.amazonaws.com.cn:3306/manager
_preview
?characterEncoding=utf-8
</dmp.url>
<dmp.url>
jdbc:mysql://testreyun.cjxbwnaf9ore.rds.cn-northwest-1.amazonaws.com.cn:3306/manager?characterEncoding=utf-8
</dmp.url>
<dmp.username>
reyuntest
</dmp.username>
<dmp.password>
reyuntest
</dmp.password>
...
...
This diff is collapsed.
Click to expand it.
src/main/java/util/RedisUtilNew.java
deleted
100644 → 0
View file @
b220960f
package
util
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
redis.clients.jedis.Jedis
;
import
redis.clients.jedis.JedisPool
;
import
java.sql.Connection
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
java.util.*
;
/**
* 单节点Jedis.
* @author Administrator
*
*/
public
class
RedisUtilNew
{
protected
static
Logger
logger
=
LoggerFactory
.
getLogger
(
RedisUtilNew
.
class
);
private
static
RedisUtilNew
redisUtil
=
new
RedisUtilNew
();
private
JedisPool
pool
;
//
// private ResourceBundle resourceBundle;
private
RedisUtilNew
()
{
ResourceBundle
resourceBundle
=
ResourceBundle
.
getBundle
(
"redis"
);
pool
=
new
JedisPool
(
resourceBundle
.
getString
(
"redis.surl.host"
),
Integer
.
valueOf
(
resourceBundle
.
getString
(
"redis.surl.port"
)));
}
public
static
RedisUtilNew
getInstance
()
{
return
redisUtil
;
}
public
Map
<
String
,
String
>
hgetAll
(
String
key
)
{
Map
<
String
,
String
>
result
=
new
HashMap
<
String
,
String
>();
Jedis
jedis
=
pool
.
getResource
();
result
=
jedis
.
hgetAll
(
key
);
pool
.
returnResource
(
jedis
);
return
result
;
}
public
void
hsetAll
(
String
key
,
Map
<
String
,
String
>
map
)
{
Jedis
jedis
=
pool
.
getResource
();
jedis
.
hmset
(
key
,
map
);
pool
.
returnResource
(
jedis
);
}
public
void
delete
(
String
key
)
{
Jedis
jedis
=
pool
.
getResource
();
jedis
.
del
(
key
);
pool
.
returnResource
(
jedis
);
}
/**
* 取值
*
* @param key
* @return
*/
public
String
get
(
String
key
)
{
Jedis
jedis
=
pool
.
getResource
();
try
{
String
result
=
jedis
.
get
(
key
);
if
(
result
==
null
)
{
return
null
;
}
return
result
;
}
finally
{
pool
.
returnResource
(
jedis
);
}
}
/**
* 向redis中写入数据
* @param key
* @param value
*/
public
void
set
(
String
key
,
String
value
)
{
Jedis
jedis
=
pool
.
getResource
();
jedis
.
set
(
key
,
value
);
pool
.
returnResource
(
jedis
);
}
public
Long
getExpireTime
(
String
key
)
{
Jedis
jedis
=
pool
.
getResource
();
Long
m
=
jedis
.
ttl
(
key
);
pool
.
returnResource
(
jedis
);
return
m
;
}
/**
* 加锁.
*
* @param key
* @param expireTime
* 超时时间单位秒.
* @return 锁定的value,返回null值加锁失败,供释放锁时使用.
*/
public
String
tryLock
(
String
key
,
int
expireTime
)
{
Jedis
jedis
=
pool
.
getResource
();
try
{
String
value
=
Long
.
toString
(
System
.
currentTimeMillis
()
+
(
expireTime
*
1000
));
String
result
=
jedis
.
set
(
key
,
value
,
"NX"
,
"EX"
,
expireTime
);
if
(
result
==
null
)
{
return
null
;
}
return
value
;
}
finally
{
pool
.
returnResource
(
jedis
);
}
}
public
String
expireValue
(
String
key
,
String
value
,
int
expireTime
)
{
Jedis
jedis
=
pool
.
getResource
();
try
{
String
result
=
jedis
.
set
(
key
,
value
,
"NX"
,
"EX"
,
expireTime
);
if
(
result
==
null
)
{
return
null
;
}
return
value
;
}
finally
{
pool
.
returnResource
(
jedis
);
}
}
public
void
releaseLock
(
String
key
)
{
Jedis
jedis
=
pool
.
getResource
();
try
{
Set
<
String
>
set
=
jedis
.
keys
(
key
);
String
[]
kk
=
new
String
[
set
.
size
()];
jedis
.
del
(
set
.
toArray
(
kk
));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
finally
{
pool
.
returnResource
(
jedis
);
}
}
public
static
void
main
(
String
[]
args
)
{
RedisUtilNew
redisUtilNew
=
RedisUtilNew
.
getInstance
();
//redisUtilNew.expireValue("test005","12",1000);
Long
outtime
=
redisUtilNew
.
getExpireTime
(
"test005"
);
redisUtilNew
.
delete
(
"test005"
);
redisUtilNew
.
expireValue
(
"test005"
,
"12"
,
outtime
.
intValue
());
System
.
out
.
println
(
outtime
);
}
}
This diff is collapsed.
Click to expand it.
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