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;
}


Regards, Peter

Reply via email to