You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by gu...@apache.org on 2021/09/01 07:21:19 UTC
[dubbo] branch 3.0 updated: When use delay to export service,
catch the exception and log it. (#8584)
This is an automated email from the ASF dual-hosted git repository.
guohao pushed a commit to branch 3.0
in repository https://gitbox.apache.org/repos/asf/dubbo.git
The following commit(s) were added to refs/heads/3.0 by this push:
new 067dba3 When use delay to export service, catch the exception and log it. (#8584)
067dba3 is described below
commit 067dba3afed44b5b91350e75e62de95ecce3c693
Author: 赵延 <ho...@apache.org>
AuthorDate: Wed Sep 1 15:21:02 2021 +0800
When use delay to export service, catch the exception and log it. (#8584)
* when use delay to export service, catch the exception and log it.
* format file
* enhance log info.
---
.../src/main/java/org/apache/dubbo/config/ServiceConfig.java | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ServiceConfig.java b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ServiceConfig.java
index 4c07ecc..f527cb1 100644
--- a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ServiceConfig.java
+++ b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ServiceConfig.java
@@ -226,7 +226,7 @@ public class ServiceConfig<T> extends ServiceConfigBase<T> {
}
if (shouldDelay()) {
- DELAY_EXPORT_EXECUTOR.schedule(this::doExport, getDelay(), TimeUnit.MILLISECONDS);
+ doDelayExport();
} else {
doExport();
}
@@ -237,6 +237,16 @@ public class ServiceConfig<T> extends ServiceConfigBase<T> {
}
}
+ protected void doDelayExport() {
+ DELAY_EXPORT_EXECUTOR.schedule(() -> {
+ try {
+ doExport();
+ } catch (Exception e) {
+ logger.error("Failed to export service config: " + interfaceName, e);
+ }
+ }, getDelay(), TimeUnit.MILLISECONDS);
+ }
+
protected void exported() {
exported = true;
List<URL> exportedURLs = this.getExportedUrls();