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

可重入锁有没有问题? #9

Closed
loganoxo opened this issue Nov 9, 2018 · 0 comments
Closed

可重入锁有没有问题? #9

loganoxo opened this issue Nov 9, 2018 · 0 comments

Comments

@loganoxo
Copy link

loganoxo commented Nov 9, 2018

每次获取锁都是new出来的RedisReentrantLock,都是不同的threadData,从里面取出数据应该都是空的,
LockData lockData = threadData.get(currentThread); if ( lockData != null ) { lockData.lockCount.incrementAndGet(); return true; } String lockVal = internals.tryRedisLock(lockId,timeout,unit); if ( lockVal != null ) { LockData newLockData = new LockData(currentThread, lockVal); threadData.put(currentThread, newLockData); return true; } return false;

这里每次返回的都获取不到当前线程对应的老锁,应该不会重入吧

@Exrick Exrick closed this as completed Dec 22, 2019
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

2 participants