You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by al...@apache.org on 2024/03/29 03:15:01 UTC
(dubbo) branch 3.3 updated: Remove url ref in native scenario (#14006)
This is an automated email from the ASF dual-hosted git repository.
albumenj pushed a commit to branch 3.3
in repository https://gitbox.apache.org/repos/asf/dubbo.git
The following commit(s) were added to refs/heads/3.3 by this push:
new a12975aa93 Remove url ref in native scenario (#14006)
a12975aa93 is described below
commit a12975aa93d42a18d308422fddb23b3dc1e8fd9f
Author: huazhongming <cr...@gmail.com>
AuthorDate: Fri Mar 29 11:14:56 2024 +0800
Remove url ref in native scenario (#14006)
Signed-off-by: crazyhzm <cr...@gmail.com>
---
.../dubbo/common/utils/ClassLoaderResourceLoader.java | 18 ------------------
1 file changed, 18 deletions(-)
diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/utils/ClassLoaderResourceLoader.java b/dubbo-common/src/main/java/org/apache/dubbo/common/utils/ClassLoaderResourceLoader.java
index 8c743c214f..c62966fc44 100644
--- a/dubbo-common/src/main/java/org/apache/dubbo/common/utils/ClassLoaderResourceLoader.java
+++ b/dubbo-common/src/main/java/org/apache/dubbo/common/utils/ClassLoaderResourceLoader.java
@@ -16,14 +16,12 @@
*/
package org.apache.dubbo.common.utils;
-import org.apache.dubbo.common.aot.NativeDetector;
import org.apache.dubbo.common.logger.ErrorTypeAwareLogger;
import org.apache.dubbo.common.logger.LoggerFactory;
import org.apache.dubbo.common.resource.GlobalResourcesRepository;
import java.io.IOException;
import java.lang.ref.SoftReference;
-import java.lang.reflect.Field;
import java.net.URL;
import java.util.Collection;
import java.util.Collections;
@@ -32,7 +30,6 @@ import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
-import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CountDownLatch;
@@ -81,15 +78,9 @@ public class ClassLoaderResourceLoader {
Enumeration<URL> urls;
try {
urls = currentClassLoader.getResources(fileName);
- boolean isNative = NativeDetector.inNativeImage();
if (urls != null) {
while (urls.hasMoreElements()) {
URL url = urls.nextElement();
- if (isNative) {
- // In native mode, the address of each URL is the same instead of different paths, so it is
- // necessary to set the ref to make it different
- setRef(url);
- }
set.add(url);
}
}
@@ -113,15 +104,6 @@ public class ClassLoaderResourceLoader {
}
}
- private static void setRef(URL url) {
- try {
- Field field = URL.class.getDeclaredField("ref");
- field.setAccessible(true);
- field.set(url, UUID.randomUUID().toString());
- } catch (Throwable ignore) {
- }
- }
-
// for test
protected static SoftReference<Map<ClassLoader, Map<String, Set<URL>>>> getClassLoaderResourcesCache() {
return classLoaderResourcesCache;