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
55fc25d4
Commit
55fc25d4
authored
May 13, 2022
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复等待时间
parent
c8030ef8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
7 deletions
+9
-7
YzgTimeout.java
...src/main/java/com/yanzuoguang/util/helper/YzgTimeout.java
+5
-2
DbExecuteImpl.java
.../src/main/java/com/yanzuoguang/db/impl/DbExecuteImpl.java
+4
-5
No files found.
yzg-util-base/src/main/java/com/yanzuoguang/util/helper/YzgTimeout.java
View file @
55fc25d4
...
...
@@ -40,7 +40,10 @@ public class YzgTimeout {
ex
.
printStackTrace
();
}
});
runnable
.
run
();
isRun
.
value
=
true
;
try
{
runnable
.
run
();
}
finally
{
isRun
.
value
=
true
;
}
}
}
yzg-util-db/src/main/java/com/yanzuoguang/db/impl/DbExecuteImpl.java
View file @
55fc25d4
...
...
@@ -5,7 +5,6 @@ import com.yanzuoguang.db.DbExecute;
import
com.yanzuoguang.util.helper.YzgTimeout
;
import
com.yanzuoguang.util.vo.MapRow
;
import
com.yanzuoguang.util.vo.Ref
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.jdbc.core.JdbcTemplate
;
import
org.springframework.jdbc.core.RowCallbackHandler
;
import
org.springframework.jdbc.support.rowset.SqlRowSet
;
...
...
@@ -52,7 +51,7 @@ public class DbExecuteImpl implements DbExecute {
try
{
sql
=
this
.
handleParas
(
sql
,
paras
);
String
finalSql
=
sql
;
YzgTimeout
.
timeOut
(
DbExecuteImpl
.
c
lass
,
sqlName
,
()
->
row
.
value
=
getJdbc
().
update
(
finalSql
,
paras
));
YzgTimeout
.
timeOut
(
targetC
lass
,
sqlName
,
()
->
row
.
value
=
getJdbc
().
update
(
finalSql
,
paras
));
return
row
.
value
;
}
finally
{
printSql
.
print
(
targetClass
,
sqlName
,
start
,
row
.
value
,
sql
,
paras
);
...
...
@@ -77,7 +76,7 @@ public class DbExecuteImpl implements DbExecute {
try
{
sql
=
this
.
handleParas
(
sql
,
paras
);
String
finalSql
=
sql
;
YzgTimeout
.
timeOut
(
DbExecuteImpl
.
c
lass
,
sqlName
,
()
->
{
YzgTimeout
.
timeOut
(
targetC
lass
,
sqlName
,
()
->
{
RowCallbackHandler
rowCallbackHandler
=
rs
->
{
AllBeanRowMapper
<
T
>
rowMap
=
AllBeanRowMapper
.
getInstance
(
cls
,
configDb
);
T
data
=
rowMap
.
mapRow
(
rs
,
row
.
value
);
...
...
@@ -112,7 +111,7 @@ public class DbExecuteImpl implements DbExecute {
Ref
<
List
<
T
>>
ret
=
new
Ref
<>(
null
);
String
finalSql
=
sql
;
YzgTimeout
.
timeOut
(
cl
s
,
sqlName
,
()
->
{
YzgTimeout
.
timeOut
(
targetClas
s
,
sqlName
,
()
->
{
ret
.
value
=
this
.
getJdbc
().
query
(
finalSql
,
paras
,
AllBeanRowMapper
.
getInstance
(
cls
,
configDb
));
});
if
(
ret
.
value
==
null
)
{
...
...
@@ -157,7 +156,7 @@ public class DbExecuteImpl implements DbExecute {
Ref
<
Object
>
ret
=
new
Ref
<>(
null
);
String
finalSql
=
sql
;
YzgTimeout
.
timeOut
(
DbExecuteImpl
.
c
lass
,
sqlName
,
()
->
{
YzgTimeout
.
timeOut
(
targetC
lass
,
sqlName
,
()
->
{
SqlRowSet
rowSet
=
this
.
getJdbc
().
queryForRowSet
(
finalSql
,
paras
);
while
(
rowSet
.
next
())
{
row
.
value
=
1
;
...
...
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