Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RepeatSubmitAspect.RedissonLockClient.unlock 解锁方法优化 #7722

Open
thorode opened this issue Jan 14, 2025 · 0 comments
Open

RepeatSubmitAspect.RedissonLockClient.unlock 解锁方法优化 #7722

thorode opened this issue Jan 14, 2025 · 0 comments

Comments

@thorode
Copy link

thorode commented Jan 14, 2025

版本号:

3.7.2

问题描述:

解锁异常错误:
java.lang.IllegalMonitorStateException: attempt to unlock lock, not locked by current thread by node id: dd15cf0c-19ad-43dc-8297-7d00a00a7c86 thread-id: 90
建议修复
public void unlock(String lockName) {
try {
RLock lock = redissonClient.getLock(lockName);
if (lock.isLocked() && lock.isHeldByCurrentThread()) {
lock.unlock();
}
} catch (Exception e) {
log.error("解锁异常,lockName=" + lockName, e);
}
}

错误截图:

java.lang.IllegalMonitorStateException: attempt to unlock lock, not locked by current thread by node id: dd15cf0c-19ad-43dc-8297-7d00a00a7c86 thread-id: 90
public void unlock(String lockName) {
try {
redissonClient.getLock(lockName).unlock();
} catch (Exception e) {
log.error("解锁异常,lockName=" + lockName, e);
}
}

友情提示:

  • 未按格式要求发帖、描述过于简单的,会被直接删掉;
  • 描述问题请图文并茂,方便我们理解并快速定位问题;
  • 如果使用的不是master,请说明你使用的分支;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant