自动回盘锁修改
This commit is contained in:
parent
dc91e64e70
commit
80b5604b7b
@ -943,7 +943,7 @@ public class CollectAuditInfoCache {
|
||||
*/
|
||||
public String queryBatchCollectStatus(JBOTransaction tx) throws Exception{
|
||||
if(!Objects.isNull(operateFrom)){
|
||||
if(AutoRefresh.getLockStatus()){
|
||||
if(AutoRefresh.getHoldLockStatus()){
|
||||
return "定时任务回盘中,禁止手工操作!";
|
||||
}
|
||||
}
|
||||
|
||||
@ -926,7 +926,7 @@ public class CollectAuditInfoCacheTj {
|
||||
*/
|
||||
public String queryBatchCollectStatus(JBOTransaction tx) throws Exception{
|
||||
if(!Objects.isNull(operateFrom)){
|
||||
if(AutoRefresh.getLockStatus()){
|
||||
if(AutoRefresh.getHoldLockStatus()){
|
||||
return "定时任务回盘中,禁止手工操作!";
|
||||
}
|
||||
}
|
||||
|
||||
@ -24,9 +24,14 @@ import java.util.concurrent.locks.ReentrantLock;
|
||||
public class AutoRefresh implements Job {
|
||||
|
||||
private static final Lock lock = new ReentrantLock();
|
||||
private static boolean isHoldLock = false;
|
||||
|
||||
public static boolean getLockStatus() {
|
||||
return !lock.tryLock();
|
||||
public static boolean getHoldLockStatus() {
|
||||
return isHoldLock;
|
||||
}
|
||||
|
||||
public static Lock getQuartzLock() {
|
||||
return lock;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -37,6 +42,7 @@ public class AutoRefresh implements Job {
|
||||
boolean lockHoldStatus = lock.tryLock();
|
||||
try {
|
||||
if (lockHoldStatus) {
|
||||
isHoldLock = true;
|
||||
CollectAuditInfoCache ca = new CollectAuditInfoCache();
|
||||
JBOTransaction tx = null;
|
||||
try {
|
||||
@ -89,7 +95,10 @@ public class AutoRefresh implements Job {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (lockHoldStatus) lock.unlock();
|
||||
if (lockHoldStatus) {
|
||||
lock.unlock();
|
||||
isHoldLock = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user