We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
String curentLock = this.getCurrentLockId(joinPoint,klock); currentThreadLock.put(curentLock,new LockRes(lockInfo, false)); 加锁时,这里的key是线程id+锁名。当同一线程重入这把锁时,内层释放时: // avoid memory leak private void cleanUpThreadLocal(String curentLock) { currentThreadLock.remove(curentLock); } 会把这把锁从map里remove掉,在外层再释放时,就拿不到锁信息了: private void releaseLock(Klock klock, JoinPoint joinPoint,String curentLock) throws Throwable { LockRes lockRes = currentThreadLock.get(curentLock); if (lockRes.getRes()) { boolean releaseRes = currentThreadLock.get(curentLock).getLock().release(); // avoid release lock twice when exception happens below lockRes.setRes(false); if (!releaseRes) { handleReleaseTimeout(klock, lockRes.getLockInfo(), joinPoint); } } } 是否应该加上计数器支持重入性?
String curentLock = this.getCurrentLockId(joinPoint,klock); currentThreadLock.put(curentLock,new LockRes(lockInfo, false));
// avoid memory leak private void cleanUpThreadLocal(String curentLock) { currentThreadLock.remove(curentLock); }
private void releaseLock(Klock klock, JoinPoint joinPoint,String curentLock) throws Throwable { LockRes lockRes = currentThreadLock.get(curentLock); if (lockRes.getRes()) { boolean releaseRes = currentThreadLock.get(curentLock).getLock().release(); // avoid release lock twice when exception happens below lockRes.setRes(false); if (!releaseRes) { handleReleaseTimeout(klock, lockRes.getLockInfo(), joinPoint); } } }
The text was updated successfully, but these errors were encountered:
@klboke 这个问题还解决么?
Sorry, something went wrong.
我记得解决了,最新代码试试呢
最新的提交记录是19年,这个问题是20年,是不是没提交呀。
cb1cdd1
No branches or pull requests
String curentLock = this.getCurrentLockId(joinPoint,klock); currentThreadLock.put(curentLock,new LockRes(lockInfo, false));
加锁时,这里的key是线程id+锁名。当同一线程重入这把锁时,内层释放时:
// avoid memory leak private void cleanUpThreadLocal(String curentLock) { currentThreadLock.remove(curentLock); }
会把这把锁从map里remove掉,在外层再释放时,就拿不到锁信息了:
private void releaseLock(Klock klock, JoinPoint joinPoint,String curentLock) throws Throwable { LockRes lockRes = currentThreadLock.get(curentLock); if (lockRes.getRes()) { boolean releaseRes = currentThreadLock.get(curentLock).getLock().release(); // avoid release lock twice when exception happens below lockRes.setRes(false); if (!releaseRes) { handleReleaseTimeout(klock, lockRes.getLockInfo(), joinPoint); } } }
是否应该加上计数器支持重入性?
The text was updated successfully, but these errors were encountered: