Merge branch 'apache-3.1' into apache-3.2
# Conflicts: # dubbo-common/src/main/java/org/apache/dubbo/common/constants/LoggerCodeConstants.java # dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/ServiceDiscoveryRegistry.java # dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/event/listener/ServiceInstancesChangedListener.java # dubbo-rpc/dubbo-rpc-api/src/main/resources/META-INF/dubbo/internal/org.apache.dubbo.rpc.Filter
This commit is contained in:
commit
0e4997b252
|
|
@ -330,12 +330,14 @@ jobs:
|
|||
./mvnw --batch-mode --no-snapshot-updates -e --no-transfer-progress --fail-fast -T 2C clean install -DskipTests=true -DskipIntegrationTests=true -Dcheckstyle.skip=true -Dcheckstyle_unix.skip=true -Drat.skip=true -Dmaven.javadoc.skip=true
|
||||
- name: "Run Error Code Inspecting"
|
||||
env:
|
||||
"dubbo.eci.report-as-error": false
|
||||
DUBBO_ECI_REPORT_AS_ERROR: true
|
||||
run: |
|
||||
cd ${{ github.workspace }}/dubbo-test-tools/dubbo-error-code-inspector
|
||||
../mvnw --batch-mode --no-snapshot-updates -e --no-transfer-progress --fail-fast -T 2C package exec:java -Dmaven.test.skip=true -Dmaven.test.skip.exec=true -Ddubbo.eci.path=${{ github.workspace }}/dubbo
|
||||
../mvnw --batch-mode --no-snapshot-updates -e --no-transfer-progress --fail-fast -T 2C package exec:java -Ddubbo.eci.report-as-error=${DUBBO_ECI_REPORT_AS_ERROR} -Dmaven.test.skip=true -Dmaven.test.skip.exec=true -Ddubbo.eci.path=${{ github.workspace }}/dubbo
|
||||
|
||||
- name: "Upload error code inspection result"
|
||||
# always() should not be used here, since we don't need to handle the 'canceled' situation.
|
||||
if: ${{ success() || failure() }}
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: "error-inspection-result"
|
||||
|
|
|
|||
|
|
@ -351,12 +351,14 @@ jobs:
|
|||
./mvnw --batch-mode --no-snapshot-updates -e --no-transfer-progress --fail-fast -T 2C clean install -DskipTests=true -DskipIntegrationTests=true -Dcheckstyle.skip=true -Dcheckstyle_unix.skip=true -Drat.skip=true -Dmaven.javadoc.skip=true
|
||||
- name: "Run Error Code Inspecting"
|
||||
env:
|
||||
"dubbo.eci.report-as-error": false
|
||||
DUBBO_ECI_REPORT_AS_ERROR: true
|
||||
run: |
|
||||
cd ${{ github.workspace }}/dubbo-test-tools/dubbo-error-code-inspector
|
||||
../mvnw --batch-mode --no-snapshot-updates -e --no-transfer-progress --fail-fast -T 2C package exec:java -Dmaven.test.skip=true -Dmaven.test.skip.exec=true -Ddubbo.eci.path=${{ github.workspace }}/dubbo
|
||||
../mvnw --batch-mode --no-snapshot-updates -e --no-transfer-progress --fail-fast -T 2C package exec:java -Ddubbo.eci.report-as-error=${DUBBO_ECI_REPORT_AS_ERROR} -Dmaven.test.skip=true -Dmaven.test.skip.exec=true -Ddubbo.eci.path=${{ github.workspace }}/dubbo
|
||||
|
||||
- name: "Upload error code inspection result"
|
||||
# always() should not be used here, since we don't need to handle the 'canceled' situation.
|
||||
if: ${{ success() || failure() }}
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: "error-inspection-result"
|
||||
|
|
|
|||
|
|
@ -350,12 +350,14 @@ jobs:
|
|||
./mvnw --batch-mode --no-snapshot-updates -e --no-transfer-progress --fail-fast -T 2C clean install -DskipTests=true -DskipIntegrationTests=true -Dcheckstyle.skip=true -Dcheckstyle_unix.skip=true -Drat.skip=true -Dmaven.javadoc.skip=true
|
||||
- name: "Run Error Code Inspecting"
|
||||
env:
|
||||
"dubbo.eci.report-as-error": false
|
||||
DUBBO_ECI_REPORT_AS_ERROR: true
|
||||
run: |
|
||||
cd ${{ github.workspace }}/dubbo-test-tools/dubbo-error-code-inspector
|
||||
../mvnw --batch-mode --no-snapshot-updates -e --no-transfer-progress --fail-fast -T 2C package exec:java -Dmaven.test.skip=true -Dmaven.test.skip.exec=true -Ddubbo.eci.path=${{ github.workspace }}/dubbo
|
||||
../mvnw --batch-mode --no-snapshot-updates -e --no-transfer-progress --fail-fast -T 2C package exec:java -Ddubbo.eci.report-as-error=${DUBBO_ECI_REPORT_AS_ERROR} -Dmaven.test.skip=true -Dmaven.test.skip.exec=true -Ddubbo.eci.path=${{ github.workspace }}/dubbo
|
||||
|
||||
- name: "Upload error code inspection result"
|
||||
# always() should not be used here, since we don't need to handle the 'canceled' situation.
|
||||
if: ${{ success() || failure() }}
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: "error-inspection-result"
|
||||
|
|
|
|||
|
|
@ -332,12 +332,14 @@ jobs:
|
|||
./mvnw --batch-mode --no-snapshot-updates -e --no-transfer-progress --fail-fast -T 2C clean install -DskipTests=true -DskipIntegrationTests=true -Dcheckstyle.skip=true -Dcheckstyle_unix.skip=true -Drat.skip=true -Dmaven.javadoc.skip=true
|
||||
- name: "Run Error Code Inspecting"
|
||||
env:
|
||||
"dubbo.eci.report-as-error": false
|
||||
DUBBO_ECI_REPORT_AS_ERROR: true
|
||||
run: |
|
||||
cd ${{ github.workspace }}/dubbo-test-tools/dubbo-error-code-inspector
|
||||
../mvnw --batch-mode --no-snapshot-updates -e --no-transfer-progress --fail-fast -T 2C package exec:java -Dmaven.test.skip=true -Dmaven.test.skip.exec=true -Ddubbo.eci.path=${{ github.workspace }}/dubbo
|
||||
../mvnw --batch-mode --no-snapshot-updates -e --no-transfer-progress --fail-fast -T 2C package exec:java -Ddubbo.eci.report-as-error=${DUBBO_ECI_REPORT_AS_ERROR} -Dmaven.test.skip=true -Dmaven.test.skip.exec=true -Ddubbo.eci.path=${{ github.workspace }}/dubbo
|
||||
|
||||
- name: "Upload error code inspection result"
|
||||
# always() should not be used here, since we don't need to handle the 'canceled' situation.
|
||||
if: ${{ success() || failure() }}
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: "error-inspection-result"
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import java.util.Set;
|
|||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.REGISTRY_UNEXPECTED_EXCEPTION;
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.INTERNAL_ERROR;
|
||||
|
||||
/**
|
||||
* support multiple config center, simply iterating each concrete config center.
|
||||
|
|
@ -92,7 +92,7 @@ public class CompositeDynamicConfiguration implements DynamicConfiguration {
|
|||
try {
|
||||
configuration.close();
|
||||
} catch (Exception e) {
|
||||
logger.warn(REGISTRY_UNEXPECTED_EXCEPTION, "", "", "close dynamic configuration " + configuration.getClass().getName() + "failed: " + e.getMessage(), e);
|
||||
logger.warn(INTERNAL_ERROR, "unknown error in configuration-center related code in common module", "", "close dynamic configuration " + configuration.getClass().getName() + "failed: " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
configurations.clear();
|
||||
|
|
|
|||
|
|
@ -18,11 +18,11 @@
|
|||
package org.apache.dubbo.common.constants;
|
||||
|
||||
/**
|
||||
* constants for logger
|
||||
* Constants of Error codes used in logger.
|
||||
*/
|
||||
public interface LoggerCodeConstants {
|
||||
|
||||
// common module
|
||||
// Common module
|
||||
String COMMON_THREAD_POOL_EXHAUSTED = "0-1";
|
||||
|
||||
String COMMON_PROPERTY_TYPE_MISMATCH = "0-2";
|
||||
|
|
@ -77,9 +77,13 @@ public interface LoggerCodeConstants {
|
|||
|
||||
String COMMON_ISOLATED_EXECUTOR_CONFIGURATION_ERROR = "0-27";
|
||||
|
||||
// registry module
|
||||
// Registry module
|
||||
|
||||
String REGISTRY_ADDRESS_INVALID = "1-1";
|
||||
|
||||
/**
|
||||
* Absent. Merged with 0-2.
|
||||
*/
|
||||
String REGISTRY_ABSENCE = "1-2";
|
||||
|
||||
String REGISTRY_FAILED_URL_EVICTING = "1-3";
|
||||
|
|
@ -148,6 +152,9 @@ public interface LoggerCodeConstants {
|
|||
|
||||
String REGISTRY_ZOOKEEPER_EXCEPTION = "1-35";
|
||||
|
||||
/**
|
||||
* Absent. Merged with 99-0.
|
||||
*/
|
||||
String REGISTRY_UNEXPECTED_EXCEPTION = "1-36";
|
||||
|
||||
String REGISTRY_NACOS_EXCEPTION = "1-37";
|
||||
|
|
@ -201,7 +208,7 @@ public interface LoggerCodeConstants {
|
|||
|
||||
String CLUSTER_FAILED_GROUP_MERGE = "2-20";
|
||||
|
||||
// proxy module 3-1
|
||||
// Proxy module. 3-1
|
||||
String PROXY_FAILED_CONVERT_URL = "3-1";
|
||||
|
||||
String PROXY_FAILED_EXPORT_SERVICE = "3-2";
|
||||
|
|
@ -218,7 +225,7 @@ public interface LoggerCodeConstants {
|
|||
|
||||
String PROXY_FAILED = "3-8";
|
||||
|
||||
// protocol module
|
||||
// Protocol module.
|
||||
String PROTOCOL_UNSUPPORTED = "4-1";
|
||||
|
||||
String PROTOCOL_FAILED_INIT_SERIALIZATION_OPTIMIZER = "4-2";
|
||||
|
|
@ -389,6 +396,10 @@ public interface LoggerCodeConstants {
|
|||
String QOS_PERMISSION_DENY_EXCEPTION = "7-7";
|
||||
|
||||
// Internal unknown error.
|
||||
|
||||
/**
|
||||
* Unknown internal error. (99-0)
|
||||
*/
|
||||
String INTERNAL_ERROR = "99-0";
|
||||
|
||||
String INTERNAL_INTERRUPTED = "99-1";
|
||||
|
|
|
|||
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.dubbo.common.model.person;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class PersonMap extends HashMap<String, String> {
|
||||
|
||||
private static final String ID = "1";
|
||||
private static final String NAME = "hand";
|
||||
|
||||
String personId;
|
||||
String personName;
|
||||
|
||||
public String getPersonId() {
|
||||
return get(ID);
|
||||
}
|
||||
|
||||
public void setPersonId(String personId) {
|
||||
this.personId = personId;
|
||||
}
|
||||
|
||||
public String getPersonName() {
|
||||
return get(NAME);
|
||||
}
|
||||
|
||||
public void setPersonName(String personName) {
|
||||
this.personName = personName;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -22,6 +22,7 @@ import org.apache.dubbo.common.model.User;
|
|||
import org.apache.dubbo.common.model.person.BigPerson;
|
||||
import org.apache.dubbo.common.model.person.FullAddress;
|
||||
import org.apache.dubbo.common.model.person.PersonInfo;
|
||||
import org.apache.dubbo.common.model.person.PersonMap;
|
||||
import org.apache.dubbo.common.model.person.PersonStatus;
|
||||
import org.apache.dubbo.common.model.person.Phone;
|
||||
|
||||
|
|
@ -765,7 +766,7 @@ class PojoUtilsTest {
|
|||
|
||||
@Test
|
||||
void testJava8Time() {
|
||||
|
||||
|
||||
Object localDateTimeGen = PojoUtils.generalize(LocalDateTime.now());
|
||||
Object localDateTime = PojoUtils.realize(localDateTimeGen, LocalDateTime.class);
|
||||
assertEquals(localDateTimeGen, localDateTime.toString());
|
||||
|
|
@ -779,6 +780,15 @@ class PojoUtilsTest {
|
|||
assertEquals(localTimeGen, localTime.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testJSONObjectToPersonMapPojo() {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("personId", "1");
|
||||
jsonObject.put("personName", "hand");
|
||||
Object result = PojoUtils.realize(jsonObject, PersonMap.class);
|
||||
assertEquals(PersonMap.class, result.getClass());
|
||||
}
|
||||
|
||||
public enum Day {
|
||||
SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ import org.springframework.beans.factory.InitializingBean;
|
|||
import org.springframework.beans.factory.annotation.AnnotatedBeanDefinition;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
||||
import org.springframework.beans.factory.support.DefaultSingletonBeanRegistry;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
|
||||
|
|
@ -343,7 +344,12 @@ public class ReferenceBean<T> implements FactoryBean<T>,
|
|||
throw new IllegalStateException("ReferenceBean is not ready yet, please make sure to call reference interface method after dubbo is started.");
|
||||
}
|
||||
//get reference proxy
|
||||
return referenceConfig.get();
|
||||
//Subclasses should synchronize on the given Object if they perform any sort of extended singleton creation phase.
|
||||
// In particular, subclasses should not have their own mutexes involved in singleton creation, to avoid the potential for deadlocks in lazy-init situations.
|
||||
//The redundant type cast is to be compatible with earlier than spring-4.2
|
||||
synchronized (((DefaultSingletonBeanRegistry)getBeanFactory()).getSingletonMutex()) {
|
||||
return referenceConfig.get();
|
||||
}
|
||||
}
|
||||
|
||||
private class DubboReferenceLazyInitTargetSource extends AbstractLazyCreationTargetSource {
|
||||
|
|
|
|||
|
|
@ -236,7 +236,7 @@ public class NacosMetadataReport extends AbstractMetadataReport {
|
|||
@Override
|
||||
public ConfigItem getConfigItem(String key, String group) {
|
||||
String content = getConfig(key, group);
|
||||
String casMd5 = "";
|
||||
String casMd5 = "0";
|
||||
if (StringUtils.isNotEmpty(content)) {
|
||||
casMd5 = md5Utils.getMd5(content);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import org.apache.dubbo.common.utils.UrlUtils;
|
|||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.REGISTRY_UNEXPECTED_EXCEPTION;
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.INTERNAL_ERROR;
|
||||
|
||||
public class ListenerRegistryWrapper implements Registry {
|
||||
private static final ErrorTypeAwareLogger logger = LoggerFactory.getErrorTypeAwareLogger(ListenerRegistryWrapper.class);
|
||||
|
|
@ -125,7 +125,7 @@ public class ListenerRegistryWrapper implements Registry {
|
|||
try {
|
||||
consumer.accept(listener);
|
||||
} catch (RuntimeException t) {
|
||||
logger.error(REGISTRY_UNEXPECTED_EXCEPTION, "", "", t.getMessage(), t);
|
||||
logger.error(INTERNAL_ERROR, "unknown error in registry module", "", t.getMessage(), t);
|
||||
exception = t;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ import static org.apache.dubbo.common.constants.CommonConstants.CHECK_KEY;
|
|||
import static org.apache.dubbo.common.constants.CommonConstants.INTERFACE_KEY;
|
||||
import static org.apache.dubbo.common.constants.CommonConstants.PROVIDER_SIDE;
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.INTERNAL_ERROR;
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.REGISTRY_UNEXPECTED_EXCEPTION;
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.INTERNAL_ERROR;
|
||||
import static org.apache.dubbo.common.constants.RegistryConstants.REGISTRY_CLUSTER_KEY;
|
||||
import static org.apache.dubbo.common.constants.RegistryConstants.REGISTRY_TYPE_KEY;
|
||||
import static org.apache.dubbo.common.constants.RegistryConstants.SERVICE_REGISTRY_TYPE;
|
||||
|
|
@ -198,11 +198,12 @@ public class ServiceDiscoveryRegistry extends FailbackRegistry {
|
|||
|
||||
String key = ServiceNameMapping.buildMappingKey(url);
|
||||
|
||||
if(mappingByUrl == null) {
|
||||
|
||||
if (mappingByUrl == null) {
|
||||
Lock mappingLock = serviceNameMapping.getMappingLock(key);
|
||||
try {
|
||||
mappingLock.lock();
|
||||
Set<String> subscribedServices = serviceNameMapping.getMapping(url);
|
||||
mappingByUrl = serviceNameMapping.getCachedMapping(url);
|
||||
try {
|
||||
MappingListener mappingListener = new DefaultMappingListener(url, subscribedServices, listener);
|
||||
mappingByUrl = serviceNameMapping.getAndListen(this.getUrl(), url, mappingListener);
|
||||
|
|
@ -213,9 +214,9 @@ public class ServiceDiscoveryRegistry extends FailbackRegistry {
|
|||
|
||||
if (CollectionUtils.isEmpty(mappingByUrl)) {
|
||||
logger.info("No interface-apps mapping found in local cache, stop subscribing, will automatically wait for mapping listener callback: " + url);
|
||||
// if (check) {
|
||||
// throw new IllegalStateException("Should has at least one way to know which services this interface belongs to, subscription url: " + url);
|
||||
// }
|
||||
// if (check) {
|
||||
// throw new IllegalStateException("Should has at least one way to know which services this interface belongs to, subscription url: " + url);
|
||||
// }
|
||||
return;
|
||||
}
|
||||
} finally {
|
||||
|
|
@ -369,7 +370,7 @@ public class ServiceDiscoveryRegistry extends FailbackRegistry {
|
|||
logger.info("Received mapping notification from meta server, " + event);
|
||||
|
||||
if (stopped) {
|
||||
logger.warn(REGISTRY_UNEXPECTED_EXCEPTION, "", "", "Listener has been stopped, ignore mapping notification, check why listener is not removed.");
|
||||
logger.warn(INTERNAL_ERROR, "", "", "Listener has been stopped, ignore mapping notification, check why listener is not removed.");
|
||||
return;
|
||||
}
|
||||
Set<String> newApps = event.getApps();
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
|||
|
||||
import static org.apache.dubbo.common.constants.CommonConstants.PROTOCOL_KEY;
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.REGISTRY_FAILED_REFRESH_ADDRESS;
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.REGISTRY_UNEXPECTED_EXCEPTION;
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.INTERNAL_ERROR;
|
||||
import static org.apache.dubbo.common.constants.RegistryConstants.DEFAULT_ENABLE_EMPTY_PROTECTION;
|
||||
import static org.apache.dubbo.common.constants.RegistryConstants.EMPTY_PROTOCOL;
|
||||
import static org.apache.dubbo.common.constants.RegistryConstants.ENABLE_EMPTY_PROTECTION_KEY;
|
||||
|
|
@ -179,9 +179,9 @@ public class ServiceInstancesChangedListener {
|
|||
try {
|
||||
retryFuture = scheduler.schedule(new AddressRefreshRetryTask(retryPermission, event.getServiceName()), 10_000L, TimeUnit.MILLISECONDS);
|
||||
} catch (Exception e) {
|
||||
logger.error(REGISTRY_UNEXPECTED_EXCEPTION, "", "", "Error submitting async retry task.");
|
||||
logger.error(INTERNAL_ERROR, "unknown error in registry module", "", "Error submitting async retry task.");
|
||||
}
|
||||
logger.warn(REGISTRY_UNEXPECTED_EXCEPTION, "", "", "Address refresh try task submitted");
|
||||
logger.warn(INTERNAL_ERROR, "unknown error in registry module", "", "Address refresh try task submitted");
|
||||
}
|
||||
|
||||
// return if all metadata is empty, this notification will not take effect.
|
||||
|
|
@ -283,12 +283,12 @@ public class ServiceInstancesChangedListener {
|
|||
protected boolean isRetryAndExpired(ServiceInstancesChangedEvent event) {
|
||||
if (event instanceof RetryServiceInstancesChangedEvent) {
|
||||
RetryServiceInstancesChangedEvent retryEvent = (RetryServiceInstancesChangedEvent) event;
|
||||
logger.warn(REGISTRY_UNEXPECTED_EXCEPTION, "", "", "Received address refresh retry event, " + retryEvent.getFailureRecordTime());
|
||||
logger.warn(INTERNAL_ERROR, "unknown error in registry module", "", "Received address refresh retry event, " + retryEvent.getFailureRecordTime());
|
||||
if (retryEvent.getFailureRecordTime() < lastRefreshTime && !hasEmptyMetadata) {
|
||||
logger.warn(REGISTRY_UNEXPECTED_EXCEPTION, "", "", "Ignore retry event, event time: " + retryEvent.getFailureRecordTime() + ", last refresh time: " + lastRefreshTime);
|
||||
logger.warn(INTERNAL_ERROR, "unknown error in registry module", "", "Ignore retry event, event time: " + retryEvent.getFailureRecordTime() + ", last refresh time: " + lastRefreshTime);
|
||||
return true;
|
||||
}
|
||||
logger.warn(REGISTRY_UNEXPECTED_EXCEPTION, "", "", "Retrying address notification...");
|
||||
logger.warn(INTERNAL_ERROR, "unknown error in registry module", "", "Retrying address notification...");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
@ -332,7 +332,7 @@ public class ServiceInstancesChangedListener {
|
|||
|
||||
if (emptyMetadataNum > 0) {
|
||||
builder.insert(0, emptyMetadataNum + "/" + revisionToInstances.size() + " revisions failed to get metadata from remote: ");
|
||||
logger.error(REGISTRY_UNEXPECTED_EXCEPTION, "", "", builder.toString());
|
||||
logger.error(INTERNAL_ERROR, "unknown error in registry module", "", builder.toString());
|
||||
} else {
|
||||
builder.insert(0, revisionToInstances.size() + " unique working revisions: ");
|
||||
logger.info(builder.toString());
|
||||
|
|
|
|||
|
|
@ -95,6 +95,9 @@ public class MetadataServiceDelegation implements MetadataService, Disposable {
|
|||
for (ServiceDiscovery sd : serviceDiscoveries) {
|
||||
MetadataInfo metadataInfo = sd.getLocalMetadata();
|
||||
Map<String, SortedSet<URL>> serviceURLs = metadataInfo.getExportedServiceURLs();
|
||||
if (serviceURLs == null) {
|
||||
continue;
|
||||
}
|
||||
for (Map.Entry<String, SortedSet<URL>> entry : serviceURLs.entrySet()) {
|
||||
SortedSet<URL> urls = entry.getValue();
|
||||
if (urls != null) {
|
||||
|
|
@ -115,6 +118,9 @@ public class MetadataServiceDelegation implements MetadataService, Disposable {
|
|||
for (ServiceDiscovery sd : serviceDiscoveries) {
|
||||
MetadataInfo metadataInfo = sd.getLocalMetadata();
|
||||
Map<String, SortedSet<URL>> serviceURLs = metadataInfo.getSubscribedServiceURLs();
|
||||
if (serviceURLs == null) {
|
||||
continue;
|
||||
}
|
||||
for (Map.Entry<String, SortedSet<URL>> entry : serviceURLs.entrySet()) {
|
||||
SortedSet<URL> urls = entry.getValue();
|
||||
if (urls != null) {
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ import java.util.Set;
|
|||
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.REGISTRY_ADDRESS_INVALID;
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.REGISTRY_UNEXPECTED_EXCEPTION;
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.INTERNAL_ERROR;
|
||||
|
||||
public class MetadataServiceNameMapping extends AbstractServiceNameMapping {
|
||||
|
||||
|
|
@ -101,7 +101,7 @@ public class MetadataServiceNameMapping extends AbstractServiceNameMapping {
|
|||
}
|
||||
} catch (Exception e) {
|
||||
result = false;
|
||||
logger.warn(REGISTRY_UNEXPECTED_EXCEPTION, "", "", "Failed registering mapping to remote." + metadataReport, e);
|
||||
logger.warn(INTERNAL_ERROR, "unknown error in registry module", "", "Failed registering mapping to remote." + metadataReport, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
package org.apache.dubbo.registry.client.metadata;
|
||||
|
||||
import org.apache.dubbo.common.URL;
|
||||
import org.apache.dubbo.common.constants.LoggerCodeConstants;
|
||||
import org.apache.dubbo.common.logger.ErrorTypeAwareLogger;
|
||||
import org.apache.dubbo.common.logger.LoggerFactory;
|
||||
import org.apache.dubbo.common.utils.CollectionUtils;
|
||||
|
|
@ -25,7 +26,6 @@ import org.apache.dubbo.registry.client.ServiceInstance;
|
|||
import org.apache.dubbo.registry.client.ServiceInstanceCustomizer;
|
||||
import org.apache.dubbo.rpc.Protocol;
|
||||
import org.apache.dubbo.rpc.model.ApplicationModel;
|
||||
import org.apache.dubbo.common.constants.LoggerCodeConstants;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
|
@ -55,7 +55,7 @@ public class ProtocolPortsMetadataCustomizer implements ServiceInstanceCustomize
|
|||
String protocol = url.getProtocol();
|
||||
Integer oldPort = protocols.get(protocol);
|
||||
int newPort = url.getPort();
|
||||
if (oldPort != null) {
|
||||
if (oldPort != null && oldPort != newPort) {
|
||||
LOGGER.warn(LoggerCodeConstants.PROTOCOL_INCORRECT_PARAMETER_VALUES, "the protocol is listening multiple ports", "", "Same protocol " + "[" + protocol + "]" + " listens on different ports " + "[" + oldPort + "," + newPort + "]" + " will override with each other" +
|
||||
". The port [" + oldPort + "] is overridden with port [" + newPort + "].");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,8 @@ public class SpringCloudServiceInstanceNotificationCustomizer implements Service
|
|||
for (ServiceInstance instance : serviceInstance) {
|
||||
if ("SPRING_CLOUD".equals(instance.getMetadata("preserved.register.source"))) {
|
||||
MetadataInfo.ServiceInfo serviceInfo = new MetadataInfo.ServiceInfo("*", "*", "*", "rest", instance.getPort(), "*", new HashMap<>());
|
||||
MetadataInfo metadataInfo = new MetadataInfo(instance.getServiceName(), "SPRING_CLOUD", new ConcurrentHashMap<>(Collections.singletonMap("*", serviceInfo))) {
|
||||
String revision = "SPRING_CLOUD-" + instance.getServiceName() + "-" + instance.getAddress() + "-" + instance.getPort();
|
||||
MetadataInfo metadataInfo = new MetadataInfo(instance.getServiceName(), revision, new ConcurrentHashMap<>(Collections.singletonMap("*", serviceInfo))) {
|
||||
@Override
|
||||
public List<ServiceInfo> getMatchedServiceInfos(ProtocolServiceKey consumerProtocolServiceKey) {
|
||||
getServices().putIfAbsent(consumerProtocolServiceKey.getServiceKeyString(),
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ import org.apache.dubbo.registry.client.migration.model.MigrationRule;
|
|||
import org.apache.dubbo.registry.client.migration.model.MigrationStep;
|
||||
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.REGISTRY_NO_PARAMETERS_URL;
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.REGISTRY_UNEXPECTED_EXCEPTION;
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.INTERNAL_ERROR;
|
||||
|
||||
public class MigrationRuleHandler<T> {
|
||||
public static final String DUBBO_SERVICEDISCOVERY_MIGRATION = "dubbo.application.migration.step";
|
||||
|
|
@ -89,7 +89,7 @@ public class MigrationRuleHandler<T> {
|
|||
report(step, originStep, "true");
|
||||
} else {
|
||||
// migrate failed, do not save new step and rule
|
||||
logger.warn(REGISTRY_UNEXPECTED_EXCEPTION, "", "", "Migrate to " + step + " mode failed. Probably not satisfy the threshold you set "
|
||||
logger.warn(INTERNAL_ERROR, "unknown error in registry module", "", "Migrate to " + step + " mode failed. Probably not satisfy the threshold you set "
|
||||
+ threshold + ". Please try re-publish configuration if you still after check.");
|
||||
report(step, originStep, "false");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
|||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.COMMON_THREAD_INTERRUPTED_EXCEPTION;
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.COMMON_PROPERTY_TYPE_MISMATCH;
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.REGISTRY_EMPTY_ADDRESS;
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.REGISTRY_UNEXPECTED_EXCEPTION;
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.INTERNAL_ERROR;
|
||||
import static org.apache.dubbo.common.constants.RegistryConstants.INIT;
|
||||
|
||||
/**
|
||||
|
|
@ -194,18 +194,18 @@ public class MigrationRuleListener implements RegistryProtocolListener, Configur
|
|||
try {
|
||||
future.get();
|
||||
} catch (InterruptedException ie) {
|
||||
logger.warn(REGISTRY_UNEXPECTED_EXCEPTION, "", "", "Interrupted while waiting for migration async task to finish.");
|
||||
logger.warn(INTERNAL_ERROR, "unknown error in registry module", "", "Interrupted while waiting for migration async task to finish.");
|
||||
} catch (ExecutionException ee) {
|
||||
migrationException = ee.getCause();
|
||||
}
|
||||
}
|
||||
if (migrationException != null) {
|
||||
logger.error(REGISTRY_UNEXPECTED_EXCEPTION, "", "", "Migration async task failed.", migrationException);
|
||||
logger.error(INTERNAL_ERROR, "unknown error in registry module", "", "Migration async task failed.", migrationException);
|
||||
}
|
||||
executorService.shutdown();
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
logger.error(REGISTRY_UNEXPECTED_EXCEPTION, "", "", "Error occurred when migration.", t);
|
||||
logger.error(INTERNAL_ERROR, "unknown error in registry module", "", "Error occurred when migration.", t);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ import static org.apache.dubbo.common.constants.CommonConstants.SIDE_KEY;
|
|||
import static org.apache.dubbo.common.constants.CommonConstants.TIMEOUT_KEY;
|
||||
import static org.apache.dubbo.common.constants.CommonConstants.VERSION_KEY;
|
||||
import static org.apache.dubbo.common.constants.FilterConstants.VALIDATION_KEY;
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.REGISTRY_UNEXPECTED_EXCEPTION;
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.INTERNAL_ERROR;
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.REGISTRY_UNSUPPORTED_CATEGORY;
|
||||
import static org.apache.dubbo.common.constants.QosConstants.ACCEPT_FOREIGN_IP;
|
||||
import static org.apache.dubbo.common.constants.QosConstants.QOS_ENABLE;
|
||||
|
|
@ -747,7 +747,7 @@ public class RegistryProtocol implements Protocol, ScopeModelAware {
|
|||
String key = getCacheKey(originInvoker);
|
||||
ExporterChangeableWrapper<?> exporter = bounds.get(key);
|
||||
if (exporter == null) {
|
||||
logger.warn(REGISTRY_UNEXPECTED_EXCEPTION, "", "", "error state, exporter should not be null", new IllegalStateException("error state, exporter should not be null"));
|
||||
logger.warn(INTERNAL_ERROR, "unknown error in registry module", "", "error state, exporter should not be null", new IllegalStateException("error state, exporter should not be null"));
|
||||
return;
|
||||
}
|
||||
//The current, may have been merged many times
|
||||
|
|
@ -894,7 +894,7 @@ public class RegistryProtocol implements Protocol, ScopeModelAware {
|
|||
try {
|
||||
registry.unregister(registerUrl);
|
||||
} catch (Throwable t) {
|
||||
logger.warn(REGISTRY_UNEXPECTED_EXCEPTION, "", "", t.getMessage(), t);
|
||||
logger.warn(INTERNAL_ERROR, "unknown error in registry module", "", t.getMessage(), t);
|
||||
}
|
||||
try {
|
||||
if (subscribeUrl != null) {
|
||||
|
|
@ -917,7 +917,7 @@ public class RegistryProtocol implements Protocol, ScopeModelAware {
|
|||
}
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
logger.warn(REGISTRY_UNEXPECTED_EXCEPTION, "", "", t.getMessage(), t);
|
||||
logger.warn(INTERNAL_ERROR, "unknown error in registry module", "", t.getMessage(), t);
|
||||
}
|
||||
|
||||
//TODO wait for shutdown timeout is a bit strange
|
||||
|
|
@ -929,7 +929,7 @@ public class RegistryProtocol implements Protocol, ScopeModelAware {
|
|||
try {
|
||||
exporter.unexport();
|
||||
} catch (Throwable t) {
|
||||
logger.warn(REGISTRY_UNEXPECTED_EXCEPTION, "", "", t.getMessage(), t);
|
||||
logger.warn(INTERNAL_ERROR, "unknown error in registry module", "", t.getMessage(), t);
|
||||
}
|
||||
}, timeout, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ import static org.apache.dubbo.common.constants.LoggerCodeConstants.REGISTRY_FAI
|
|||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.REGISTRY_FAILED_DESTROY_UNREGISTER_URL;
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.REGISTRY_FAILED_READ_WRITE_CACHE_FILE;
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.REGISTRY_FAILED_DELETE_LOCKFILE;
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.REGISTRY_UNEXPECTED_EXCEPTION;
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.INTERNAL_ERROR;
|
||||
import static org.apache.dubbo.common.constants.RegistryConstants.ACCEPTS_KEY;
|
||||
import static org.apache.dubbo.common.constants.RegistryConstants.DEFAULT_CATEGORY;
|
||||
import static org.apache.dubbo.common.constants.RegistryConstants.DYNAMIC_KEY;
|
||||
|
|
@ -566,7 +566,7 @@ public abstract class AbstractRegistry implements Registry {
|
|||
registryCacheExecutor.schedule(() -> doSaveProperties(version), DEFAULT_INTERVAL_SAVE_PROPERTIES, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
logger.warn(REGISTRY_UNEXPECTED_EXCEPTION, "", "", t.getMessage(), t);
|
||||
logger.warn(INTERNAL_ERROR, "unknown error in registry module", "", t.getMessage(), t);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ import java.util.concurrent.ConcurrentMap;
|
|||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.REGISTRY_FAILED_NOTIFY_EVENT;
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.REGISTRY_UNEXPECTED_EXCEPTION;
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.INTERNAL_ERROR;
|
||||
import static org.apache.dubbo.registry.Constants.DEFAULT_REGISTRY_RETRY_PERIOD;
|
||||
import static org.apache.dubbo.registry.Constants.REGISTRY_RETRY_PERIOD_KEY;
|
||||
|
||||
|
|
@ -219,7 +219,7 @@ public abstract class FailbackRegistry extends AbstractRegistry {
|
|||
}
|
||||
throw new IllegalStateException("Failed to register " + url + " to registry " + getUrl().getAddress() + ", cause: " + t.getMessage(), t);
|
||||
} else {
|
||||
logger.error(REGISTRY_UNEXPECTED_EXCEPTION, "", "", "Failed to register " + url + ", waiting for retry, cause: " + t.getMessage(), t);
|
||||
logger.error(INTERNAL_ERROR, "unknown error in registry module", "", "Failed to register " + url + ", waiting for retry, cause: " + t.getMessage(), t);
|
||||
}
|
||||
|
||||
// Record a failed registration request to a failed list, retry regularly
|
||||
|
|
@ -268,7 +268,7 @@ public abstract class FailbackRegistry extends AbstractRegistry {
|
|||
}
|
||||
throw new IllegalStateException("Failed to unregister " + url + " to registry " + getUrl().getAddress() + ", cause: " + t.getMessage(), t);
|
||||
} else {
|
||||
logger.error(REGISTRY_UNEXPECTED_EXCEPTION, "", "", "Failed to unregister " + url + ", waiting for retry, cause: " + t.getMessage(), t);
|
||||
logger.error(INTERNAL_ERROR, "unknown error in registry module", "", "Failed to unregister " + url + ", waiting for retry, cause: " + t.getMessage(), t);
|
||||
}
|
||||
|
||||
// Record a failed registration request to a failed list, retry regularly
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ import java.util.concurrent.locks.ReentrantLock;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.REGISTRY_FAILED_FETCH_INSTANCE;
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.REGISTRY_UNEXPECTED_EXCEPTION;
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.INTERNAL_ERROR;
|
||||
|
||||
/**
|
||||
* Application Level, used to collect Registries
|
||||
|
|
@ -107,7 +107,7 @@ public class RegistryManager {
|
|||
try {
|
||||
registry.destroy();
|
||||
} catch (Throwable e) {
|
||||
LOGGER.warn(REGISTRY_UNEXPECTED_EXCEPTION, "", "", e.getMessage(), e);
|
||||
LOGGER.warn(INTERNAL_ERROR, "unknown error in registry module", "", e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
registries.clear();
|
||||
|
|
|
|||
|
|
@ -42,6 +42,8 @@ import java.util.concurrent.CountDownLatch;
|
|||
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.REGISTRY_ZOOKEEPER_EXCEPTION;
|
||||
import static org.apache.dubbo.common.function.ThrowableFunction.execute;
|
||||
import static org.apache.dubbo.metadata.RevisionResolver.EMPTY_REVISION;
|
||||
import static org.apache.dubbo.registry.client.metadata.ServiceInstanceMetadataUtils.getExportedServicesRevision;
|
||||
import static org.apache.dubbo.registry.zookeeper.util.CuratorFrameworkUtils.build;
|
||||
import static org.apache.dubbo.registry.zookeeper.util.CuratorFrameworkUtils.buildCuratorFramework;
|
||||
import static org.apache.dubbo.registry.zookeeper.util.CuratorFrameworkUtils.buildServiceDiscovery;
|
||||
|
|
@ -106,6 +108,19 @@ public class ZookeeperServiceDiscovery extends AbstractServiceDiscovery {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doUpdate(ServiceInstance serviceInstance) throws RuntimeException {
|
||||
if (!EMPTY_REVISION.equals(getExportedServicesRevision(serviceInstance))) {
|
||||
reportMetadata(serviceInstance.getServiceMetadata());
|
||||
}
|
||||
|
||||
try {
|
||||
serviceDiscovery.updateService(build(serviceInstance));
|
||||
} catch (Exception e) {
|
||||
throw new RpcException(REGISTRY_EXCEPTION, "Failed register instance " + serviceInstance.toString(), e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getServices() {
|
||||
return doInServiceDiscovery(s -> new LinkedHashSet<>(s.queryForNames()));
|
||||
|
|
|
|||
|
|
@ -14,3 +14,4 @@ timeout=org.apache.dubbo.rpc.filter.TimeoutFilter
|
|||
tps=org.apache.dubbo.rpc.filter.TpsLimitFilter
|
||||
profiler-server=org.apache.dubbo.rpc.filter.ProfilerServerFilter
|
||||
adaptiveLoadBalance=org.apache.dubbo.rpc.filter.AdaptiveLoadBalanceFilter
|
||||
active-limit=org.apache.dubbo.rpc.filter.ActiveLimitFilter
|
||||
|
|
|
|||
Loading…
Reference in New Issue