[concurrency-interest] PriorityQueue bug with mutable object
jim.andreou at gmail.com
Thu Jul 2 11:50:23 EDT 2009
How is this different than mutating keys of a HashMap? There is no way a
structure could find out just when an arbitrary memory update causes side
effects to some of its elements.
Java's PriorityQueue does have some shortcomings (it's very slow to change
an element's priority - i.e. through remove and re-add), but this is most
certainly not one of them.
2009/7/2 Manuel Dominguez Sarmiento <mads at renxo.com>
> 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.
> I am well aware of the perils of mutable objects, however PriorityQueue
> should account for mutability since priorities might change for a queued
> element at runtime, and it is not always practical to remove and discard the
> previous element and create a new object. This does not only affect mutable
> objects but also those whose priority is somehow based on
> System.currentTimeMillis() or other external data, which is what caused us
> to find this subtle bug.
> Ing. Manuel Dominguez Sarmiento
> Director General
> Renxo S.A.
> e-mail: mads at renxo.com
> Phone: +54 11 4719 6806, ext. 104
> Concurrency-interest mailing list
> Concurrency-interest at cs.oswego.edu
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Concurrency-interest