From 6ad7e7cbeeb956bf162d11d7e496da693ad6c2e3 Mon Sep 17 00:00:00 2001 From: code4wt Date: Thu, 25 Oct 2018 13:04:50 +0800 Subject: [PATCH 1/2] Refactor method isDelay of ServiceBean to fix the wrong meaning of the method --- .../java/org/apache/dubbo/config/spring/ServiceBean.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/ServiceBean.java b/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/ServiceBean.java index 1d5ff8e8d30..2536aa1dba6 100644 --- a/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/ServiceBean.java +++ b/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/ServiceBean.java @@ -107,7 +107,7 @@ public Service getService() { @Override public void onApplicationEvent(ContextRefreshedEvent event) { - if (isDelay() && !isExported() && !isUnexported()) { + if (!isDelay() && !isExported() && !isUnexported()) { if (logger.isInfoEnabled()) { logger.info("The service ready on spring started. service: " + getInterface()); } @@ -121,7 +121,7 @@ private boolean isDelay() { if (delay == null && provider != null) { delay = provider.getDelay(); } - return supportedApplicationListener && (delay == null || delay == -1); + return delay != null && delay > 0; } @Override @@ -251,7 +251,7 @@ && getInterface() != null && getInterface().length() > 0 setPath(beanName); } } - if (!isDelay()) { + if (!supportedApplicationListener || isDelay()) { export(); } } From 2f1b7675ddd5dc563602e22096dc50a4445d9eb8 Mon Sep 17 00:00:00 2001 From: code4wt Date: Tue, 30 Oct 2018 11:49:25 +0800 Subject: [PATCH 2/2] Remove unnecessary method isDelay of ServiceBean --- .../org/apache/dubbo/config/spring/ServiceBean.java | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/ServiceBean.java b/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/ServiceBean.java index 2536aa1dba6..6d7bc9b6476 100644 --- a/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/ServiceBean.java +++ b/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/ServiceBean.java @@ -107,7 +107,7 @@ public Service getService() { @Override public void onApplicationEvent(ContextRefreshedEvent event) { - if (!isDelay() && !isExported() && !isUnexported()) { + if (!isExported() && !isUnexported()) { if (logger.isInfoEnabled()) { logger.info("The service ready on spring started. service: " + getInterface()); } @@ -115,15 +115,6 @@ public void onApplicationEvent(ContextRefreshedEvent event) { } } - private boolean isDelay() { - Integer delay = getDelay(); - ProviderConfig provider = getProvider(); - if (delay == null && provider != null) { - delay = provider.getDelay(); - } - return delay != null && delay > 0; - } - @Override @SuppressWarnings({"unchecked", "deprecation"}) public void afterPropertiesSet() throws Exception { @@ -251,7 +242,7 @@ && getInterface() != null && getInterface().length() > 0 setPath(beanName); } } - if (!supportedApplicationListener || isDelay()) { + if (!supportedApplicationListener) { export(); } }