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
在服务器启动时,类BufferPaddingExecutor构造函数对lastSecond进行初始化赋值,之后不再采用系统时间尽心校准,进而避免了时钟回调问题。我不太理解为什么要采用双buffer设计,既然lastSecond是稳定的lastSecond.incrementAndGet()进行递增,在每秒内的sequence(默认seqBits为13)也可以在0和8191间递增,那么此时采用双Buffer的意义是什么呢?
The text was updated successfully, but these errors were encountered:
当然sequence递增也需要用incrementAndGet()来保证线程安全性
Sorry, something went wrong.
同问,本身id的生成是纯内存操作,靠移位就可以完成。buffer的意义个人感觉不大,而且put和take的时候做很多异步操作更是对cpu的一种浪费
设计上,tail 和 cursor 指针是一直递增的,通过位运算定位 index,但是并发情况下,可能取值时环已经被循环一次了。可以参考 RingBuffer 中的 take 方法 int nextCursorIndex = calSlotIndex(nextCursor); 这一行判断.
int nextCursorIndex = calSlotIndex(nextCursor);
No branches or pull requests
在服务器启动时,类BufferPaddingExecutor构造函数对lastSecond进行初始化赋值,之后不再采用系统时间尽心校准,进而避免了时钟回调问题。我不太理解为什么要采用双buffer设计,既然lastSecond是稳定的lastSecond.incrementAndGet()进行递增,在每秒内的sequence(默认seqBits为13)也可以在0和8191间递增,那么此时采用双Buffer的意义是什么呢?
The text was updated successfully, but these errors were encountered: