سؤال

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

هل كانت مفيدة؟

المحلول

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top