Commit 55fc25d4 authored by yanzg's avatar yanzg

修复等待时间

parent c8030ef8
......@@ -40,7 +40,10 @@ public class YzgTimeout {
ex.printStackTrace();
}
});
try {
runnable.run();
} finally {
isRun.value = true;
}
}
}
......@@ -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.class, sqlName, () -> row.value = getJdbc().update(finalSql, paras));
YzgTimeout.timeOut(targetClass, 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.class, sqlName, () -> {
YzgTimeout.timeOut(targetClass, 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(cls, sqlName, () -> {
YzgTimeout.timeOut(targetClass, 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.class, sqlName, () -> {
YzgTimeout.timeOut(targetClass, sqlName, () -> {
SqlRowSet rowSet = this.getJdbc().queryForRowSet(finalSql, paras);
while (rowSet.next()) {
row.value = 1;
......
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