Proposal: Fully Concurrent ClassLoading

Peter Levart peter.levart at
Tue Dec 11 08:12:24 UTC 2012

On 12/11/2012 04:41 AM, David M. Lloyd wrote:
> On JDK 8 with your patches, we are loading around 4750 classes and 
> there are, as expected, 0 define races (I believe, however, that we're 
> getting a false count though whenever defineClass() returns an 
> already-defined class - it would be nice if there were *some* way to 
> detect that this happened). 

Hi David,

You could, of course this would have a minor impact on the whole thing, 
in your custom ClassLoader, have an instance of:

final ConcurrentMap<Class<?>, Boolean> foundClasses = new 

protected Class<?> findClass(String name) throws ClassNotFoundException {
   if (foundClasses.putIfAbsent(clazz, Boolean.TRUE) != null)
   return clazz;

Regards, Peter

More information about the core-libs-dev mailing list