[concurrency-interest] PriorityQueue bug with mutable object

Holger Hoffstätte holger.hoffstaette at googlemail.com
Thu Jul 2 11:54:11 EDT 2009


Manuel Dominguez Sarmiento wrote:
> I recently filed the following bug at Sun's bug database:
> 
> http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6856821

The behaviour is neither subtle nor a bug, and IMHO cannot be changed
because the problem you're trying to fix is inherently unsolvable. Taking
your suggestion to its logical conclusion would mean that an arbitrary
number of mutable objects may never be processed because their aggregate
rate of state (priority) change could be so high that the queue would end
up never dequeing anything, only re-sorting.
Apart from this academic showstopper there's the small issue of state
changes during reordering or comparison. Good luck handling that correctly :)

-h


More information about the Concurrency-interest mailing list