RFR: 8060130: Simplify the synchronization of defining and getting java.lang.Package

Bernd Eckenfels ecki at zusammenkunft.net
Thu Oct 23 01:27:30 UTC 2014

Am Wed, 22 Oct 2014 14:56:59 -0700
schrieb Mandy Chung <mandy.chung at oracle.com>:
> I guess your question is related to my comment about two class loaders
> can define classes in a package of the same name (two different
> runtime packages).  ClassLoader.getPackage(s) assumes there is only
> one Package for each name in the class loader chain which seems wrong
> to me. Claes has filed a bug to track this:
>    https://bugs.openjdk.java.net/browse/JDK-8061804

Yes, I think thats the same, Mandy.

One option for solving that in a still performant (lockless on hot
path) way would be a "ConcurrentSet" of package names used for the
initial decision if the hierachy needs traversed (and why may define a
package). With a set of strings it would not keep the packages alive so
it can be global. Not sure if it would need a cleanup mechanism.. hmm.


More information about the core-libs-dev mailing list