Skip to content

Commit

Permalink
fix conflict. apache#3932
Browse files Browse the repository at this point in the history
  • Loading branch information
cvictory committed May 7, 2019
2 parents a038714 + 392fcbf commit 064d7df
Show file tree
Hide file tree
Showing 149 changed files with 10,313 additions and 763 deletions.
40 changes: 40 additions & 0 deletions dubbo-all/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,13 @@
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-rpc-native-thrift</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-rpc-memcached</artifactId>
Expand Down Expand Up @@ -254,6 +261,20 @@
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-registry-nacos</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-registry-sofa</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-monitor-api</artifactId>
Expand Down Expand Up @@ -324,6 +345,13 @@
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-serialization-native-hession</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-serialization-jdk</artifactId>
Expand Down Expand Up @@ -436,6 +464,13 @@
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-metadata-report-etcd</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>

<!-- Transitive dependencies -->
<dependency>
Expand Down Expand Up @@ -530,6 +565,8 @@
<include>org.apache.dubbo:dubbo-registry-redis</include>
<include>org.apache.dubbo:dubbo-registry-consul</include>
<include>org.apache.dubbo:dubbo-registry-etcd3</include>
<include>org.apache.dubbo:dubbo-registry-nacos</include>
<include>org.apache.dubbo:dubbo-registry-sofa</include>
<include>org.apache.dubbo:dubbo-monitor-api</include>
<include>org.apache.dubbo:dubbo-monitor-default</include>
<include>org.apache.dubbo:dubbo-config-api</include>
Expand Down Expand Up @@ -559,6 +596,9 @@
<include>org.apache.dubbo:dubbo-metadata-report-redis</include>
<include>org.apache.dubbo:dubbo-metadata-report-zookeeper</include>
<include>org.apache.dubbo:dubbo-metadata-report-consul</include>
<include>org.apache.dubbo:dubbo-metadata-report-etcd</include>
<include>org.apache.dubbo:dubbo-serialization-native-hession</include>
<include>org.apache.dubbo:dubbo-rpc-native-thrift</include>
</includes>
</artifactSet>
<transformers>
Expand Down
20 changes: 20 additions & 0 deletions dubbo-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,11 @@
<artifactId>dubbo-rpc-thrift</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-rpc-native-thrift</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-rpc-memcached</artifactId>
Expand Down Expand Up @@ -252,6 +257,11 @@
<artifactId>dubbo-registry-consul</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-registry-sofa</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-monitor-api</artifactId>
Expand Down Expand Up @@ -302,6 +312,11 @@
<artifactId>dubbo-serialization-hessian2</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-serialization-native-hession</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-serialization-jdk</artifactId>
Expand Down Expand Up @@ -352,6 +367,11 @@
<artifactId>dubbo-metadata-report-consul</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-metadata-report-etcd</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-configcenter-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
import org.apache.dubbo.rpc.Invocation;
import org.apache.dubbo.rpc.Invoker;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.stream.Collectors;

/**
Expand Down Expand Up @@ -63,7 +63,7 @@ private RouterChain(URL url) {
*/
public void initWithRouters(List<Router> builtinRouters) {
this.builtinRouters = builtinRouters;
this.routers = new CopyOnWriteArrayList<>(builtinRouters);
this.routers = new ArrayList<>(builtinRouters);
this.sort();
}

