[concurrency-interest] PriorityQueue bug with mutable object
mthornton at optrak.co.uk
Thu Jul 2 11:50:41 EDT 2009
Manuel Dominguez Sarmiento wrote:
> Hi Doug,
> I recently filed the following bug at Sun's bug database:
> You might want to look into it since this class is used by many
> concurrent classes and you're listed as one of its authors.
That is not a bug --- the behaviour is as expected. TreeSet likewise
does not work if the ordering of elements changes after insertion. Nor
do any of the Map's work if the keys are mutable. Priority queues which
allow the priority to change have an extra method to perform this
mutation --- i.e. you have to explicitly inform the queue of each
element whose priority is changing.
More information about the Concurrency-interest