Skip to content

Commit

Permalink
Fix memory leak in ScopeBeanFactory (#13901)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlbumenJ authored Mar 12, 2024
1 parent 36e0cf5 commit 501bdfa
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@
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;
Expand All @@ -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;
Expand Down Expand Up @@ -299,7 +301,7 @@ public BeanInfo(String name, Object instance) {
}
}

public List<Class<?>> getRegisteredClasses() {
public Set<Class<?>> getRegisteredClasses() {
return registeredClasses;
}
}

0 comments on commit 501bdfa

Please sign in to comment.