On 12/11/2012 02:12 AM, Peter Levart wrote:
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
ConcurrentHashMap<>();

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

Sure, but having this map puts me back in the same situation I was in before where we have another concurrent map with a key per class.

--
- DML

Reply via email to