Merge branch 'apache-3.1' into apache-3.2
# Conflicts: # dubbo-common/src/main/java/org/apache/dubbo/common/threadpool/manager/DefaultExecutorRepository.java
This commit is contained in:
commit
7ac9949b4c
|
|
@ -209,6 +209,8 @@ dependency:
|
|||
license: EPL-2.0
|
||||
- name: org.glassfish:jakarta.el
|
||||
license: EPL-2.0
|
||||
- name: org.jboss.spec.javax.annotation:jboss-annotations-api_1.2_spec
|
||||
license: CDDL-1.1
|
||||
- name: org.jboss.spec.javax.ws.rs:jboss-jaxrs-api_2.1_spec
|
||||
license: EPL-2.0
|
||||
- name: org.jboss.spec.javax.annotation:jboss-annotations-api_1.3_spec
|
||||
|
|
|
|||
|
|
@ -16,12 +16,6 @@
|
|||
*/
|
||||
package org.apache.dubbo.registry.client.metadata;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
import org.apache.dubbo.common.URL;
|
||||
import org.apache.dubbo.common.config.ConfigurationUtils;
|
||||
import org.apache.dubbo.common.config.configcenter.ConfigItem;
|
||||
|
|
@ -37,6 +31,12 @@ import org.apache.dubbo.metadata.report.MetadataReportInstance;
|
|||
import org.apache.dubbo.registry.client.RegistryClusterIdentifier;
|
||||
import org.apache.dubbo.rpc.model.ApplicationModel;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
import static org.apache.dubbo.common.constants.CommonConstants.COMMA_SEPARATOR;
|
||||
import static org.apache.dubbo.common.constants.CommonConstants.DEFAULT_KEY;
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.COMMON_PROPERTY_TYPE_MISMATCH;
|
||||
|
|
@ -92,17 +92,23 @@ public class MetadataServiceNameMapping extends AbstractServiceNameMapping {
|
|||
continue;
|
||||
}
|
||||
|
||||
boolean succeeded;
|
||||
boolean succeeded = false;
|
||||
int currentRetryTimes = 1;
|
||||
String newConfigContent = appName;
|
||||
do {
|
||||
ConfigItem configItem = metadataReport.getConfigItem(serviceInterface, DEFAULT_MAPPING_GROUP);
|
||||
String oldConfigContent = configItem.getContent();
|
||||
if (StringUtils.isNotEmpty(oldConfigContent)) {
|
||||
boolean contains = StringUtils.isContains(oldConfigContent, appName);
|
||||
if (contains) {
|
||||
// From the user's perspective, it means successful when the oldConfigContent has contained the current appName. So we should not throw an Exception to user, it will confuse the user.
|
||||
succeeded = true;
|
||||
String[] oldAppNames = oldConfigContent.split(",");
|
||||
if (oldAppNames.length > 0) {
|
||||
for (String oldAppName : oldAppNames) {
|
||||
if (oldAppName.equals(appName)) {
|
||||
succeeded = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (succeeded) {
|
||||
break;
|
||||
}
|
||||
newConfigContent = oldConfigContent + COMMA_SEPARATOR + appName;
|
||||
|
|
|
|||
|
|
@ -358,6 +358,7 @@ public class ReflectionPackableMethod implements PackableMethod {
|
|||
private final String serialize;
|
||||
private final MultipleSerialization multipleSerialization;
|
||||
private final String[] argumentsType;
|
||||
private final Class<?>[] actualRequestTypes;
|
||||
private final URL url;
|
||||
private final boolean singleArgument;
|
||||
|
||||
|
|
@ -369,6 +370,7 @@ public class ReflectionPackableMethod implements PackableMethod {
|
|||
this.url = url;
|
||||
this.serialize = convertHessianToWrapper(serialize);
|
||||
this.multipleSerialization = multipleSerialization;
|
||||
this.actualRequestTypes = actualRequestTypes;
|
||||
this.argumentsType = Stream.of(actualRequestTypes).map(Class::getName).toArray(String[]::new);
|
||||
this.singleArgument = singleArgument;
|
||||
}
|
||||
|
|
@ -386,9 +388,10 @@ public class ReflectionPackableMethod implements PackableMethod {
|
|||
for (String type : argumentsType) {
|
||||
builder.addArgTypes(type);
|
||||
}
|
||||
for (Object argument : arguments) {
|
||||
for (int i = 0; i < arguments.length; i++) {
|
||||
Object argument = arguments[i];
|
||||
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||
multipleSerialization.serialize(url, serialize, argument.getClass(), argument, bos);
|
||||
multipleSerialization.serialize(url, serialize, actualRequestTypes[i], argument, bos);
|
||||
builder.addArgs(bos.toByteArray());
|
||||
}
|
||||
return builder.build().toByteArray();
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ public abstract class AbstractServerCall implements ServerCall, ServerStream.Lis
|
|||
final byte[] data;
|
||||
try {
|
||||
data = packableMethod.packResponse(message);
|
||||
} catch (Throwable e) {
|
||||
} catch (Exception e) {
|
||||
close(TriRpcStatus.INTERNAL.withDescription("Serialize response failed")
|
||||
.withCause(e), null);
|
||||
LOGGER.error(PROTOCOL_FAILED_SERIALIZE_TRIPLE,"","",String.format("Serialize triple response failed, service=%s method=%s",
|
||||
|
|
@ -188,12 +188,12 @@ public abstract class AbstractServerCall implements ServerCall, ServerStream.Lis
|
|||
try {
|
||||
Object instance = parseSingleMessage(message);
|
||||
listener.onMessage(instance);
|
||||
} catch (Throwable t) {
|
||||
} catch (Exception e) {
|
||||
final TriRpcStatus status = TriRpcStatus.UNKNOWN.withDescription("Server error")
|
||||
.withCause(t);
|
||||
.withCause(e);
|
||||
close(status, null);
|
||||
LOGGER.error(PROTOCOL_FAILED_REQUEST,"","","Process request failed. service=" + serviceName +
|
||||
" method=" + methodName, t);
|
||||
" method=" + methodName, e);
|
||||
} finally {
|
||||
ClassLoadUtil.switchContextLoader(tccl);
|
||||
}
|
||||
|
|
@ -391,10 +391,10 @@ public abstract class AbstractServerCall implements ServerCall, ServerStream.Lis
|
|||
throw new IllegalStateException("Can not reach here");
|
||||
}
|
||||
return listener;
|
||||
} catch (Throwable t) {
|
||||
LOGGER.error(PROTOCOL_FAILED_CREATE_STREAM_TRIPLE, "", "", "Create triple stream failed", t);
|
||||
} catch (Exception e) {
|
||||
LOGGER.error(PROTOCOL_FAILED_CREATE_STREAM_TRIPLE, "", "", "Create triple stream failed", e);
|
||||
responseErr(TriRpcStatus.INTERNAL.withDescription("Create stream failed")
|
||||
.withCause(t));
|
||||
.withCause(e));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,8 +85,8 @@ public abstract class AbstractServerCallListener implements AbstractServerCall.L
|
|||
}
|
||||
onReturn(r.getValue());
|
||||
});
|
||||
} catch (Throwable t) {
|
||||
responseObserver.onError(t);
|
||||
} catch (Exception e) {
|
||||
responseObserver.onError(e);
|
||||
} finally {
|
||||
RpcContext.removeCancellationContext();
|
||||
RpcContext.removeContext();
|
||||
|
|
|
|||
Loading…
Reference in New Issue