-
Notifications
You must be signed in to change notification settings - Fork 147
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
功能性严重bug #5
Comments
这个确实是问题
我看 AtomicLong currentId 引用被改变时都是在锁内,应该没问题吧
原子类多线程下拿到的数据是一致的吧 |
看这个版本吧,高并发场景下实践过的。 |
ok,@wu560130911 参照你的版本我已将其进行升级 |
@wu560130911 你的同步版本中,当达到50%之后每次都需要获取锁,可考虑再优化一下 |
@zhuzhong 优化过的,只有两种情况才会进去啊 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://github.com/zhuzhong/idleaf/blob/master/src/main/java/com/zhuzhong/idleaf/support/MysqlIdLeafServiceImpl.java
此类实现存在严重功能性bug。
1、ReentrantLock为什么定义成静态的?全局共用一把锁?
2、AtomicLong的引用经常被改变,多线程读取的时候确定没有问题?
3、currentId.longValue()无法保证多线程下,不同代码行拿到的数据一致性。
The text was updated successfully, but these errors were encountered: