* Add error code 5-2 ~ 5-20. * Error code is managed with constants (#10549) * Error code is managed with constants (#10549) * Error code is managed with constants (#10771) * Error code is managed with constants (#10771) * Error code is managed with constants (#10771)
This commit is contained in:
parent
d04f03a942
commit
4d289883e7
|
|
@ -19,7 +19,7 @@ package org.apache.dubbo.rpc.cluster.filter;
|
|||
import org.apache.dubbo.common.Experimental;
|
||||
import org.apache.dubbo.common.URL;
|
||||
import org.apache.dubbo.common.extension.SPI;
|
||||
import org.apache.dubbo.common.logger.Logger;
|
||||
import org.apache.dubbo.common.logger.ErrorTypeAwareLogger;
|
||||
import org.apache.dubbo.common.logger.LoggerFactory;
|
||||
import org.apache.dubbo.rpc.BaseFilter;
|
||||
import org.apache.dubbo.rpc.Filter;
|
||||
|
|
@ -35,6 +35,7 @@ import org.apache.dubbo.rpc.cluster.Directory;
|
|||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.CLUSTER_EXECUTE_FILTER_EXCEPTION;
|
||||
import static org.apache.dubbo.common.extension.ExtensionScope.APPLICATION;
|
||||
|
||||
@SPI(value = "default", scope = APPLICATION)
|
||||
|
|
@ -179,7 +180,7 @@ public interface FilterChainBuilder {
|
|||
}
|
||||
|
||||
class CallbackRegistrationInvoker<T, FILTER extends BaseFilter> implements Invoker<T> {
|
||||
static final Logger LOGGER = LoggerFactory.getLogger(CallbackRegistrationInvoker.class);
|
||||
static final ErrorTypeAwareLogger LOGGER = LoggerFactory.getErrorTypeAwareLogger(CallbackRegistrationInvoker.class);
|
||||
final Invoker<T> filterInvoker;
|
||||
final List<FILTER> filters;
|
||||
|
||||
|
|
@ -220,7 +221,7 @@ public interface FilterChainBuilder {
|
|||
}
|
||||
}
|
||||
} catch (RuntimeException runtimeException) {
|
||||
LOGGER.error(String.format("Exception occurred while executing the %s filter named %s.", i, filter.getClass().getSimpleName()));
|
||||
LOGGER.error(CLUSTER_EXECUTE_FILTER_EXCEPTION, "the custom filter is abnormal", "", String.format("Exception occurred while executing the %s filter named %s.", i, filter.getClass().getSimpleName()));
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(String.format("Whole filter list is: %s", filters.stream().map(tmpFilter -> tmpFilter.getClass().getSimpleName()).collect(Collectors.toList())));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
*/
|
||||
package org.apache.dubbo.rpc.cluster.support;
|
||||
|
||||
import org.apache.dubbo.common.logger.Logger;
|
||||
import org.apache.dubbo.common.logger.ErrorTypeAwareLogger;
|
||||
import org.apache.dubbo.common.logger.LoggerFactory;
|
||||
import org.apache.dubbo.common.utils.ConfigUtils;
|
||||
import org.apache.dubbo.rpc.AsyncRpcResult;
|
||||
|
|
@ -41,6 +41,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.CLUSTER_FAILED_GROUP_MERGE;
|
||||
import static org.apache.dubbo.rpc.Constants.ASYNC_KEY;
|
||||
import static org.apache.dubbo.rpc.Constants.MERGER_KEY;
|
||||
|
||||
|
|
@ -50,7 +51,7 @@ import static org.apache.dubbo.rpc.Constants.MERGER_KEY;
|
|||
@SuppressWarnings("unchecked")
|
||||
public class MergeableClusterInvoker<T> extends AbstractClusterInvoker<T> {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(MergeableClusterInvoker.class);
|
||||
private static final ErrorTypeAwareLogger log = LoggerFactory.getErrorTypeAwareLogger(MergeableClusterInvoker.class);
|
||||
|
||||
public MergeableClusterInvoker(Directory<T> directory) {
|
||||
super(directory);
|
||||
|
|
@ -101,8 +102,8 @@ public class MergeableClusterInvoker<T> extends AbstractClusterInvoker<T> {
|
|||
try {
|
||||
Result r = asyncResult.get(Integer.MAX_VALUE, TimeUnit.MILLISECONDS);
|
||||
if (r.hasException()) {
|
||||
log.error("Invoke " + getGroupDescFromServiceKey(entry.getKey()) +
|
||||
" failed: " + r.getException().getMessage(), r.getException());
|
||||
log.error(CLUSTER_FAILED_GROUP_MERGE, "Invoke " + getGroupDescFromServiceKey(entry.getKey()) +
|
||||
" failed: " + r.getException().getMessage(), "", r.getException().getMessage());
|
||||
} else {
|
||||
resultList.add(r);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ package org.apache.dubbo.common.constants;
|
|||
*/
|
||||
public interface LoggerCodeConstants {
|
||||
|
||||
// common module 0-1 ~ 0-4
|
||||
// common module
|
||||
String COMMON_THREAD_POOL_EXHAUSTED = "0-1";
|
||||
|
||||
String COMMON_PROPERTY_MISSPELLING = "0-2";
|
||||
|
|
@ -31,9 +31,10 @@ public interface LoggerCodeConstants {
|
|||
|
||||
String COMMON_CACHE_MAX_FILE_SIZE_LIMIT_EXCEED = "0-4";
|
||||
|
||||
|
||||
String COMMON_CACHE_MAX_ENTRY_COUNT_LIMIT_EXCEED = "0-5";
|
||||
|
||||
String COMMON_THREAD_INTERRUPTED_EXCEPTION = "0-6";
|
||||
|
||||
// registry module
|
||||
String REGISTRY_ADDRESS_INVALID = "1-1";
|
||||
|
||||
|
|
@ -71,7 +72,21 @@ public interface LoggerCodeConstants {
|
|||
|
||||
String REGISTRY_MISSING_METADATA_CONFIG_PORT = "1-18";
|
||||
|
||||
// cluster module 2-1 ~ 2-18
|
||||
String REGISTRY_ERROR_LISTEN_KUBERNETES = "1-19";
|
||||
|
||||
String REGISTRY_UNABLE_MATCH_KUBERNETES = "1-20";
|
||||
|
||||
String REGISTRY_UNABLE_FIND_SERVICE_KUBERNETES = "1-21";
|
||||
|
||||
String REGISTRY_UNABLE_ACCESS_KUBERNETES = "1-22";
|
||||
|
||||
String REGISTRY_FAILED_DOWNLOAD_FILE = "1-23";
|
||||
|
||||
String REGISTRY_FAILED_START_ZOOKEEPER = "1-24";
|
||||
|
||||
String REGISTRY_FAILED_STOP_ZOOKEEPER = "1-25";
|
||||
|
||||
// cluster module
|
||||
String CLUSTER_FAILED_SITE_SELECTION = "2-1";
|
||||
|
||||
String CLUSTER_NO_VALID_PROVIDER = "2-2";
|
||||
|
|
@ -108,17 +123,21 @@ public interface LoggerCodeConstants {
|
|||
|
||||
String CLUSTER_NO_RULE_LISTENER = "2-18";
|
||||
|
||||
// proxy module 3-1
|
||||
String CLUSTER_EXECUTE_FILTER_EXCEPTION = "2-19";
|
||||
|
||||
String CLUSTER_FAILED_GROUP_MERGE = "2-20";
|
||||
|
||||
// proxy module
|
||||
String PROXY_FAILED_CONVERT_URL = "3-1";
|
||||
|
||||
// protocol module 4-1 ~ 4-3
|
||||
// protocol module
|
||||
String PROTOCOL_UNSUPPORTED = "4-1";
|
||||
|
||||
String PROTOCOL_FAILED_INIT_SERIALIZATION_OPTIMIZER = "4-2";
|
||||
|
||||
String PROTOCOL_FAILED_REFER_INVOKER = "4-3";
|
||||
|
||||
// config module 5-1 ~ 5-20
|
||||
// config module
|
||||
String CONFIG_FAILED_CONNECT_REGISTRY = "5-1";
|
||||
|
||||
String CONFIG_FAILED_SHUTDOWN_HOOK = "5-2";
|
||||
|
|
@ -159,7 +178,39 @@ public interface LoggerCodeConstants {
|
|||
|
||||
String CONFIG_STOP_DUBBO_ERROR = "5-20";
|
||||
|
||||
// transport module 6-1 ~ 6-2
|
||||
String CONFIG_FAILED_EXECUTE_DESTORY = "5-21";
|
||||
|
||||
String CONFIG_FAILED_INIT_CONFIG_CENTER = "5-22";
|
||||
|
||||
String CONFIG_FAILED_WAIT_EXPORT_REFER = "5-23";
|
||||
|
||||
String CONFIG_FAILED_REFER_SERVICE = "5-24";
|
||||
|
||||
String CONFIG_UNDEFINED_PROTOCOL = "5-25";
|
||||
|
||||
String CONFIG_METADATA_SERVICE_EXPORTED = "5-26";
|
||||
|
||||
String CONFIG_API_WRONG_USE = "5-27";
|
||||
|
||||
String CONFIG_NO_ANNOTATIONS_FOUND = "5-28";
|
||||
|
||||
String CONFIG_NO_BEANS_SCANNED = "5-29";
|
||||
|
||||
String CONFIG_DUPLICATED_BEAN_DEFINITION = "5-30";
|
||||
|
||||
String CONFIG_WARN_STATUS_CHECKER = "5-31";
|
||||
|
||||
String CONFIG_FAILED_CLOSE_CONNECT_APOLLO = "5-32";
|
||||
|
||||
String CONFIG_NOT_EFFECT_EMPTY_RULE_APOLLO = "5-33";
|
||||
|
||||
String CONFIG_ERROR_NACOS = "5-34";
|
||||
|
||||
String CONFIG_START_DUBBO_ERROR = "5-35";
|
||||
|
||||
String CONFIG_FILTER_VALIDATION_EXCEPTION = "5-36";
|
||||
|
||||
// transport module
|
||||
String TRANSPORT_FAILED_CONNECT_PROVIDER = "6-1";
|
||||
|
||||
String TRANSPORT_CLIENT_CONNECT_TIMEOUT = "6-2";
|
||||
|
|
|
|||
|
|
@ -75,6 +75,9 @@ import static org.apache.dubbo.common.constants.CommonConstants.REGISTRY_SPLIT_P
|
|||
import static org.apache.dubbo.common.constants.CommonConstants.REMOTE_METADATA_STORAGE_TYPE;
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.CONFIG_REFRESH_INSTANCE_ERROR;
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.CONFIG_REGISTER_INSTANCE_ERROR;
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.CONFIG_FAILED_START_MODEL;
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.CONFIG_FAILED_EXECUTE_DESTORY;
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.CONFIG_FAILED_INIT_CONFIG_CENTER;
|
||||
import static org.apache.dubbo.common.utils.StringUtils.isEmpty;
|
||||
import static org.apache.dubbo.common.utils.StringUtils.isNotEmpty;
|
||||
import static org.apache.dubbo.metadata.MetadataConstants.DEFAULT_METADATA_PUBLISH_DELAY;
|
||||
|
|
@ -621,7 +624,7 @@ public class DefaultApplicationDeployer extends AbstractDeployer<ApplicationMode
|
|||
}
|
||||
|
||||
public void prepareInternalModule() {
|
||||
if(hasPreparedInternalModule){
|
||||
if (hasPreparedInternalModule) {
|
||||
return;
|
||||
}
|
||||
synchronized (internalModuleLock) {
|
||||
|
|
@ -637,7 +640,7 @@ public class DefaultApplicationDeployer extends AbstractDeployer<ApplicationMode
|
|||
try {
|
||||
future.get(5, TimeUnit.SECONDS);
|
||||
} catch (Exception e) {
|
||||
logger.warn("wait for internal module startup failed: " + e.getMessage(), e);
|
||||
logger.warn(CONFIG_FAILED_START_MODEL, "", "", "wait for internal module startup failed: " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -673,7 +676,7 @@ public class DefaultApplicationDeployer extends AbstractDeployer<ApplicationMode
|
|||
dynamicConfiguration = getDynamicConfiguration(configCenter.toUrl());
|
||||
} catch (Exception e) {
|
||||
if (!configCenter.isCheck()) {
|
||||
logger.warn("The configuration center failed to initialize", e);
|
||||
logger.warn(CONFIG_FAILED_INIT_CONFIG_CENTER, "", "","The configuration center failed to initialize", e);
|
||||
configCenter.setInitialized(false);
|
||||
return null;
|
||||
} else {
|
||||
|
|
@ -924,7 +927,7 @@ public class DefaultApplicationDeployer extends AbstractDeployer<ApplicationMode
|
|||
((ApplicationDeployListener) listener).onModuleStarted(applicationModel);
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
logger.error(getIdentifier() + " an exception occurred when handle starting event", e);
|
||||
logger.error(CONFIG_FAILED_START_MODEL, "", "", getIdentifier() + " an exception occurred when handle starting event", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1003,7 +1006,7 @@ public class DefaultApplicationDeployer extends AbstractDeployer<ApplicationMode
|
|||
private void onFailed(String msg, Throwable ex) {
|
||||
try {
|
||||
setFailed(ex);
|
||||
logger.error(msg, ex);
|
||||
logger.error(CONFIG_FAILED_START_MODEL, "", "", msg, ex);
|
||||
} finally {
|
||||
completeStartFuture(false);
|
||||
}
|
||||
|
|
@ -1025,7 +1028,7 @@ public class DefaultApplicationDeployer extends AbstractDeployer<ApplicationMode
|
|||
try {
|
||||
serviceDiscovery.destroy();
|
||||
} catch (Throwable ignored) {
|
||||
logger.warn(ignored.getMessage(), ignored);
|
||||
logger.warn(CONFIG_FAILED_EXECUTE_DESTORY, "", "", ignored.getMessage(), ignored);
|
||||
}
|
||||
});
|
||||
if (logger.isDebugEnabled()) {
|
||||
|
|
|
|||
|
|
@ -50,6 +50,8 @@ import static org.apache.dubbo.common.constants.LoggerCodeConstants.CONFIG_FAILE
|
|||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.CONFIG_UNABLE_DESTROY_MODEL;
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.CONFIG_FAILED_REFERENCE_MODEL;
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.CONFIG_FAILED_EXPORT_SERVICE;
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.CONFIG_FAILED_WAIT_EXPORT_REFER;
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.CONFIG_FAILED_REFER_SERVICE;
|
||||
|
||||
/**
|
||||
* Export/refer services of module
|
||||
|
|
@ -175,7 +177,7 @@ public class DefaultModuleDeployer extends AbstractDeployer<ModuleModel> impleme
|
|||
// wait for refer finish
|
||||
waitReferFinish();
|
||||
} catch (Throwable e) {
|
||||
logger.warn("wait for export/refer services occurred an exception", e);
|
||||
logger.warn(CONFIG_FAILED_WAIT_EXPORT_REFER, "", "", "wait for export/refer services occurred an exception", e);
|
||||
} finally {
|
||||
onModuleStarted();
|
||||
}
|
||||
|
|
@ -421,7 +423,7 @@ public class DefaultModuleDeployer extends AbstractDeployer<ModuleModel> impleme
|
|||
exportFuture = CompletableFuture.allOf(asyncExportingFutures.toArray(new CompletableFuture[0]));
|
||||
exportFuture.get();
|
||||
} catch (Throwable e) {
|
||||
logger.warn(getIdentifier() + " export services occurred an exception: " + e.toString());
|
||||
logger.warn(CONFIG_FAILED_EXPORT_SERVICE, "","",getIdentifier() + " export services occurred an exception: " + e.toString());
|
||||
} finally {
|
||||
logger.info(getIdentifier() + " export services finished.");
|
||||
asyncExportingFutures.clear();
|
||||
|
|
@ -434,7 +436,7 @@ public class DefaultModuleDeployer extends AbstractDeployer<ModuleModel> impleme
|
|||
referFuture = CompletableFuture.allOf(asyncReferringFutures.toArray(new CompletableFuture[0]));
|
||||
referFuture.get();
|
||||
} catch (Throwable e) {
|
||||
logger.warn(getIdentifier() + " refer services occurred an exception: " + e.toString());
|
||||
logger.warn(CONFIG_FAILED_REFER_SERVICE, "", "", getIdentifier() + " refer services occurred an exception: " + e.toString());
|
||||
} finally {
|
||||
logger.info(getIdentifier() + " refer services finished.");
|
||||
asyncReferringFutures.clear();
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
package org.apache.dubbo.config.deploy;
|
||||
|
||||
import org.apache.dubbo.common.extension.ExtensionLoader;
|
||||
import org.apache.dubbo.common.logger.Logger;
|
||||
import org.apache.dubbo.common.logger.ErrorTypeAwareLogger;
|
||||
import org.apache.dubbo.common.logger.LoggerFactory;
|
||||
import org.apache.dubbo.rpc.Protocol;
|
||||
import org.apache.dubbo.rpc.model.FrameworkModel;
|
||||
|
|
@ -25,12 +25,14 @@ import org.apache.dubbo.rpc.model.ScopeModelDestroyListener;
|
|||
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.CONFIG_UNDEFINED_PROTOCOL;
|
||||
|
||||
/**
|
||||
* A cleaner to release resources of framework model
|
||||
*/
|
||||
public class FrameworkModelCleaner implements ScopeModelDestroyListener<FrameworkModel> {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(FrameworkModelCleaner.class);
|
||||
private static final ErrorTypeAwareLogger logger = LoggerFactory.getErrorTypeAwareLogger(FrameworkModelCleaner.class);
|
||||
|
||||
private final AtomicBoolean protocolDestroyed = new AtomicBoolean(false);
|
||||
|
||||
|
|
@ -65,7 +67,7 @@ public class FrameworkModelCleaner implements ScopeModelDestroyListener<Framewor
|
|||
protocol.destroy();
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
logger.warn(t.getMessage(), t);
|
||||
logger.warn(CONFIG_UNDEFINED_PROTOCOL, "", "", t.getMessage(), t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ import static org.apache.dubbo.common.constants.CommonConstants.METADATA_SERVICE
|
|||
import static org.apache.dubbo.common.constants.CommonConstants.THREADPOOL_KEY;
|
||||
import static org.apache.dubbo.common.constants.CommonConstants.THREADS_KEY;
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.CONFIG_FAILED_FIND_PROTOCOL;
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.CONFIG_METADATA_SERVICE_EXPORTED;
|
||||
import static org.apache.dubbo.remoting.Constants.BIND_PORT_KEY;
|
||||
|
||||
/**
|
||||
|
|
@ -77,7 +78,7 @@ public class ConfigurableMetadataServiceExporter {
|
|||
}
|
||||
} else {
|
||||
if (logger.isWarnEnabled()) {
|
||||
logger.warn("The MetadataService has been exported : " + serviceConfig.getExportedUrls());
|
||||
logger.warn(CONFIG_METADATA_SERVICE_EXPORTED, "", "", "The MetadataService has been exported : " + serviceConfig.getExportedUrls());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ package org.apache.dubbo.config.utils;
|
|||
|
||||
import org.apache.dubbo.common.BaseServiceMetadata;
|
||||
import org.apache.dubbo.common.config.ReferenceCache;
|
||||
import org.apache.dubbo.common.logger.Logger;
|
||||
import org.apache.dubbo.common.logger.ErrorTypeAwareLogger;
|
||||
import org.apache.dubbo.common.logger.LoggerFactory;
|
||||
import org.apache.dubbo.config.ReferenceConfigBase;
|
||||
import org.apache.dubbo.rpc.model.ApplicationModel;
|
||||
|
|
@ -27,12 +27,14 @@ import org.apache.dubbo.rpc.model.ModuleModel;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.CONFIG_API_WRONG_USE;
|
||||
|
||||
/**
|
||||
* A impl of ReferenceCache for Application
|
||||
*/
|
||||
public class CompositeReferenceCache implements ReferenceCache {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(CompositeReferenceCache.class);
|
||||
private static final ErrorTypeAwareLogger logger = LoggerFactory.getErrorTypeAwareLogger(CompositeReferenceCache.class);
|
||||
|
||||
private final ApplicationModel applicationModel;
|
||||
|
||||
|
|
@ -51,7 +53,7 @@ public class CompositeReferenceCache implements ReferenceCache {
|
|||
if (singleton) {
|
||||
proxy = get(key, (Class<T>) type);
|
||||
} else {
|
||||
logger.warn("Using non-singleton ReferenceConfig and ReferenceCache at the same time may cause memory leak. " +
|
||||
logger.warn(CONFIG_API_WRONG_USE, "the api method is being used incorrectly", "", "Using non-singleton ReferenceConfig and ReferenceCache at the same time may cause memory leak. " +
|
||||
"Call ReferenceConfig#get() directly for non-singleton ReferenceConfig instead of using ReferenceCache#get(ReferenceConfig)");
|
||||
}
|
||||
if (proxy == null) {
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ package org.apache.dubbo.config.utils;
|
|||
|
||||
import org.apache.dubbo.common.BaseServiceMetadata;
|
||||
import org.apache.dubbo.common.config.ReferenceCache;
|
||||
import org.apache.dubbo.common.logger.Logger;
|
||||
import org.apache.dubbo.common.logger.ErrorTypeAwareLogger;
|
||||
import org.apache.dubbo.common.logger.LoggerFactory;
|
||||
import org.apache.dubbo.common.utils.CollectionUtils;
|
||||
import org.apache.dubbo.common.utils.StringUtils;
|
||||
|
|
@ -33,6 +33,8 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||
import java.util.concurrent.ConcurrentMap;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.CONFIG_API_WRONG_USE;
|
||||
|
||||
/**
|
||||
* A simple util class for cache {@link ReferenceConfigBase}.
|
||||
* <p>
|
||||
|
|
@ -42,7 +44,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||
* You can implement and use your own {@link ReferenceConfigBase} cache if you need use complicate strategy.
|
||||
*/
|
||||
public class SimpleReferenceCache implements ReferenceCache {
|
||||
private static final Logger logger = LoggerFactory.getLogger(SimpleReferenceCache.class);
|
||||
private static final ErrorTypeAwareLogger logger = LoggerFactory.getErrorTypeAwareLogger(SimpleReferenceCache.class);
|
||||
public static final String DEFAULT_NAME = "_DEFAULT_";
|
||||
/**
|
||||
* Create the key with the <b>Group</b>, <b>Interface</b> and <b>version</b> attribute of {@link ReferenceConfigBase}.
|
||||
|
|
@ -117,7 +119,7 @@ public class SimpleReferenceCache implements ReferenceCache {
|
|||
if (singleton) {
|
||||
proxy = get(key, (Class<T>) type);
|
||||
} else {
|
||||
logger.warn("Using non-singleton ReferenceConfig and ReferenceCache at the same time may cause memory leak. " +
|
||||
logger.warn(CONFIG_API_WRONG_USE, "", "", "Using non-singleton ReferenceConfig and ReferenceCache at the same time may cause memory leak. " +
|
||||
"Call ReferenceConfig#get() directly for non-singleton ReferenceConfig instead of using ReferenceCache#get(ReferenceConfig)");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
*/
|
||||
package org.apache.dubbo.config.spring.beans.factory.annotation;
|
||||
|
||||
import org.apache.dubbo.common.logger.Logger;
|
||||
import org.apache.dubbo.common.logger.ErrorTypeAwareLogger;
|
||||
import org.apache.dubbo.common.logger.LoggerFactory;
|
||||
import org.apache.dubbo.common.utils.ClassUtils;
|
||||
import org.apache.dubbo.common.utils.ReflectUtils;
|
||||
|
|
@ -81,6 +81,9 @@ import java.util.Set;
|
|||
|
||||
import static com.alibaba.spring.util.ObjectUtils.of;
|
||||
import static java.util.Arrays.asList;
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.CONFIG_NO_ANNOTATIONS_FOUND;
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.CONFIG_NO_BEANS_SCANNED;
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.CONFIG_DUPLICATED_BEAN_DEFINITION;
|
||||
import static org.apache.dubbo.common.utils.AnnotationUtils.filterDefaultValues;
|
||||
import static org.apache.dubbo.config.spring.beans.factory.annotation.ServiceBeanNameBuilder.create;
|
||||
import static org.apache.dubbo.config.spring.util.DubboAnnotationUtils.resolveInterfaceName;
|
||||
|
|
@ -111,7 +114,7 @@ public class ServiceAnnotationPostProcessor implements BeanDefinitionRegistryPos
|
|||
com.alibaba.dubbo.config.annotation.Service.class
|
||||
);
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(getClass());
|
||||
private final ErrorTypeAwareLogger logger = LoggerFactory.getErrorTypeAwareLogger(getClass());
|
||||
|
||||
protected final Set<String> packagesToScan;
|
||||
|
||||
|
|
@ -187,7 +190,7 @@ public class ServiceAnnotationPostProcessor implements BeanDefinitionRegistryPos
|
|||
scanned = true;
|
||||
if (CollectionUtils.isEmpty(packagesToScan)) {
|
||||
if (logger.isWarnEnabled()) {
|
||||
logger.warn("packagesToScan is empty , ServiceBean registry will be ignored!");
|
||||
logger.warn(CONFIG_NO_BEANS_SCANNED, "", "", "packagesToScan is empty , ServiceBean registry will be ignored!");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
@ -236,7 +239,7 @@ public class ServiceAnnotationPostProcessor implements BeanDefinitionRegistryPos
|
|||
}
|
||||
} else {
|
||||
if (logger.isWarnEnabled()) {
|
||||
logger.warn("No class annotated by Dubbo @Service was found under package ["
|
||||
logger.warn(CONFIG_NO_ANNOTATIONS_FOUND,"No annotations were found on the class","","No class annotated by Dubbo @Service was found under package ["
|
||||
+ packageToScan + "], ignore re-scanned classes: " + scanExcludeFilter.getExcludedCount());
|
||||
}
|
||||
}
|
||||
|
|
@ -585,7 +588,7 @@ public class ServiceAnnotationPostProcessor implements BeanDefinitionRegistryPos
|
|||
|
||||
String msg = "Found duplicated BeanDefinition of service interface [" + serviceInterface + "] with bean name [" + serviceBeanName +
|
||||
"], existing definition [ " + existingDefinition + "], new definition [" + serviceBeanDefinition + "]";
|
||||
logger.error(msg);
|
||||
logger.error(CONFIG_DUPLICATED_BEAN_DEFINITION, "", "", msg);
|
||||
throw new BeanDefinitionStoreException(serviceBeanDefinition.getResourceDescription(), serviceBeanName, msg);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
package org.apache.dubbo.config.spring.context;
|
||||
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.CONFIG_STOP_DUBBO_ERROR;
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.CONFIG_FAILED_START_MODEL;
|
||||
import static org.springframework.util.ObjectUtils.nullSafeEquals;
|
||||
|
||||
import java.util.concurrent.Future;
|
||||
|
|
@ -116,9 +117,9 @@ public class DubboDeployApplicationListener implements ApplicationListener<Appli
|
|||
try {
|
||||
future.get();
|
||||
} catch (InterruptedException e) {
|
||||
logger.warn("Interrupted while waiting for dubbo module start: " + e.getMessage());
|
||||
logger.warn(CONFIG_FAILED_START_MODEL, "", "", "Interrupted while waiting for dubbo module start: " + e.getMessage());
|
||||
} catch (Exception e) {
|
||||
logger.warn("An error occurred while waiting for dubbo module start: " + e.getMessage(), e);
|
||||
logger.warn(CONFIG_FAILED_START_MODEL, "", "", "An error occurred while waiting for dubbo module start: " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
package org.apache.dubbo.config.spring.status;
|
||||
|
||||
import org.apache.dubbo.common.extension.Activate;
|
||||
import org.apache.dubbo.common.logger.Logger;
|
||||
import org.apache.dubbo.common.logger.ErrorTypeAwareLogger;
|
||||
import org.apache.dubbo.common.logger.LoggerFactory;
|
||||
import org.apache.dubbo.common.status.Status;
|
||||
import org.apache.dubbo.common.status.StatusChecker;
|
||||
|
|
@ -33,13 +33,15 @@ import java.sql.DatabaseMetaData;
|
|||
import java.sql.ResultSet;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.CONFIG_WARN_STATUS_CHECKER;
|
||||
|
||||
/**
|
||||
* DataSourceStatusChecker
|
||||
*/
|
||||
@Activate
|
||||
public class DataSourceStatusChecker implements StatusChecker {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(DataSourceStatusChecker.class);
|
||||
private static final ErrorTypeAwareLogger logger = LoggerFactory.getErrorTypeAwareLogger(DataSourceStatusChecker.class);
|
||||
|
||||
private ApplicationModel applicationModel;
|
||||
|
||||
|
|
@ -92,7 +94,7 @@ public class DataSourceStatusChecker implements StatusChecker {
|
|||
buf.append(metaData.getDatabaseProductVersion());
|
||||
buf.append(')');
|
||||
} catch (Throwable e) {
|
||||
logger.warn(e.getMessage(), e);
|
||||
logger.warn(CONFIG_WARN_STATUS_CHECKER, "", "", e.getMessage(), e);
|
||||
return new Status(level, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
package org.apache.dubbo.config.spring.status;
|
||||
|
||||
import org.apache.dubbo.common.extension.Activate;
|
||||
import org.apache.dubbo.common.logger.Logger;
|
||||
import org.apache.dubbo.common.logger.ErrorTypeAwareLogger;
|
||||
import org.apache.dubbo.common.logger.LoggerFactory;
|
||||
import org.apache.dubbo.common.status.Status;
|
||||
import org.apache.dubbo.common.status.StatusChecker;
|
||||
|
|
@ -29,13 +29,15 @@ import org.springframework.context.Lifecycle;
|
|||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.CONFIG_WARN_STATUS_CHECKER;
|
||||
|
||||
/**
|
||||
* SpringStatusChecker
|
||||
*/
|
||||
@Activate
|
||||
public class SpringStatusChecker implements StatusChecker {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(SpringStatusChecker.class);
|
||||
private static final ErrorTypeAwareLogger logger = LoggerFactory.getErrorTypeAwareLogger(SpringStatusChecker.class);
|
||||
|
||||
private ApplicationModel applicationModel;
|
||||
|
||||
|
|
@ -100,7 +102,7 @@ public class SpringStatusChecker implements StatusChecker {
|
|||
if (t.getCause() instanceof UnsupportedOperationException){
|
||||
logger.debug(t.getMessage(), t);
|
||||
}else {
|
||||
logger.warn(t.getMessage(), t);
|
||||
logger.warn(CONFIG_WARN_STATUS_CHECKER, "", "", t.getMessage(), t);
|
||||
}
|
||||
}
|
||||
return new Status(level, buf.toString());
|
||||
|
|
|
|||
|
|
@ -48,6 +48,8 @@ import static org.apache.dubbo.common.constants.CommonConstants.CLUSTER_KEY;
|
|||
import static org.apache.dubbo.common.constants.CommonConstants.COMMA_SPLIT_PATTERN;
|
||||
import static org.apache.dubbo.common.constants.CommonConstants.CONFIG_NAMESPACE_KEY;
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.CONFIG_FAILED_CONNECT_REGISTRY;
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.CONFIG_FAILED_CLOSE_CONNECT_APOLLO;
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.CONFIG_NOT_EFFECT_EMPTY_RULE_APOLLO;
|
||||
|
||||
/**
|
||||
* Apollo implementation, https://github.com/ctripcorp/apollo
|
||||
|
|
@ -122,7 +124,7 @@ public class ApolloDynamicConfiguration implements DynamicConfiguration {
|
|||
try {
|
||||
listeners.clear();
|
||||
} catch (UnsupportedOperationException e) {
|
||||
logger.warn("Failed to close connect from config center, the config center is Apollo");
|
||||
logger.warn(CONFIG_FAILED_CLOSE_CONNECT_APOLLO, "", "", "Failed to close connect from config center, the config center is Apollo");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -236,7 +238,7 @@ public class ApolloDynamicConfiguration implements DynamicConfiguration {
|
|||
for (String key : changeEvent.changedKeys()) {
|
||||
ConfigChange change = changeEvent.getChange(key);
|
||||
if ("".equals(change.getNewValue())) {
|
||||
logger.warn("an empty rule is received for " + key + ", the current working rule is " +
|
||||
logger.warn(CONFIG_NOT_EFFECT_EMPTY_RULE_APOLLO, "", "", "an empty rule is received for " + key + ", the current working rule is " +
|
||||
change.getOldValue() + ", the empty rule will not take effect.");
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ import org.apache.dubbo.common.config.configcenter.ConfigChangedEvent;
|
|||
import org.apache.dubbo.common.config.configcenter.ConfigItem;
|
||||
import org.apache.dubbo.common.config.configcenter.ConfigurationListener;
|
||||
import org.apache.dubbo.common.config.configcenter.DynamicConfiguration;
|
||||
import org.apache.dubbo.common.logger.Logger;
|
||||
import org.apache.dubbo.common.logger.ErrorTypeAwareLogger;
|
||||
import org.apache.dubbo.common.logger.LoggerFactory;
|
||||
import org.apache.dubbo.common.utils.MD5Utils;
|
||||
import org.apache.dubbo.common.utils.StringUtils;
|
||||
|
|
@ -44,6 +44,7 @@ import java.util.concurrent.Executor;
|
|||
import static com.alibaba.nacos.api.PropertyKeyConst.PASSWORD;
|
||||
import static com.alibaba.nacos.api.PropertyKeyConst.SERVER_ADDR;
|
||||
import static com.alibaba.nacos.api.PropertyKeyConst.USERNAME;
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.CONFIG_ERROR_NACOS;
|
||||
import static org.apache.dubbo.common.constants.RemotingConstants.BACKUP_KEY;
|
||||
import static org.apache.dubbo.common.utils.StringConstantFieldValuePredicate.of;
|
||||
import static org.apache.dubbo.common.utils.StringUtils.HYPHEN_CHAR;
|
||||
|
|
@ -55,7 +56,7 @@ public class NacosDynamicConfiguration implements DynamicConfiguration {
|
|||
|
||||
private static final String GET_CONFIG_KEYS_PATH = "/v1/cs/configs";
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(getClass());
|
||||
private final ErrorTypeAwareLogger logger = LoggerFactory.getErrorTypeAwareLogger(getClass());
|
||||
/**
|
||||
* the default timeout in millis to get config from nacos
|
||||
*/
|
||||
|
|
@ -87,7 +88,7 @@ public class NacosDynamicConfiguration implements DynamicConfiguration {
|
|||
configService = NacosFactory.createConfigService(nacosProperties);
|
||||
} catch (NacosException e) {
|
||||
if (logger.isErrorEnabled()) {
|
||||
logger.error(e.getErrMsg(), e);
|
||||
logger.error(CONFIG_ERROR_NACOS, "", "", e.getMessage(), e);
|
||||
}
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
|
|
@ -172,7 +173,7 @@ public class NacosDynamicConfiguration implements DynamicConfiguration {
|
|||
try {
|
||||
configService.addListener(key, group, nacosConfigListener);
|
||||
} catch (NacosException e) {
|
||||
logger.error(e.getMessage());
|
||||
logger.error(CONFIG_ERROR_NACOS, "", "", e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -194,7 +195,7 @@ public class NacosDynamicConfiguration implements DynamicConfiguration {
|
|||
}
|
||||
return configService.getConfig(key, group, nacosTimeout);
|
||||
} catch (NacosException e) {
|
||||
logger.error(e.getMessage());
|
||||
logger.error(CONFIG_ERROR_NACOS, "", "", e.getMessage(), e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
@ -214,7 +215,7 @@ public class NacosDynamicConfiguration implements DynamicConfiguration {
|
|||
try {
|
||||
return configService.getConfig(key, DEFAULT_GROUP, getDefaultTimeout());
|
||||
} catch (NacosException e) {
|
||||
logger.error(e.getMessage());
|
||||
logger.error(CONFIG_ERROR_NACOS, "", "", e.getMessage(), e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
@ -225,7 +226,7 @@ public class NacosDynamicConfiguration implements DynamicConfiguration {
|
|||
try {
|
||||
published = configService.publishConfig(key, group, content);
|
||||
} catch (NacosException e) {
|
||||
logger.error(e.getErrMsg(), e);
|
||||
logger.error(CONFIG_ERROR_NACOS, "", "", e.getMessage(), e);
|
||||
}
|
||||
return published;
|
||||
}
|
||||
|
|
@ -238,7 +239,7 @@ public class NacosDynamicConfiguration implements DynamicConfiguration {
|
|||
}
|
||||
return configService.publishConfigCas(key, group, content, (String) ticket);
|
||||
} catch (NacosException e) {
|
||||
logger.warn("nacos publishConfigCas failed.", e);
|
||||
logger.warn(CONFIG_ERROR_NACOS, "nacos publishConfigCas failed.", "", e.getMessage(), e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -255,7 +256,7 @@ public class NacosDynamicConfiguration implements DynamicConfiguration {
|
|||
removed = configService.removeConfig(key, group);
|
||||
} catch (NacosException e) {
|
||||
if (logger.isErrorEnabled()) {
|
||||
logger.error(e.getMessage(), e);
|
||||
logger.error(CONFIG_ERROR_NACOS, "", "", e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
return removed;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
package org.apache.dubbo.container;
|
||||
|
||||
import org.apache.dubbo.common.extension.ExtensionLoader;
|
||||
import org.apache.dubbo.common.logger.Logger;
|
||||
import org.apache.dubbo.common.logger.ErrorTypeAwareLogger;
|
||||
import org.apache.dubbo.common.logger.LoggerFactory;
|
||||
import org.apache.dubbo.common.utils.ArrayUtils;
|
||||
|
||||
|
|
@ -30,6 +30,9 @@ import java.util.concurrent.locks.Condition;
|
|||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
import static org.apache.dubbo.common.constants.CommonConstants.COMMA_SPLIT_PATTERN;
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.CONFIG_START_DUBBO_ERROR;
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.CONFIG_STOP_DUBBO_ERROR;
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.COMMON_THREAD_INTERRUPTED_EXCEPTION;
|
||||
|
||||
/**
|
||||
* Main. (API, Static, ThreadSafe)
|
||||
|
|
@ -42,7 +45,7 @@ public class Main {
|
|||
|
||||
public static final String SHUTDOWN_HOOK_KEY = "dubbo.shutdown.hook";
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(Main.class);
|
||||
private static final ErrorTypeAwareLogger logger = LoggerFactory.getErrorTypeAwareLogger(Main.class);
|
||||
|
||||
private static final ExtensionLoader<Container> LOADER = ExtensionLoader.getExtensionLoader(Container.class);
|
||||
|
||||
|
|
@ -72,7 +75,7 @@ public class Main {
|
|||
container.stop();
|
||||
logger.info("Dubbo " + container.getClass().getSimpleName() + " stopped!");
|
||||
} catch (Throwable t) {
|
||||
logger.error(t.getMessage(), t);
|
||||
logger.error(CONFIG_STOP_DUBBO_ERROR, "", "", t.getMessage(), t);
|
||||
}
|
||||
try {
|
||||
LOCK.lock();
|
||||
|
|
@ -91,14 +94,14 @@ public class Main {
|
|||
}
|
||||
System.out.println(new SimpleDateFormat("[yyyy-MM-dd HH:mm:ss]").format(new Date()) + " Dubbo service server started!");
|
||||
} catch (RuntimeException e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
logger.error(CONFIG_START_DUBBO_ERROR, "", "", e.getMessage(), e);
|
||||
System.exit(1);
|
||||
}
|
||||
try {
|
||||
LOCK.lock();
|
||||
STOP.await();
|
||||
} catch (InterruptedException e) {
|
||||
logger.warn("Dubbo service server stopped, interrupted by other thread!", e);
|
||||
logger.warn(COMMON_THREAD_INTERRUPTED_EXCEPTION, "", "", "Dubbo service server stopped, interrupted by other thread!", e);
|
||||
} finally {
|
||||
LOCK.unlock();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,13 +16,15 @@
|
|||
*/
|
||||
package org.apache.dubbo.container.spring;
|
||||
|
||||
import org.apache.dubbo.common.logger.Logger;
|
||||
import org.apache.dubbo.common.logger.ErrorTypeAwareLogger;
|
||||
import org.apache.dubbo.common.logger.LoggerFactory;
|
||||
import org.apache.dubbo.common.utils.StringUtils;
|
||||
import org.apache.dubbo.container.Container;
|
||||
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.CONFIG_STOP_DUBBO_ERROR;
|
||||
|
||||
/**
|
||||
* SpringContainer. (SPI, Singleton, ThreadSafe)
|
||||
*
|
||||
|
|
@ -32,7 +34,7 @@ public class SpringContainer implements Container {
|
|||
|
||||
public static final String SPRING_CONFIG = "dubbo.spring.config";
|
||||
public static final String DEFAULT_SPRING_CONFIG = "classpath*:META-INF/spring/*.xml";
|
||||
private static final Logger logger = LoggerFactory.getLogger(SpringContainer.class);
|
||||
private static final ErrorTypeAwareLogger logger = LoggerFactory.getErrorTypeAwareLogger(SpringContainer.class);
|
||||
static ClassPathXmlApplicationContext context;
|
||||
|
||||
public static ClassPathXmlApplicationContext getContext() {
|
||||
|
|
@ -59,7 +61,7 @@ public class SpringContainer implements Container {
|
|||
context = null;
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
logger.error(CONFIG_STOP_DUBBO_ERROR, "", "", e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ package org.apache.dubbo.validation.support.jvalidation;
|
|||
|
||||
import org.apache.dubbo.common.URL;
|
||||
import org.apache.dubbo.common.bytecode.ClassGenerator;
|
||||
import org.apache.dubbo.common.logger.Logger;
|
||||
import org.apache.dubbo.common.logger.ErrorTypeAwareLogger;
|
||||
import org.apache.dubbo.common.logger.LoggerFactory;
|
||||
import org.apache.dubbo.common.utils.ReflectUtils;
|
||||
import org.apache.dubbo.validation.MethodValidated;
|
||||
|
|
@ -67,6 +67,8 @@ import java.util.Map;
|
|||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.CONFIG_FILTER_VALIDATION_EXCEPTION;
|
||||
|
||||
/**
|
||||
* Implementation of JValidation. JValidation is invoked if configuration validation attribute value is 'jvalidation'.
|
||||
* <pre>
|
||||
|
|
@ -75,7 +77,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||
*/
|
||||
public class JValidator implements Validator {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(JValidator.class);
|
||||
private static final ErrorTypeAwareLogger logger = LoggerFactory.getErrorTypeAwareLogger(JValidator.class);
|
||||
|
||||
private final Class<?> clazz;
|
||||
|
||||
|
|
@ -116,7 +118,7 @@ public class JValidator implements Validator {
|
|||
}
|
||||
return parameterBean;
|
||||
} catch (Throwable e) {
|
||||
logger.warn(e.getMessage(), e);
|
||||
logger.warn(CONFIG_FILTER_VALIDATION_EXCEPTION, "", "", e.getMessage(), e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ package org.apache.dubbo.validation.support.jvalidation;
|
|||
|
||||
import org.apache.dubbo.common.URL;
|
||||
import org.apache.dubbo.common.bytecode.ClassGenerator;
|
||||
import org.apache.dubbo.common.logger.Logger;
|
||||
import org.apache.dubbo.common.logger.ErrorTypeAwareLogger;
|
||||
import org.apache.dubbo.common.logger.LoggerFactory;
|
||||
import org.apache.dubbo.common.utils.ReflectUtils;
|
||||
import org.apache.dubbo.validation.MethodValidated;
|
||||
|
|
@ -67,6 +67,8 @@ import java.util.Map;
|
|||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.CONFIG_FILTER_VALIDATION_EXCEPTION;
|
||||
|
||||
/**
|
||||
* Implementation of JValidationNew. JValidationNew is invoked if configuration validation attribute value is 'jvalidationNew'.
|
||||
* <pre>
|
||||
|
|
@ -75,7 +77,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||
*/
|
||||
public class JValidatorNew implements Validator {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(JValidatorNew.class);
|
||||
private static final ErrorTypeAwareLogger logger = LoggerFactory.getErrorTypeAwareLogger(JValidatorNew.class);
|
||||
|
||||
private final Class<?> clazz;
|
||||
|
||||
|
|
@ -116,7 +118,7 @@ public class JValidatorNew implements Validator {
|
|||
}
|
||||
return parameterBean;
|
||||
} catch (Throwable e) {
|
||||
logger.warn(e.getMessage(), e);
|
||||
logger.warn(CONFIG_FILTER_VALIDATION_EXCEPTION, "", "", e.getMessage(), e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
*/
|
||||
package org.apache.dubbo.registry.kubernetes;
|
||||
|
||||
import org.apache.dubbo.common.logger.Logger;
|
||||
import org.apache.dubbo.common.logger.ErrorTypeAwareLogger;
|
||||
import org.apache.dubbo.common.logger.LoggerFactory;
|
||||
import org.apache.dubbo.rpc.cluster.router.mesh.route.MeshAppRuleListener;
|
||||
import org.apache.dubbo.rpc.cluster.router.mesh.route.MeshEnvListener;
|
||||
|
|
@ -32,8 +32,10 @@ import org.yaml.snakeyaml.constructor.SafeConstructor;
|
|||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.REGISTRY_ERROR_LISTEN_KUBERNETES;
|
||||
|
||||
public class KubernetesMeshEnvListener implements MeshEnvListener {
|
||||
public static final Logger logger = LoggerFactory.getLogger(KubernetesMeshEnvListener.class);
|
||||
public static final ErrorTypeAwareLogger logger = LoggerFactory.getErrorTypeAwareLogger(KubernetesMeshEnvListener.class);
|
||||
private volatile static boolean usingApiServer = false;
|
||||
private volatile static KubernetesClient kubernetesClient;
|
||||
private volatile static String namespace;
|
||||
|
|
@ -119,7 +121,7 @@ public class KubernetesMeshEnvListener implements MeshEnvListener {
|
|||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("Error occurred when listen kubernetes crd.", e);
|
||||
logger.error(REGISTRY_ERROR_LISTEN_KUBERNETES, "", "", "Error occurred when listen kubernetes crd.", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -178,7 +180,7 @@ public class KubernetesMeshEnvListener implements MeshEnvListener {
|
|||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("Error occurred when listen kubernetes crd.", e);
|
||||
logger.error(REGISTRY_ERROR_LISTEN_KUBERNETES, "", "", "Error occurred when listen kubernetes crd.", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
package org.apache.dubbo.registry.kubernetes;
|
||||
|
||||
import org.apache.dubbo.common.URL;
|
||||
import org.apache.dubbo.common.logger.Logger;
|
||||
import org.apache.dubbo.common.logger.ErrorTypeAwareLogger;
|
||||
import org.apache.dubbo.common.logger.LoggerFactory;
|
||||
import org.apache.dubbo.common.utils.StringUtils;
|
||||
import org.apache.dubbo.registry.client.AbstractServiceDiscovery;
|
||||
|
|
@ -53,8 +53,12 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||
import java.util.concurrent.atomic.AtomicLong;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.REGISTRY_UNABLE_FIND_SERVICE_KUBERNETES;
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.REGISTRY_UNABLE_MATCH_KUBERNETES;
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.REGISTRY_UNABLE_ACCESS_KUBERNETES;
|
||||
|
||||
public class KubernetesServiceDiscovery extends AbstractServiceDiscovery {
|
||||
private final Logger logger = LoggerFactory.getLogger(getClass());
|
||||
private final ErrorTypeAwareLogger logger = LoggerFactory.getErrorTypeAwareLogger(getClass());
|
||||
|
||||
private KubernetesClient kubernetesClient;
|
||||
|
||||
|
|
@ -96,7 +100,7 @@ public class KubernetesServiceDiscovery extends AbstractServiceDiscovery {
|
|||
"Please check your url config." +
|
||||
" Master URL: " + config.getMasterUrl() +
|
||||
" Hostname: " + currentHostname;
|
||||
logger.error(message);
|
||||
logger.error(REGISTRY_UNABLE_ACCESS_KUBERNETES,"","",message);
|
||||
} else {
|
||||
KubernetesMeshEnvListener.injectKubernetesEnv(kubernetesClient, namespace);
|
||||
}
|
||||
|
|
@ -403,8 +407,8 @@ public class KubernetesServiceDiscovery extends AbstractServiceDiscovery {
|
|||
Pod pod = pods.get(address.getTargetRef().getName());
|
||||
String ip = address.getIp();
|
||||
if (pod == null) {
|
||||
logger.warn("Unable to match Kubernetes Endpoint address with Pod. " +
|
||||
"EndpointAddress Hostname: " + address.getTargetRef().getName());
|
||||
logger.warn(REGISTRY_UNABLE_MATCH_KUBERNETES, "", "", "Unable to match Kubernetes Endpoint address with Pod. " +
|
||||
"EndpointAddress Hostname: " + address.getTargetRef().getName());
|
||||
continue;
|
||||
}
|
||||
instancePorts.forEach(port -> {
|
||||
|
|
@ -415,7 +419,7 @@ public class KubernetesServiceDiscovery extends AbstractServiceDiscovery {
|
|||
serviceInstance.getMetadata().putAll(JSONObject.parseObject(properties, Map.class));
|
||||
instances.add(serviceInstance);
|
||||
} else {
|
||||
logger.warn("Unable to find Service Instance metadata in Pod Annotations. " +
|
||||
logger.warn(REGISTRY_UNABLE_FIND_SERVICE_KUBERNETES, "", "", "Unable to find Service Instance metadata in Pod Annotations. " +
|
||||
"Possibly cause: provider has not been initialized successfully. " +
|
||||
"EndpointAddress Hostname: " + address.getTargetRef().getName());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
*/
|
||||
package org.apache.dubbo.test.check.registrycenter.initializer;
|
||||
|
||||
import org.apache.dubbo.common.logger.Logger;
|
||||
import org.apache.dubbo.common.logger.ErrorTypeAwareLogger;
|
||||
import org.apache.dubbo.common.logger.LoggerFactory;
|
||||
import org.apache.dubbo.test.check.exception.DubboTestException;
|
||||
import org.apache.dubbo.test.check.registrycenter.context.ZookeeperContext;
|
||||
|
|
@ -37,12 +37,14 @@ import java.util.concurrent.Future;
|
|||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.REGISTRY_FAILED_DOWNLOAD_FILE;
|
||||
|
||||
/**
|
||||
* Download zookeeper binary archive.
|
||||
*/
|
||||
public class DownloadZookeeperInitializer extends ZookeeperInitializer {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(DownloadZookeeperInitializer.class);
|
||||
private static final ErrorTypeAwareLogger logger = LoggerFactory.getErrorTypeAwareLogger(DownloadZookeeperInitializer.class);
|
||||
|
||||
/**
|
||||
* The zookeeper binary file name format.
|
||||
|
|
@ -167,7 +169,7 @@ public class DownloadZookeeperInitializer extends ZookeeperInitializer {
|
|||
|
||||
@Override
|
||||
public void onThrowable(Throwable t) {
|
||||
logger.warn("Failed to download the file, download url: " + url);
|
||||
logger.warn(REGISTRY_FAILED_DOWNLOAD_FILE, "", "", "Failed to download the file, download url: " + url);
|
||||
super.onThrowable(t);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
*/
|
||||
package org.apache.dubbo.test.check.registrycenter.processor;
|
||||
|
||||
import org.apache.dubbo.common.logger.Logger;
|
||||
import org.apache.dubbo.common.logger.ErrorTypeAwareLogger;
|
||||
import org.apache.dubbo.common.logger.LoggerFactory;
|
||||
import org.apache.dubbo.test.check.exception.DubboTestException;
|
||||
import org.apache.dubbo.test.check.registrycenter.Context;
|
||||
|
|
@ -29,12 +29,15 @@ import java.io.InputStream;
|
|||
import java.io.InputStreamReader;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.REGISTRY_FAILED_START_ZOOKEEPER;
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.REGISTRY_FAILED_STOP_ZOOKEEPER;
|
||||
|
||||
/**
|
||||
* The abstract implementation of {@link Processor} is to provide some common methods on Unix OS.
|
||||
*/
|
||||
public abstract class ZookeeperUnixProcessor implements Processor {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(ZookeeperUnixProcessor.class);
|
||||
private static final ErrorTypeAwareLogger logger = LoggerFactory.getErrorTypeAwareLogger(ZookeeperUnixProcessor.class);
|
||||
|
||||
@Override
|
||||
public void process(Context context) throws DubboTestException {
|
||||
|
|
@ -47,7 +50,7 @@ public abstract class ZookeeperUnixProcessor implements Processor {
|
|||
try {
|
||||
process.destroy();
|
||||
} catch (Throwable cause) {
|
||||
logger.warn(String.format("Failed to kill the process, with client port %s !", clientPort), cause);
|
||||
logger.warn(REGISTRY_FAILED_STOP_ZOOKEEPER, "", "", String.format("Failed to kill the process, with client port %s !", clientPort), cause);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -61,7 +64,7 @@ public abstract class ZookeeperUnixProcessor implements Processor {
|
|||
try (final BufferedReader reader = new BufferedReader(new InputStreamReader(errorStream))) {
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
logger.error(line);
|
||||
logger.error(REGISTRY_FAILED_START_ZOOKEEPER,"","",line);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
/* eat quietly */
|
||||
|
|
|
|||
Loading…
Reference in New Issue