This is an automated email from the ASF dual-hosted git repository.
albumenj pushed a commit to branch 3.2
in repository https://gitbox.apache.org/repos/asf/dubbo.git
The following commit(s) were added to refs/heads/3.2 by this push:
new 501bdfaaef Fix memory leak in ScopeBeanFactory (#13901)
501bdfaaef is described below
commit 501bdfaaef53c02ced2799c87ca64b9ecbd29507
Author: Albumen Kevin <[email protected]>
AuthorDate: Tue Mar 12 11:25:14 2024 +0800
Fix memory leak in ScopeBeanFactory (#13901)
---
.../org/apache/dubbo/common/beans/factory/ScopeBeanFactory.java | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git
a/dubbo-common/src/main/java/org/apache/dubbo/common/beans/factory/ScopeBeanFactory.java
b/dubbo-common/src/main/java/org/apache/dubbo/common/beans/factory/ScopeBeanFactory.java
index 0da12b3893..e57b501316 100644
---
a/dubbo-common/src/main/java/org/apache/dubbo/common/beans/factory/ScopeBeanFactory.java
+++
b/dubbo-common/src/main/java/org/apache/dubbo/common/beans/factory/ScopeBeanFactory.java
@@ -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;
}
}