Fix memory leak in ScopeBeanFactory (#13901)

This commit is contained in:
Albumen Kevin 2024-03-12 11:25:14 +08:00 committed by GitHub
parent 36e0cf5490
commit 501bdfaaef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 2 deletions

View File

@ -25,11 +25,13 @@ import org.apache.dubbo.common.logger.ErrorTypeAwareLogger;
import org.apache.dubbo.common.logger.LoggerFactory;
import org.apache.dubbo.common.resource.Disposable;
import org.apache.dubbo.common.utils.ConcurrentHashMapUtils;
import org.apache.dubbo.common.utils.ConcurrentHashSet;
import org.apache.dubbo.common.utils.StringUtils;
import org.apache.dubbo.rpc.model.ScopeModelAccessor;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.atomic.AtomicBoolean;
@ -53,7 +55,7 @@ public class ScopeBeanFactory {
private final List<BeanInfo> registeredBeanInfos = new CopyOnWriteArrayList<>();
private InstantiationStrategy instantiationStrategy;
private final AtomicBoolean destroyed = new AtomicBoolean();
private List<Class<?>> registeredClasses = new ArrayList<>();
private final Set<Class<?>> registeredClasses = new ConcurrentHashSet<>();
public ScopeBeanFactory(ScopeBeanFactory parent, ExtensionAccessor extensionAccessor) {
this.parent = parent;
@ -299,7 +301,7 @@ public class ScopeBeanFactory {
}
}
public List<Class<?>> getRegisteredClasses() {
public Set<Class<?>> getRegisteredClasses() {
return registeredClasses;
}
}