in impl/src/main/java/org/apache/geronimo/config/DefaultConfigProvider.java [90:121]
public void releaseConfig(Config config) {
if (config == null) {
// get the config from the current TCCL
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
if (classLoader == null) {
classLoader = DefaultConfigProvider.class.getClassLoader();
}
config = existingConfig(classLoader);
}
if (config != null) {
synchronized (DefaultConfigProvider.class) {
Iterator<Map.Entry<ClassLoader, WeakReference<Config>>> it = configs.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<ClassLoader, WeakReference<Config>> entry = it.next();
if (entry.getValue().get() != null && entry.getValue().get() == config) {
it.remove();
break;
}
}
if (config instanceof AutoCloseable) {
try {
((AutoCloseable) config).close();
}
catch (Exception e) {
throw new RuntimeException("Error while closing Config", e);
}
}
}
}
}