--- old/src/hotspot/share/classfile/classLoaderData.cpp 2018-05-21 18:19:28.810591024 -0400 +++ new/src/hotspot/share/classfile/classLoaderData.cpp 2018-05-21 18:19:28.460558675 -0400 @@ -573,9 +573,6 @@ void ClassLoaderData::unload() { _unloading = true; - // Tell serviceability tools these classes are unloading - classes_do(InstanceKlass::notify_unload_class); - LogTarget(Debug, class, loader, data) lt; if (lt.is_enabled()) { ResourceMark rm; @@ -589,6 +586,10 @@ // if they are not already on the _klasses list. unload_deallocate_list(); + // Tell serviceability tools these classes are unloading + // after erroreous classes are released. + classes_do(InstanceKlass::notify_unload_class); + // Clean up global class iterator for compiler static_klass_iterator.adjust_saved_class(this); }