Java generate globally unique ID code demo
I have seen two algorithm programs for generating unique IDs on GitHub (one from Baidu and the other from meituan) and intend to run them. As for the principles, the documents are very detailed. I won't paste them one by one here. I only demonstrate the code here
https://github.com/baidu/uid-generator
https://github.com/zhuzhong/idleaf
Baidu uid generator
Maven dependency
SQL script
Mapper file
application. YML configuration
Spring bean configuration
test
Meituan uid generator
Maven dependency
Spring bean configuration
test
Personally, I think it's easier to use Baidu's (wow Kaka o (∩ 8745;) O haha ~)
There is also a redis solution, which feels good
Upload complete code to https://github.com/chengjiansheng/uid-generator-demo.git
reference resources
https://github.com/baidu/uid-generator
https://tech.meituan.com/MT_Leaf.html?utm_source=tuicool&utm_medium=referral
https://github.com/zhuzhong/idleaf
https://blog.csdn.net/liubenlong007/article/details/53884447
https://www.cnblogs.com/baiwa/p/5318432.html
https://blog.csdn.net/imi00/article/details/78629710
Finally, about ringbuffer (circular buffer, or ring buffer)
https://blog.csdn.net/u011046042/article/details/51853535
https://www.jianshu.com/p/c3913c5cc184
https://blog.csdn.net/z69183787/article/details/52403134