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

java版本疑问 #121

Open
tracythink opened this issue Dec 30, 2024 · 1 comment
Open

java版本疑问 #121

tracythink opened this issue Dec 30, 2024 · 1 comment

Comments

@tracythink
Copy link

1 方法加了synchronized,多方调用会被互斥。SnowWorkerM1的NextNormalId中,并没有currentTimeTick==_LastTimeTick逻辑分支,这是因为?
2 正常逻辑currentTimeTick > _LastTimeTick下,_CurrentSeqNumber每次都被重新设置为5,岂不造成CalcId()中同一个机器下 第二第三段计算都一样,而仅仅时间戳计算不同。_CurrentSeqNumber为啥不自增。

@yitter
Copy link
Owner

yitter commented Jan 19, 2025

时间戳不同的时候,_CurrentSeqNumber 就没必要自增了,反正最终的 ID 肯定不会相同。

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