提交 fce4cb86 编写于 作者: sq3536's avatar sq3536

任务死锁改造

上级 650b5dca
......@@ -19,6 +19,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
//import java.math.BigInteger;
import java.sql.Timestamp;
......@@ -84,6 +85,7 @@ public class JobsServiceImpl implements IJobsService {
}
@Override
@Transactional
public boolean tryLock(String name, String owner) {
JobsLock lock = new JobsLock();
lock.setName(name);
......@@ -93,9 +95,11 @@ public class JobsServiceImpl implements IJobsService {
}
@Override
@Transactional
public boolean unlock(String name, String owner) {
return jobsLockService.remove(Wrappers.<JobsLock>lambdaQuery().eq(JobsLock::getName, name)
jobsLockService.getBaseMapper().delete(Wrappers.<JobsLock>lambdaQuery().eq(JobsLock::getName, name)
.eq(null != owner, JobsLock::getOwner, owner));
return true;
}
@Override
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册