Peter Firmstone <[email protected]> wrote:
A new implementation of TaskManager could take advantage of:

java.util.concurrent.PriorityBlockingQueue

However there is risk inherent in using Comparator, this could introduce
new bugs and may not be appropriate:

    "Caution should be exercised when using a comparator capable of
    imposing an ordering inconsistent with equals to order a sorted set
    (or sorted map). Suppose a sorted set (or sorted map) with an
    explicit comparator c is used with elements (or keys) drawn from a
    set S. If the ordering imposed by c on S is inconsistent with
    equals, the sorted set (or sorted map) will behave "strangely." In
    particular the sorted set (or sorted map) will violate the general
    contract for set (or map), which is defined in terms of equals."

I don't think this issue is relevant to PriorityBlockingQueue, which
explicitly permits elements with equal priority and only uses the
Comparator to establish priority order.

The problem is in classes such as TreeSet. According to the Set
interface, a TreeSet should not contain two equal elements. A TreeSet
created with a Comparator uses the Comparator for all its comparisons,
so it will never contain two items for which the compare method would
return 0. There could be two or more elements in the TreeSet that the
Comparator considers unequal but the equals methods consider equal.

...

If we are to refactor the classes in com.sun.jini.thread, I think we'd
need to refactor everything that relies on them too and this will take
some work.

If someone is willing to donate time, I'm certainly for such a refactoring.

I'm an experienced Java programmer looking for a useful and interesting
open source project, and River was one of the suggestions I've received.
Other than having used Subversion, I have no knowledge of Apache build,
test, and documentation conventions. I need a task where delays due to
my Apache learning curve are not going to delay any other work.

Do you think this refactoring would be a suitable task?

Patricia

Reply via email to