关于AbstractQueuedSynchronizer JavaDoc表述模糊的技术问询
我认为AbstractQueuedSynchronizer的JavaDoc中有两句表述模糊且易误导,特就此澄清相关问题:
第一句表述疑问
Even though this class is based on an internal FIFO queue, it does not automatically enforce FIFO acquisition policies.
这句话具体含义是什么?查阅此类源码(含多个标记为final的方法)后,我仅发现当tryAcquire返回true时可能不遵循FIFO,而当tryAcquire返回false、调用线程需park时,未找到可绕过FIFO的情况。若我的假设正确,文档是否应更清晰?
第二句表述疑问
Because checks in acquire are invoked before enqueuing, a newly acquiring thread may barge ahead of others that are blocked and queued. However, you can, if desired, define tryAcquire and/or tryAcquireShared to disable barging by internally invoking one or more of the inspection methods, thereby providing a fair FIFO acquisition order.
此处的barging具体指什么?是否仍指代获取线程无需park的场景?
个人理解与疑问
我的当前理解为:只要获取线程无需park,则可能采用非FIFO策略;若线程必须park,则会使用FIFO。
请问我的理解是否正确?是否有必要向Oracle提交BUG以修复文档?
内容的提问来源于stack exchange,提问作者Ciaccia

