Peter Firmstone wrote:
Patricia Shanahan wrote:
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.
...
Good point, well reasoned.
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.
You've definitely come to the right place, we have some interesting
fundamental issues, ripe for picking.
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
Yes certainly, don't be afraid to dive in, welcome to Apache River.
To run some of the tests you'll need to download and install jtreg.
http://openjdk.java.net/jtreg/
Once you've downloaded the source from svn, you can build it using:
Apache River that is.
$ ant all.build
To run the qa test suite:
$ ant qa.run
To run the jtreg regression test suite:
cd to the qa directory, then
$ ant jtreg
You'll need JDK 1.6 to build and run the qa test suite and JDK 1.5 for
the jtreg tests.
Peter.