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
使用的是固定大小线程池,可是给线程池提交的任务的时候又特意控制并发,转为单线程。 我觉得没必要这样设置,直接使用一个线程就行了,或者不要控制并发,提高生成速度。
The text was updated successfully, but these errors were encountered:
确实用单线程就好了,这个就是强行使用多线程,二图的写法 是为了执行 ringBuffer.put(uid)的时候,保证uid有序的存到RingBuffer的slots属性里面,不这么写就不能保证客户端取出来的值是递增的
Sorry, something went wrong.
我也有同样的疑问,那这里的 sync 也就可以去掉了:
RingBuffer public synchronized boolean put(long uid) { }
No branches or pull requests
使用的是固定大小线程池,可是给线程池提交的任务的时候又特意控制并发,转为单线程。
我觉得没必要这样设置,直接使用一个线程就行了,或者不要控制并发,提高生成速度。
The text was updated successfully, but these errors were encountered: