Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
Y
yzg-util
Project
Project
Details
Activity
Releases
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
YZG
yzg-util
Commits
84fcd60c
Commit
84fcd60c
authored
May 07, 2019
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
消除成功接收处理
parent
f3f155a4
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
16 additions
and
11 deletions
+16
-11
StringHelper.java
...c/main/java/com/yanzuoguang/util/helper/StringHelper.java
+1
-1
RunnableListAutoItem.java
...ava/com/yanzuoguang/util/thread/RunnableListAutoItem.java
+1
-1
ThreadHelper.java
...c/main/java/com/yanzuoguang/util/thread/ThreadHelper.java
+6
-1
ThreadWait.java
...src/main/java/com/yanzuoguang/util/thread/ThreadWait.java
+2
-2
RequestCacheResult.java
...in/java/com/yanzuoguang/cloud/aop/RequestCacheResult.java
+1
-1
DbExecuteImpl.java
.../src/main/java/com/yanzuoguang/db/Impl/DbExecuteImpl.java
+4
-4
MessageServiceImpl.java
...a/com/yanzuoguang/mq/service/impl/MessageServiceImpl.java
+1
-1
No files found.
yzg-util-base/src/main/java/com/yanzuoguang/util/helper/StringHelper.java
View file @
84fcd60c
...
@@ -722,7 +722,7 @@ public class StringHelper {
...
@@ -722,7 +722,7 @@ public class StringHelper {
* @return
* @return
*/
*/
public
static
String
getNewID
()
{
public
static
String
getNewID
()
{
String
tag
=
String
.
format
(
"z%012d"
,
new
Date
().
getTime
()
/
1000
);
String
tag
=
String
.
format
(
"z%012d"
,
System
.
currentTimeMillis
()
/
1000
);
String
id
=
getUUID
();
String
id
=
getUUID
();
return
tag
+
id
.
substring
(
tag
.
length
());
return
tag
+
id
.
substring
(
tag
.
length
());
}
}
...
...
yzg-util-base/src/main/java/com/yanzuoguang/util/thread/RunnableListAutoItem.java
View file @
84fcd60c
...
@@ -142,7 +142,7 @@ public class RunnableListAutoItem implements Comparable<RunnableListAutoItem> {
...
@@ -142,7 +142,7 @@ public class RunnableListAutoItem implements Comparable<RunnableListAutoItem> {
this
.
HandleException
(
ex
);
this
.
HandleException
(
ex
);
}
finally
{
}
finally
{
this
.
Count
++;
this
.
Count
++;
this
.
Time
+=
new
Date
().
getTime
()
-
start
.
getTime
();
this
.
Time
+=
System
.
currentTimeMillis
()
-
start
.
getTime
();
}
}
}
}
...
...
yzg-util-base/src/main/java/com/yanzuoguang/util/thread/ThreadHelper.java
View file @
84fcd60c
...
@@ -30,11 +30,13 @@ public class ThreadHelper {
...
@@ -30,11 +30,13 @@ public class ThreadHelper {
timeout
=
new
RunPlan
();
timeout
=
new
RunPlan
();
interval
=
new
RunPlan
();
interval
=
new
RunPlan
();
Runnable
addExecute
=
new
Runnable
()
{
Runnable
addExecute
=
new
Runnable
()
{
@Override
public
void
run
()
{
public
void
run
()
{
OnExecuteAdd
();
OnExecuteAdd
();
}
}
};
};
Runnable
itemExecuted
=
new
Runnable
()
{
Runnable
itemExecuted
=
new
Runnable
()
{
@Override
public
void
run
()
{
public
void
run
()
{
OnItemExecuted
();
OnItemExecuted
();
}
}
...
@@ -60,6 +62,7 @@ public class ThreadHelper {
...
@@ -60,6 +62,7 @@ public class ThreadHelper {
return
;
return
;
}
}
runThread
(
new
Runnable
()
{
runThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
public
void
run
()
{
threadIsRun
=
true
;
threadIsRun
=
true
;
while
(
threadIsRun
)
{
while
(
threadIsRun
)
{
...
@@ -89,9 +92,10 @@ public class ThreadHelper {
...
@@ -89,9 +92,10 @@ public class ThreadHelper {
*/
*/
private
static
void
StartMonitor
()
{
private
static
void
StartMonitor
()
{
runThread
(
new
Runnable
()
{
runThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
public
void
run
()
{
do
{
do
{
if
(
threadIsRun
&&
((
new
Date
().
getTime
()
-
threadDate
.
getTime
())
/
1000
)
>
5
)
{
if
(
threadIsRun
&&
((
System
.
currentTimeMillis
()
-
threadDate
.
getTime
())
/
1000
)
>
5
)
{
try
{
try
{
if
(
threadIsRun
)
{
if
(
threadIsRun
)
{
threadIsRun
=
false
;
threadIsRun
=
false
;
...
@@ -213,6 +217,7 @@ public class ThreadHelper {
...
@@ -213,6 +217,7 @@ public class ThreadHelper {
*/
*/
public
static
void
runThread
(
final
RunInterval
run
)
{
public
static
void
runThread
(
final
RunInterval
run
)
{
runThread
(
new
Runnable
()
{
runThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
public
void
run
()
{
while
(!
run
.
isBreak
())
{
while
(!
run
.
isBreak
())
{
try
{
try
{
...
...
yzg-util-base/src/main/java/com/yanzuoguang/util/thread/ThreadWait.java
View file @
84fcd60c
...
@@ -69,7 +69,7 @@ public class ThreadWait {
...
@@ -69,7 +69,7 @@ public class ThreadWait {
* @description
* @description
*/
*/
public
void
nexted
()
{
public
void
nexted
()
{
this
.
time
=
new
Date
().
getTime
();
this
.
time
=
System
.
currentTimeMillis
();
}
}
/**
/**
...
@@ -97,7 +97,7 @@ public class ThreadWait {
...
@@ -97,7 +97,7 @@ public class ThreadWait {
}
}
this
.
stopPrint
();
this
.
stopPrint
();
if
(!
this
.
execute
.
isFinally
())
{
if
(!
this
.
execute
.
isFinally
())
{
this
.
time
=
new
Date
().
getTime
();
this
.
time
=
System
.
currentTimeMillis
();
this
.
timer
=
new
Timer
();
this
.
timer
=
new
Timer
();
this
.
timer
.
schedule
(
new
TimerTask
()
{
this
.
timer
.
schedule
(
new
TimerTask
()
{
@Override
@Override
...
...
yzg-util-cloud/src/main/java/com/yanzuoguang/cloud/aop/RequestCacheResult.java
View file @
84fcd60c
...
@@ -37,7 +37,7 @@ public class RequestCacheResult {
...
@@ -37,7 +37,7 @@ public class RequestCacheResult {
* @return
* @return
*/
*/
public
long
getMillsecond
()
{
public
long
getMillsecond
()
{
return
new
Date
().
getTime
()
-
date
.
getTime
();
return
System
.
currentTimeMillis
()
-
date
.
getTime
();
}
}
/**
/**
...
...
yzg-util-db/src/main/java/com/yanzuoguang/db/Impl/DbExecuteImpl.java
View file @
84fcd60c
...
@@ -44,7 +44,7 @@ public class DbExecuteImpl implements DbExecute {
...
@@ -44,7 +44,7 @@ public class DbExecuteImpl implements DbExecute {
*/
*/
public
int
update
(
Class
targetClass
,
String
sqlName
,
String
sql
,
Object
...
paras
)
{
public
int
update
(
Class
targetClass
,
String
sqlName
,
String
sql
,
Object
...
paras
)
{
int
row
=
0
;
int
row
=
0
;
long
start
=
new
Date
().
getTime
();
long
start
=
System
.
currentTimeMillis
();
try
{
try
{
sql
=
this
.
handleParas
(
sql
,
paras
);
sql
=
this
.
handleParas
(
sql
,
paras
);
row
=
jdbc
.
update
(
sql
,
paras
);
row
=
jdbc
.
update
(
sql
,
paras
);
...
@@ -68,7 +68,7 @@ public class DbExecuteImpl implements DbExecute {
...
@@ -68,7 +68,7 @@ public class DbExecuteImpl implements DbExecute {
*/
*/
public
<
T
extends
Object
>
void
query
(
Class
targetClass
,
Class
<
T
>
cls
,
DbRow
<
T
>
rowHandle
,
String
sqlName
,
String
sql
,
Object
...
paras
)
{
public
<
T
extends
Object
>
void
query
(
Class
targetClass
,
Class
<
T
>
cls
,
DbRow
<
T
>
rowHandle
,
String
sqlName
,
String
sql
,
Object
...
paras
)
{
Ref
<
Integer
>
row
=
new
Ref
<
Integer
>(
0
);
Ref
<
Integer
>
row
=
new
Ref
<
Integer
>(
0
);
long
start
=
new
Date
().
getTime
();
long
start
=
System
.
currentTimeMillis
();
try
{
try
{
sql
=
this
.
handleParas
(
sql
,
paras
);
sql
=
this
.
handleParas
(
sql
,
paras
);
jdbc
.
query
(
sql
,
paras
,
new
RowCallbackHandler
()
{
jdbc
.
query
(
sql
,
paras
,
new
RowCallbackHandler
()
{
...
@@ -99,7 +99,7 @@ public class DbExecuteImpl implements DbExecute {
...
@@ -99,7 +99,7 @@ public class DbExecuteImpl implements DbExecute {
*/
*/
public
<
T
extends
Object
>
List
<
T
>
query
(
Class
targetClass
,
Class
<
T
>
cls
,
String
sqlName
,
String
sql
,
Object
...
paras
)
{
public
<
T
extends
Object
>
List
<
T
>
query
(
Class
targetClass
,
Class
<
T
>
cls
,
String
sqlName
,
String
sql
,
Object
...
paras
)
{
int
row
=
0
;
int
row
=
0
;
long
start
=
new
Date
().
getTime
();
long
start
=
System
.
currentTimeMillis
();
try
{
try
{
sql
=
this
.
handleParas
(
sql
,
paras
);
sql
=
this
.
handleParas
(
sql
,
paras
);
List
<
T
>
ret
=
jdbc
.
query
(
sql
,
paras
,
AllBeanRowMapper
.
getInstance
(
cls
,
configDb
));
List
<
T
>
ret
=
jdbc
.
query
(
sql
,
paras
,
AllBeanRowMapper
.
getInstance
(
cls
,
configDb
));
...
@@ -137,7 +137,7 @@ public class DbExecuteImpl implements DbExecute {
...
@@ -137,7 +137,7 @@ public class DbExecuteImpl implements DbExecute {
*/
*/
public
Object
queryCell
(
Class
targetClass
,
String
sqlName
,
String
sql
,
Object
...
paras
)
{
public
Object
queryCell
(
Class
targetClass
,
String
sqlName
,
String
sql
,
Object
...
paras
)
{
int
row
=
0
;
int
row
=
0
;
long
start
=
new
Date
().
getTime
();
long
start
=
System
.
currentTimeMillis
();
try
{
try
{
sql
=
this
.
handleParas
(
sql
,
paras
);
sql
=
this
.
handleParas
(
sql
,
paras
);
SqlRowSet
rowSet
=
jdbc
.
queryForRowSet
(
sql
,
paras
);
SqlRowSet
rowSet
=
jdbc
.
queryForRowSet
(
sql
,
paras
);
...
...
yzg-util-mq/src/main/java/com/yanzuoguang/mq/service/impl/MessageServiceImpl.java
View file @
84fcd60c
...
@@ -144,7 +144,7 @@ public class MessageServiceImpl implements MessageService {
...
@@ -144,7 +144,7 @@ public class MessageServiceImpl implements MessageService {
// 设置处理次数
// 设置处理次数
messageVo
.
setHandleCount
(
messageVo
.
getHandleCount
()
+
1
);
messageVo
.
setHandleCount
(
messageVo
.
getHandleCount
()
+
1
);
Date
next
=
new
Date
(
new
Date
().
getTime
()
+
5
*
60
*
1000
);
Date
next
=
new
Date
(
System
.
currentTimeMillis
()
+
5
*
60
*
1000
);
// 设置下次处理时间
// 设置下次处理时间
messageVo
.
setHandleTime
(
DateHelper
.
getDateTimeString
(
next
));
messageVo
.
setHandleTime
(
DateHelper
.
getDateTimeString
(
next
));
...
...
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