Is a DelayQueue without fairness problematic?

删除回忆录丶 提交于 2019-12-11 02:16:36

问题


In Java 7 the implementation of DelayQueue uses a ReentrantLock without a fairness policy. Is this a problem in the long run? Can a thread starve because of this?

Thanks


回答1:


If you consider the ScheduledThreadPoolExecutor (or any other producer/consumer situation), the worker threads are independent and so should be the jobs in the DelayQueue. So, no: the order in which threads are allowed to take/poll does not make a difference.



来源:https://stackoverflow.com/questions/15604295/is-a-delayqueue-without-fairness-problematic

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!