}
}
// unload everything that JAI ImageIO can still refer to
// We need to store them and unregister later to avoid concurrent modification exceptions
final IIORegistry ioRegistry = IIORegistry.getDefaultInstance();
Set<IIOServiceProvider> providersToUnload = new HashSet();
for(Iterator<Class<?>> cats = ioRegistry.getCategories(); cats.hasNext(); ) {
Class<?> category = cats.next();
for (Iterator it = ioRegistry.getServiceProviders(category, false); it.hasNext();) {
final IIOServiceProvider provider = (IIOServiceProvider) it.next();
if(webappClassLoader.equals(provider.getClass().getClassLoader())) {
providersToUnload.add(provider);
}
}
}
for (IIOServiceProvider provider : providersToUnload) {
ioRegistry.deregisterServiceProvider(provider);
LOGGER.info("Unregistering Image I/O provider " + provider);
}
// unload everything that JAI can still refer to
final OperationRegistry opRegistry = JAI.getDefaultInstance().getOperationRegistry();