Expand All @@ -76,10 +76,10 @@ public void initWithRouters(List<Router> builtinRouters) {
* @param routers routers from 'router://' rules in 2.6.x or before.
*/
public void addRouters(List<Router> routers) {
List<Router> newRouters = new CopyOnWriteArrayList<>();
List<Router> newRouters = new ArrayList<>();
newRouters.addAll(builtinRouters);
newRouters.addAll(routers);
CollectionUtils.sort(routers);
CollectionUtils.sort(newRouters);
this.routers = newRouters;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

public class MergerFactory {

private static final ConcurrentMap<Class<?>, Merger<?>> mergerCache =
private static final ConcurrentMap<Class<?>, Merger<?>> MERGER_CACHE =
new ConcurrentHashMap<Class<?>, Merger<?>>();

/**
Expand All @@ -46,19 +46,19 @@ public static <T> Merger<T> getMerger(Class<T> returnType) {
Merger result;
if (returnType.isArray()) {
Class type = returnType.getComponentType();
result = mergerCache.get(type);
result = MERGER_CACHE.get(type);
if (result == null) {
loadMergers();
result = mergerCache.get(type);
result = MERGER_CACHE.get(type);
}
if (result == null && !type.isPrimitive()) {
result = ArrayMerger.INSTANCE;
}
} else {
result = mergerCache.get(returnType);
result = MERGER_CACHE.get(returnType);
if (result == null) {
loadMergers();
result = mergerCache.get(returnType);
result = MERGER_CACHE.get(returnType);
}
}
return result;
Expand All @@ -69,7 +69,7 @@ static void loadMergers() {
.getSupportedExtensions();
for (String name : names) {
Merger m = ExtensionLoader.getExtensionLoader(Merger.class).getExtension(name);
mergerCache.putIfAbsent(ReflectUtils.getGenericClass(m.getClass()), m);
MERGER_CACHE.putIfAbsent(ReflectUtils.getGenericClass(m.getClass()), m);
}
}

Expand Down
14 changes: 14 additions & 0 deletions dubbo-common/src/main/java/org/apache/dubbo/common/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -875,4 +875,18 @@ public class Constants {
public static final String METRICS_PROTOCOL = "metrics.protocol";


/**
* Serizlization ContentTypeId
*/
public static final byte HESSIAN2_SERIALIZATION_ID = 2;
public static final byte JAVA_SERIALIZATION_ID = 3;
public static final byte COMPACTED_JAVA_SERIALIZATION_ID = 4;
public static final byte FASTJSON_SERIALIZATION_ID = 6;
public static final byte NATIVE_JAVA_SERIALIZATION_ID = 7;
public static final byte KRYO_SERIALIZATION_ID = 8;
public static final byte FST_SERIALIZATION_ID = 9;
public static final byte PROTOSTUFF_SERIALIZATION_ID = 10;
public static final byte AVRO_SERIALIZATION_ID = 11;
public static final byte GSON_SERIALIZATION_ID = 16;

}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import org.apache.dubbo.common.logger.Logger;
import org.apache.dubbo.common.logger.LoggerFactory;
import org.apache.dubbo.common.utils.ClassHelper;
import org.apache.dubbo.common.utils.ClassUtils;
import org.apache.dubbo.common.utils.StringUtils;

import java.io.IOException;
Expand Down Expand Up @@ -240,7 +240,7 @@ public static void checkDuplicate(String path, boolean failOnError) {
* search resources in caller's classloader
*/
private static Set<String> getResources(String path) throws IOException {
Enumeration<URL> urls = ClassHelper.getCallerClassLoader(Version.class).getResources(path);
Enumeration<URL> urls = ClassUtils.getCallerClassLoader(Version.class).getResources(path);
Set<String> files = new HashSet<String>();
while (urls.hasMoreElements()) {
URL url = urls.nextElement();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@
*/
package org.apache.dubbo.common.bytecode;

import org.apache.dubbo.common.utils.ArrayUtils;
import org.apache.dubbo.common.utils.ClassHelper;
import org.apache.dubbo.common.utils.ReflectUtils;

import javassist.CannotCompileException;
import javassist.ClassPool;
import javassist.CtClass;
Expand All @@ -30,6 +26,9 @@
import javassist.CtNewMethod;
import javassist.LoaderClassPath;
import javassist.NotFoundException;
import org.apache.dubbo.common.utils.ArrayUtils;
import org.apache.dubbo.common.utils.ClassUtils;
import org.apache.dubbo.common.utils.ReflectUtils;
import org.apache.dubbo.common.utils.StringUtils;

import java.lang.reflect.Constructor;
Expand Down Expand Up @@ -285,7 +284,7 @@ public ClassPool getClassPool() {
}

public Class<?> toClass() {
return toClass(ClassHelper.getClassLoader(ClassGenerator.class),
return toClass(ClassUtils.getClassLoader(ClassGenerator.class),
getClass().getProtectionDomain());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
package org.apache.dubbo.common.bytecode;

import org.apache.dubbo.common.utils.ClassHelper;
import org.apache.dubbo.common.utils.ClassUtils;
import org.apache.dubbo.common.utils.ReflectUtils;

import java.lang.reflect.Method;
Expand Down Expand Up @@ -69,7 +69,7 @@ public static Mixin mixin(Class<?>[] ics, Class<?> dc, ClassLoader cl) {
* @return Mixin instance.
*/
public static Mixin mixin(Class<?>[] ics, Class<?>[] dcs) {
return mixin(ics, dcs, ClassHelper.getCallerClassLoader(Mixin.class));
return mixin(ics, dcs, ClassUtils.getCallerClassLoader(Mixin.class));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
package org.apache.dubbo.common.bytecode;

import org.apache.dubbo.common.Constants;
import org.apache.dubbo.common.utils.ClassHelper;
import org.apache.dubbo.common.utils.ClassUtils;
import org.apache.dubbo.common.utils.ReflectUtils;

import java.lang.ref.Reference;
Expand Down Expand Up @@ -48,9 +48,9 @@ public Object invoke(Object proxy, Method method, Object[] args) {
};
private static final AtomicLong PROXY_CLASS_COUNTER = new AtomicLong(0);
private static final String PACKAGE_NAME = Proxy.class.getPackage().getName();
private static final Map<ClassLoader, Map<String, Object>> ProxyCacheMap = new WeakHashMap<ClassLoader, Map<String, Object>>();
private static final Map<ClassLoader, Map<String, Object>> PROXY_CACHE_MAP = new WeakHashMap<ClassLoader, Map<String, Object>>();

private static final Object PendingGenerationMarker = new Object();
private static final Object PENDING_GENERATION_MARKER = new Object();

protected Proxy() {
}
Expand All @@ -62,7 +62,7 @@ protected Proxy() {
* @return Proxy instance.
*/
public static Proxy getProxy(Class<?>... ics) {
return getProxy(ClassHelper.getClassLoader(Proxy.class), ics);
return getProxy(ClassUtils.getClassLoader(Proxy.class), ics);
}

/**
Expand Down Expand Up @@ -102,8 +102,8 @@ public static Proxy getProxy(ClassLoader cl, Class<?>... ics) {

// get cache by class loader.
Map<String, Object> cache;
synchronized (ProxyCacheMap) {
cache = ProxyCacheMap.computeIfAbsent(cl, k -> new HashMap<>());
synchronized (PROXY_CACHE_MAP) {
cache = PROXY_CACHE_MAP.computeIfAbsent(cl, k -> new HashMap<>());
}

Proxy proxy = null;
Expand All @@ -117,13 +117,13 @@ public static Proxy getProxy(ClassLoader cl, Class<?>... ics) {
}
}

if (value == PendingGenerationMarker) {
if (value == PENDING_GENERATION_MARKER) {
try {
cache.wait();
} catch (InterruptedException e) {
}
} else {
cache.put(key, PendingGenerationMarker);
cache.put(key, PENDING_GENERATION_MARKER);
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
package org.apache.dubbo.common.bytecode;

import org.apache.dubbo.common.utils.ClassHelper;
import org.apache.dubbo.common.utils.ClassUtils;
import org.apache.dubbo.common.utils.ReflectUtils;

import java.lang.reflect.Field;
Expand Down Expand Up @@ -127,7 +127,7 @@ private static Wrapper makeWrapper(Class<?> c) {
}

String name = c.getName();
ClassLoader cl = ClassHelper.getClassLoader(c);
ClassLoader cl = ClassUtils.getClassLoader(c);

StringBuilder c1 = new StringBuilder("public void setPropertyValue(Object o, String n, Object v){ ");
StringBuilder c2 = new StringBuilder("public Object getPropertyValue(Object o, String n){ ");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package org.apache.dubbo.common.compiler.support;

import org.apache.dubbo.common.compiler.Compiler;
import org.apache.dubbo.common.utils.ClassHelper;

import java.util.regex.Matcher;
import java.util.regex.Pattern;
Expand Down Expand Up @@ -50,7 +49,7 @@ public Class<?> compile(String code, ClassLoader classLoader) {
}
String className = pkg != null && pkg.length() > 0 ? pkg + "." + cls : cls;
try {
return Class.forName(className, true, ClassHelper.getCallerClassLoader(getClass()));
return Class.forName(className, true, org.apache.dubbo.common.utils.ClassUtils.getCallerClassLoader(getClass()));
} catch (ClassNotFoundException e) {
if (!code.endsWith("}")) {
throw new IllegalStateException("The java code not endsWith \"}\", code: \n" + code + "\n");
Expand Down
Loading

0 comments on commit 064d7df

Please sign in to comment.