From a0a84222d71f6e16efb70805e9d355280e1aea8c Mon Sep 17 00:00:00 2001 From: cvictory Date: Fri, 25 Jan 2019 10:54:45 +0800 Subject: [PATCH 1/6] fix #2842. remove duplicate SPI definitions for 2.7.x --- dubbo-all/pom.xml | 12 ++++++++++++ dubbo-container/dubbo-container-api/pom.xml | 3 +-- pom.xml | 1 - 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/dubbo-all/pom.xml b/dubbo-all/pom.xml index 8c46af627db..15fd731d706 100644 --- a/dubbo-all/pom.xml +++ b/dubbo-all/pom.xml @@ -614,6 +614,18 @@ + + + org.apache.dubbo:dubbo + + + com/** + org/** + + META-INF/dubbo/** + + + diff --git a/dubbo-container/dubbo-container-api/pom.xml b/dubbo-container/dubbo-container-api/pom.xml index 2e1f544064f..2c1e9100af5 100644 --- a/dubbo-container/dubbo-container-api/pom.xml +++ b/dubbo-container/dubbo-container-api/pom.xml @@ -47,9 +47,8 @@ org.apache.dubbo.container.Main - true - \ No newline at end of file + diff --git a/pom.xml b/pom.xml index 4cbb67e5b46..8f1a39b7201 100644 --- a/pom.xml +++ b/pom.xml @@ -389,7 +389,6 @@ ${project.version} - true From 19824c3a9d436b5a19bb9cc211935ae5750d2314 Mon Sep 17 00:00:00 2001 From: cvictory Date: Thu, 21 Feb 2019 10:42:06 +0800 Subject: [PATCH 2/6] fix: rename the thread name from DubboRegistryFailedRetryTimer to DubboMetadataReportRetryTimer in MetadataReportRetry --- .../dubbo/metadata/support/AbstractMetadataReport.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dubbo-metadata-report/dubbo-metadata-report-api/src/main/java/org/apache/dubbo/metadata/support/AbstractMetadataReport.java b/dubbo-metadata-report/dubbo-metadata-report-api/src/main/java/org/apache/dubbo/metadata/support/AbstractMetadataReport.java index 6080fa58f82..95b44f44927 100644 --- a/dubbo-metadata-report/dubbo-metadata-report-api/src/main/java/org/apache/dubbo/metadata/support/AbstractMetadataReport.java +++ b/dubbo-metadata-report/dubbo-metadata-report-api/src/main/java/org/apache/dubbo/metadata/support/AbstractMetadataReport.java @@ -62,7 +62,7 @@ public abstract class AbstractMetadataReport implements MetadataReport { // Log output protected final Logger logger = LoggerFactory.getLogger(getClass()); - // Local disk cache, where the special key value.registries records the list of registry centers, and the others are the list of notified service providers + // Local disk cache, where the special key value.registries records the list of metadata centers, and the others are the list of notified service providers final Properties properties = new Properties(); private final ExecutorService reportCacheExecutor = Executors.newFixedThreadPool(1, new NamedThreadFactory("DubboSaveMetadataReport", true)); final Map allMetadataReports = new ConcurrentHashMap<>(4); @@ -336,7 +336,7 @@ long calculateStartTime() { class MetadataReportRetry { protected final Logger logger = LoggerFactory.getLogger(getClass()); - final ScheduledExecutorService retryExecutor = Executors.newScheduledThreadPool(0, new NamedThreadFactory("DubboRegistryFailedRetryTimer", true)); + final ScheduledExecutorService retryExecutor = Executors.newScheduledThreadPool(0, new NamedThreadFactory("DubboMetadataReportRetryTimer", true)); volatile ScheduledFuture retryScheduledFuture; AtomicInteger retryCounter = new AtomicInteger(0); // retry task schedule period @@ -358,7 +358,7 @@ void startRetryTask() { retryScheduledFuture = retryExecutor.scheduleWithFixedDelay(new Runnable() { @Override public void run() { - // Check and connect to the registry + // Check and connect to the metadata try { int times = retryCounter.incrementAndGet(); logger.info("start to retry task for metadata report. retry times:" + times); From c0da2ee8c5c98d9c5e23c5288c6a6a3287f3537e Mon Sep 17 00:00:00 2001 From: cvictory Date: Wed, 17 Apr 2019 19:08:38 +0800 Subject: [PATCH 3/6] compatible with Regigistry. #3882 --- .../dubbo/common/utils/StringUtils.java | 2 +- .../alibaba/dubbo/common/utils/UrlUtils.java | 93 ++++++++++ .../dubbo/registry/NotifyListener.java | 16 ++ .../registry/support/AbstractRegistry.java | 129 +++++++++++++ .../support/AbstractRegistryFactory.java | 18 ++ .../registry/support/FailbackRegistry.java | 171 ++++++++++++++++++ .../registry/support/FailbackRegistry.java | 40 +++- 7 files changed, 463 insertions(+), 6 deletions(-) create mode 100644 dubbo-compatible/src/main/java/com/alibaba/dubbo/common/utils/UrlUtils.java create mode 100644 dubbo-compatible/src/main/java/com/alibaba/dubbo/registry/support/AbstractRegistry.java create mode 100644 dubbo-compatible/src/main/java/com/alibaba/dubbo/registry/support/AbstractRegistryFactory.java create mode 100644 dubbo-compatible/src/main/java/com/alibaba/dubbo/registry/support/FailbackRegistry.java diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/utils/StringUtils.java b/dubbo-common/src/main/java/org/apache/dubbo/common/utils/StringUtils.java index a351346ef1a..a3d59c3960b 100644 --- a/dubbo-common/src/main/java/org/apache/dubbo/common/utils/StringUtils.java +++ b/dubbo-common/src/main/java/org/apache/dubbo/common/utils/StringUtils.java @@ -48,7 +48,7 @@ public final class StringUtils { private static final Pattern INT_PATTERN = Pattern.compile("^\\d+$"); private static final int PAD_LIMIT = 8192; - private StringUtils() { + protected StringUtils() { } /** diff --git a/dubbo-compatible/src/main/java/com/alibaba/dubbo/common/utils/UrlUtils.java b/dubbo-compatible/src/main/java/com/alibaba/dubbo/common/utils/UrlUtils.java new file mode 100644 index 00000000000..33502614f79 --- /dev/null +++ b/dubbo-compatible/src/main/java/com/alibaba/dubbo/common/utils/UrlUtils.java @@ -0,0 +1,93 @@ +package com.alibaba.dubbo.common.utils; + +import com.alibaba.dubbo.common.URL; + +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + +/** + * @author cvictory ON 2019-04-17 + */ +public class UrlUtils { + + public static URL parseURL(String address, Map defaults) { + return new URL(UrlUtils.parseURL(address, defaults)); + } + + public static List parseURLs(String address, Map defaults) { + return UrlUtils.parseURLs(address, defaults).stream().map(e -> new URL(e)).collect(Collectors.toList()); + } + + public static Map> convertRegister(Map> register) { + return org.apache.dubbo.common.utils.UrlUtils.convertRegister(register); + } + + public static Map convertSubscribe(Map subscribe) { + return org.apache.dubbo.common.utils.UrlUtils.convertSubscribe(subscribe); + } + + public static Map> revertRegister(Map> register) { + return org.apache.dubbo.common.utils.UrlUtils.revertRegister(register); + } + + public static Map revertSubscribe(Map subscribe) { + return org.apache.dubbo.common.utils.UrlUtils.revertSubscribe(subscribe); + } + + public static Map> revertNotify(Map> notify) { + return org.apache.dubbo.common.utils.UrlUtils.revertNotify(notify); + } + + //compatible for dubbo-2.0.0 + public static List revertForbid(List forbid, Set subscribed) { + Set urls = subscribed.stream().map(e -> e.getOriginalURL()).collect(Collectors.toSet()); + return org.apache.dubbo.common.utils.UrlUtils.revertForbid(forbid, urls); + } + + public static URL getEmptyUrl(String service, String category) { + return new URL(org.apache.dubbo.common.utils.UrlUtils.getEmptyUrl(service, category)); + } + + public static boolean isMatchCategory(String category, String categories) { + return org.apache.dubbo.common.utils.UrlUtils.isMatchCategory(category, categories); + } + + public static boolean isMatch(URL consumerUrl, URL providerUrl) { + return org.apache.dubbo.common.utils.UrlUtils.isMatch(consumerUrl.getOriginalURL(), providerUrl.getOriginalURL()); + } + + public static boolean isMatchGlobPattern(String pattern, String value, URL param) { + return org.apache.dubbo.common.utils.UrlUtils.isMatchGlobPattern(pattern, value, param.getOriginalURL()); + } + + public static boolean isMatchGlobPattern(String pattern, String value) { + return org.apache.dubbo.common.utils.UrlUtils.isMatchGlobPattern(pattern, value); + } + + public static boolean isServiceKeyMatch(URL pattern, URL value) { + return org.apache.dubbo.common.utils.UrlUtils.isServiceKeyMatch(pattern.getOriginalURL(), value.getOriginalURL()); + } + + + public static boolean isConfigurator(URL url) { + return org.apache.dubbo.common.utils.UrlUtils.isConfigurator(url.getOriginalURL()); + } + + public static boolean isRoute(URL url) { + return org.apache.dubbo.common.utils.UrlUtils.isRoute(url.getOriginalURL()); + } + + public static boolean isProvider(URL url) { + return org.apache.dubbo.common.utils.UrlUtils.isProvider(url.getOriginalURL()); + } + + public static int getHeartbeat(URL url) { + return org.apache.dubbo.common.utils.UrlUtils.getHeartbeat(url.getOriginalURL()); + } + + public static int getIdleTimeout(URL url) { + return org.apache.dubbo.common.utils.UrlUtils.getIdleTimeout(url.getOriginalURL()); + } +} diff --git a/dubbo-compatible/src/main/java/com/alibaba/dubbo/registry/NotifyListener.java b/dubbo-compatible/src/main/java/com/alibaba/dubbo/registry/NotifyListener.java index d7e82b5e144..633dc1b656e 100644 --- a/dubbo-compatible/src/main/java/com/alibaba/dubbo/registry/NotifyListener.java +++ b/dubbo-compatible/src/main/java/com/alibaba/dubbo/registry/NotifyListener.java @@ -42,4 +42,20 @@ public void notify(List urls) { } } } + + class ReverseCompatibleNotifyListener implements org.apache.dubbo.registry.NotifyListener { + + private NotifyListener listener; + + public ReverseCompatibleNotifyListener(NotifyListener listener) { + this.listener = listener; + } + + @Override + public void notify(List urls) { + if (listener != null) { + listener.notify(urls.stream().map(url -> new URL(url)).collect(Collectors.toList())); + } + } + } } diff --git a/dubbo-compatible/src/main/java/com/alibaba/dubbo/registry/support/AbstractRegistry.java b/dubbo-compatible/src/main/java/com/alibaba/dubbo/registry/support/AbstractRegistry.java new file mode 100644 index 00000000000..094d4e45072 --- /dev/null +++ b/dubbo-compatible/src/main/java/com/alibaba/dubbo/registry/support/AbstractRegistry.java @@ -0,0 +1,129 @@ +package com.alibaba.dubbo.registry.support; + +import org.apache.dubbo.common.URL; +import org.apache.dubbo.registry.NotifyListener; +import org.apache.dubbo.registry.Registry; + +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + +/** + * 2019-04-16 + */ +@Deprecated +public abstract class AbstractRegistry implements Registry { + + private CompatibleAbstractRegistry abstractRegistry; + + public AbstractRegistry(com.alibaba.dubbo.common.URL url) { + abstractRegistry = new CompatibleAbstractRegistry(url.getOriginalURL()); + } + + @Override + public com.alibaba.dubbo.common.URL getUrl() { + return new com.alibaba.dubbo.common.URL(abstractRegistry.getUrl()); + } + + protected void setUrl(com.alibaba.dubbo.common.URL url) { + abstractRegistry.setUrl(url.getOriginalURL()); + } + + public Set getRegistered() { + return abstractRegistry.getRegistered().stream().map(url -> new com.alibaba.dubbo.common.URL(url)).collect(Collectors.toSet()); + } + + public Map> getSubscribed() { + return abstractRegistry.getSubscribed().entrySet() + .stream() + .collect(Collectors.toMap(entry -> new com.alibaba.dubbo.common.URL(entry.getKey()), + entry -> convertToNotifyListeners(entry.getValue()))); + } + + public Map>> getNotified() { + return abstractRegistry.getNotified().entrySet().stream() + .collect(Collectors.toMap(entry -> new com.alibaba.dubbo.common.URL(entry.getKey()), + entry -> { + return entry.getValue().entrySet() + .stream() + .collect(Collectors.toMap(e -> e.getKey(), e -> { + return e.getValue().stream().map(url -> new com.alibaba.dubbo.common.URL(url)).collect(Collectors.toList()); + })); + })); + } + + + public List getCacheUrls(com.alibaba.dubbo.common.URL url) { + return abstractRegistry.lookup(url.getOriginalURL()).stream().map(tmpUrl -> new com.alibaba.dubbo.common.URL(tmpUrl)).collect(Collectors.toList()); + } + + public List lookup(com.alibaba.dubbo.common.URL url) { + return abstractRegistry.lookup(url.getOriginalURL()).stream().map(tmpUrl -> new com.alibaba.dubbo.common.URL(tmpUrl)).collect(Collectors.toList()); + } + + protected void notify(com.alibaba.dubbo.common.URL url, com.alibaba.dubbo.registry.NotifyListener listener, List urls) { + abstractRegistry.notify(url.getOriginalURL(), new com.alibaba.dubbo.registry.NotifyListener.ReverseCompatibleNotifyListener(listener), urls.stream().map(tmpUrl -> tmpUrl.getOriginalURL()).collect(Collectors.toList())); + } + + public void register(com.alibaba.dubbo.common.URL url) { + abstractRegistry.register(url.getOriginalURL()); + } + + public void unregister(com.alibaba.dubbo.common.URL url) { + abstractRegistry.unregister(url.getOriginalURL()); + } + + public void subscribe(com.alibaba.dubbo.common.URL url, com.alibaba.dubbo.registry.NotifyListener listener) { + abstractRegistry.subscribe(url.getOriginalURL(), new com.alibaba.dubbo.registry.NotifyListener.ReverseCompatibleNotifyListener(listener)); + } + + public void unsubscribe(com.alibaba.dubbo.common.URL url, com.alibaba.dubbo.registry.NotifyListener listener) { + abstractRegistry.unsubscribe(url.getOriginalURL(), new com.alibaba.dubbo.registry.NotifyListener.ReverseCompatibleNotifyListener(listener)); + } + + + @Override + public void register(URL url) { + this.register(new com.alibaba.dubbo.common.URL(url)); + } + + @Override + public void unregister(URL url) { + this.unregister(new com.alibaba.dubbo.common.URL(url)); + } + + @Override + public void subscribe(URL url, NotifyListener listener) { + this.subscribe(new com.alibaba.dubbo.common.URL(url), new com.alibaba.dubbo.registry.NotifyListener.CompatibleNotifyListener(listener)); + } + + @Override + public void unsubscribe(URL url, NotifyListener listener) { + this.unsubscribe(new com.alibaba.dubbo.common.URL(url), new com.alibaba.dubbo.registry.NotifyListener.CompatibleNotifyListener(listener)); + } + + final Set convertToNotifyListeners(Set notifyListeners) { + return notifyListeners.stream().map(listener -> new com.alibaba.dubbo.registry.NotifyListener.CompatibleNotifyListener(listener)).collect(Collectors.toSet()); + } + + + static class CompatibleAbstractRegistry extends org.apache.dubbo.registry.support.AbstractRegistry { + public CompatibleAbstractRegistry(URL url) { + super(url); + } + + @Override + public boolean isAvailable() { + return false; + } + + public void notify(URL url, NotifyListener listener, List urls) { + super.notify(url, listener, urls); + } + + public void setUrl(URL url) { + super.setUrl(url); + } + } +} diff --git a/dubbo-compatible/src/main/java/com/alibaba/dubbo/registry/support/AbstractRegistryFactory.java b/dubbo-compatible/src/main/java/com/alibaba/dubbo/registry/support/AbstractRegistryFactory.java new file mode 100644 index 00000000000..bcf3e80ced7 --- /dev/null +++ b/dubbo-compatible/src/main/java/com/alibaba/dubbo/registry/support/AbstractRegistryFactory.java @@ -0,0 +1,18 @@ +package com.alibaba.dubbo.registry.support; + +import org.apache.dubbo.common.URL; +import org.apache.dubbo.registry.Registry; + +/** + * 2019-04-16 + */ +@Deprecated +public abstract class AbstractRegistryFactory extends org.apache.dubbo.registry.support.AbstractRegistryFactory { + + + protected abstract com.alibaba.dubbo.registry.Registry createRegistry(com.alibaba.dubbo.common.URL url); + + protected Registry createRegistry(URL url) { + return createRegistry(new com.alibaba.dubbo.common.URL(url)); + } +} diff --git a/dubbo-compatible/src/main/java/com/alibaba/dubbo/registry/support/FailbackRegistry.java b/dubbo-compatible/src/main/java/com/alibaba/dubbo/registry/support/FailbackRegistry.java new file mode 100644 index 00000000000..ee6f599d2d6 --- /dev/null +++ b/dubbo-compatible/src/main/java/com/alibaba/dubbo/registry/support/FailbackRegistry.java @@ -0,0 +1,171 @@ +package com.alibaba.dubbo.registry.support; + +import com.alibaba.dubbo.common.URL; +import com.alibaba.dubbo.registry.NotifyListener; +import com.alibaba.dubbo.registry.Registry; + +import java.util.List; +import java.util.stream.Collectors; + +/** + * @author cvictory ON 2019-04-17 + */ +@Deprecated +public abstract class FailbackRegistry implements org.apache.dubbo.registry.Registry, Registry { + + private CompatibleFailbackRegistry failbackRegistry; + + public FailbackRegistry(URL url) { + failbackRegistry = new CompatibleFailbackRegistry(url.getOriginalURL(), this); + } + + public void removeFailedRegisteredTask(URL url) { + failbackRegistry.removeFailedRegisteredTask(url.getOriginalURL()); + } + + public void removeFailedUnregisteredTask(URL url) { + failbackRegistry.removeFailedUnregisteredTask(url.getOriginalURL()); + } + + public void removeFailedSubscribedTask(URL url, NotifyListener listener) { + failbackRegistry.removeFailedSubscribedTask(url.getOriginalURL(), new NotifyListener.ReverseCompatibleNotifyListener(listener)); + } + + public void removeFailedUnsubscribedTask(URL url, NotifyListener listener) { + failbackRegistry.removeFailedUnsubscribedTask(url.getOriginalURL(), new NotifyListener.ReverseCompatibleNotifyListener(listener)); + } + + public void removeFailedNotifiedTask(URL url, NotifyListener listener) { + failbackRegistry.removeFailedNotifiedTask(url.getOriginalURL(), new NotifyListener.ReverseCompatibleNotifyListener(listener)); + } + + public void register(URL url) { + failbackRegistry.register(url.getOriginalURL()); + } + + public void unregister(URL url) { + failbackRegistry.unregister(url.getOriginalURL()); + } + + public void subscribe(URL url, NotifyListener listener) { + failbackRegistry.subscribe(url.getOriginalURL(), new com.alibaba.dubbo.registry.NotifyListener.ReverseCompatibleNotifyListener(listener)); + } + + public void unsubscribe(URL url, NotifyListener listener) { + failbackRegistry.unsubscribe(url.getOriginalURL(), new com.alibaba.dubbo.registry.NotifyListener.ReverseCompatibleNotifyListener(listener)); + } + + protected void notify(URL url, NotifyListener listener, List urls) { + List urlResult = urls.stream().map(e -> e.getOriginalURL()).collect(Collectors.toList()); + failbackRegistry.notify(url.getOriginalURL(), new com.alibaba.dubbo.registry.NotifyListener.ReverseCompatibleNotifyListener(listener), urlResult); + } + + protected void doNotify(URL url, NotifyListener listener, List urls) { + List urlResult = urls.stream().map(e -> e.getOriginalURL()).collect(Collectors.toList()); + failbackRegistry.doNotify(url.getOriginalURL(), new com.alibaba.dubbo.registry.NotifyListener.ReverseCompatibleNotifyListener(listener), urlResult); + } + + protected void recover() throws Exception { + failbackRegistry.recover(); + } + + public List lookup(URL url) { + return failbackRegistry.lookup(url.getOriginalURL()).stream().map(e -> new URL(e)).collect(Collectors.toList()); + } + + public URL getUrl() { + return new URL(failbackRegistry.getUrl()); + } + + @Override + public void destroy() { + failbackRegistry.destroy(); + } + + // ==== Template method ==== + + public abstract void doRegister(URL url); + + public abstract void doUnregister(URL url); + + public abstract void doSubscribe(URL url, NotifyListener listener); + + public abstract void doUnsubscribe(URL url, NotifyListener listener); + + @Override + public void register(org.apache.dubbo.common.URL url) { + this.register(new URL(url)); + } + + @Override + public void unregister(org.apache.dubbo.common.URL url) { + this.unregister(new URL(url)); + } + + @Override + public void subscribe(org.apache.dubbo.common.URL url, org.apache.dubbo.registry.NotifyListener listener) { + this.subscribe(new URL(url), new NotifyListener.CompatibleNotifyListener(listener)); + } + + @Override + public void unsubscribe(org.apache.dubbo.common.URL url, org.apache.dubbo.registry.NotifyListener listener) { + this.unsubscribe(new URL(url), new NotifyListener.CompatibleNotifyListener(listener)); + } + + @Override + public List lookup(org.apache.dubbo.common.URL url) { + return failbackRegistry.lookup(url); + } + + + static class CompatibleFailbackRegistry extends org.apache.dubbo.registry.support.FailbackRegistry { + + private FailbackRegistry compatibleFailbackRegistry; + + public CompatibleFailbackRegistry(org.apache.dubbo.common.URL url, FailbackRegistry compatibleFailbackRegistry) { + super(url); + this.compatibleFailbackRegistry = compatibleFailbackRegistry; + } + + @Override + public void doRegister(org.apache.dubbo.common.URL url) { + this.compatibleFailbackRegistry.doRegister(new URL(url)); + } + + @Override + public void doUnregister(org.apache.dubbo.common.URL url) { + this.compatibleFailbackRegistry.doUnregister(new URL(url)); + } + + @Override + public void doSubscribe(org.apache.dubbo.common.URL url, org.apache.dubbo.registry.NotifyListener listener) { + this.compatibleFailbackRegistry.doSubscribe(new URL(url), new NotifyListener.CompatibleNotifyListener(listener)); + } + + @Override + public void doUnsubscribe(org.apache.dubbo.common.URL url, org.apache.dubbo.registry.NotifyListener listener) { + this.compatibleFailbackRegistry.doUnsubscribe(new URL(url), new NotifyListener.CompatibleNotifyListener(listener)); + } + + @Override + public void notify(org.apache.dubbo.common.URL url, org.apache.dubbo.registry.NotifyListener listener, List urls) { + super.notify(url, listener, urls); + } + + @Override + public void doNotify(org.apache.dubbo.common.URL url, org.apache.dubbo.registry.NotifyListener listener, List urls) { + super.doNotify(url, listener, urls); + } + + @Override + public boolean isAvailable() { + return false; + } + + @Override + public void recover() throws Exception { + super.recover(); + } + } + +} diff --git a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/support/FailbackRegistry.java b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/support/FailbackRegistry.java index cbf1527231f..0c638364a40 100644 --- a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/support/FailbackRegistry.java +++ b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/support/FailbackRegistry.java @@ -201,23 +201,53 @@ private void removeFailedNotified(URL url, NotifyListener listener) { } } - public ConcurrentMap getFailedRegistered() { + /** + * remove public modifier. + * + * @return + * @since 2.7.2 + */ + ConcurrentMap getFailedRegistered() { return failedRegistered; } - public ConcurrentMap getFailedUnregistered() { + /** + * remove public modifier. + * + * @return + * @since 2.7.2 + */ + ConcurrentMap getFailedUnregistered() { return failedUnregistered; } - public ConcurrentMap getFailedSubscribed() { + /** + * remove public modifier. + * + * @return + * @since 2.7.2 + */ + ConcurrentMap getFailedSubscribed() { return failedSubscribed; } - public ConcurrentMap getFailedUnsubscribed() { + /** + * remove public modifier. + * + * @return + * @since 2.7.2 + */ + ConcurrentMap getFailedUnsubscribed() { return failedUnsubscribed; } - public ConcurrentMap getFailedNotified() { + /** + * remove public modifier. + * + * @return + * @since 2.7.2 + */ + ConcurrentMap getFailedNotified() { return failedNotified; } From 6b58cd03a32885e97a4b2e86964e1c2cfac5faf3 Mon Sep 17 00:00:00 2001 From: cvictory Date: Wed, 17 Apr 2019 19:23:23 +0800 Subject: [PATCH 4/6] add licence --- .../alibaba/dubbo/common/utils/UrlUtils.java | 17 +++++++++++++++++ .../registry/support/AbstractRegistry.java | 16 ++++++++++++++++ .../support/AbstractRegistryFactory.java | 16 ++++++++++++++++ .../registry/support/FailbackRegistry.java | 16 ++++++++++++++++ 4 files changed, 65 insertions(+) diff --git a/dubbo-compatible/src/main/java/com/alibaba/dubbo/common/utils/UrlUtils.java b/dubbo-compatible/src/main/java/com/alibaba/dubbo/common/utils/UrlUtils.java index 33502614f79..6d95df12332 100644 --- a/dubbo-compatible/src/main/java/com/alibaba/dubbo/common/utils/UrlUtils.java +++ b/dubbo-compatible/src/main/java/com/alibaba/dubbo/common/utils/UrlUtils.java @@ -1,3 +1,19 @@ +/* + * 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 com.alibaba.dubbo.common.utils; import com.alibaba.dubbo.common.URL; @@ -10,6 +26,7 @@ /** * @author cvictory ON 2019-04-17 */ +@Deprecated public class UrlUtils { public static URL parseURL(String address, Map defaults) { diff --git a/dubbo-compatible/src/main/java/com/alibaba/dubbo/registry/support/AbstractRegistry.java b/dubbo-compatible/src/main/java/com/alibaba/dubbo/registry/support/AbstractRegistry.java index 094d4e45072..ef1bb3d9e75 100644 --- a/dubbo-compatible/src/main/java/com/alibaba/dubbo/registry/support/AbstractRegistry.java +++ b/dubbo-compatible/src/main/java/com/alibaba/dubbo/registry/support/AbstractRegistry.java @@ -1,3 +1,19 @@ +/* + * 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 com.alibaba.dubbo.registry.support; import org.apache.dubbo.common.URL; diff --git a/dubbo-compatible/src/main/java/com/alibaba/dubbo/registry/support/AbstractRegistryFactory.java b/dubbo-compatible/src/main/java/com/alibaba/dubbo/registry/support/AbstractRegistryFactory.java index bcf3e80ced7..9b0b698e63d 100644 --- a/dubbo-compatible/src/main/java/com/alibaba/dubbo/registry/support/AbstractRegistryFactory.java +++ b/dubbo-compatible/src/main/java/com/alibaba/dubbo/registry/support/AbstractRegistryFactory.java @@ -1,3 +1,19 @@ +/* + * 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 com.alibaba.dubbo.registry.support; import org.apache.dubbo.common.URL; diff --git a/dubbo-compatible/src/main/java/com/alibaba/dubbo/registry/support/FailbackRegistry.java b/dubbo-compatible/src/main/java/com/alibaba/dubbo/registry/support/FailbackRegistry.java index ee6f599d2d6..623b4e73245 100644 --- a/dubbo-compatible/src/main/java/com/alibaba/dubbo/registry/support/FailbackRegistry.java +++ b/dubbo-compatible/src/main/java/com/alibaba/dubbo/registry/support/FailbackRegistry.java @@ -1,3 +1,19 @@ +/* + * 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 com.alibaba.dubbo.registry.support; import com.alibaba.dubbo.common.URL; From 477d652d99951e93dd2ece6c698d4d42839c8674 Mon Sep 17 00:00:00 2001 From: cvictory Date: Thu, 16 May 2019 10:42:07 +0800 Subject: [PATCH 5/6] fix review issue. #3882 --- .../dubbo/common/utils/StringUtils.java | 2 +- .../alibaba/dubbo/common/utils/UrlUtils.java | 4 +-- .../registry/support/FailbackRegistry.java | 2 +- .../registry/support/FailbackRegistry.java | 30 ------------------- 4 files changed, 4 insertions(+), 34 deletions(-) diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/utils/StringUtils.java b/dubbo-common/src/main/java/org/apache/dubbo/common/utils/StringUtils.java index 27b429f5f90..20331e3998a 100644 --- a/dubbo-common/src/main/java/org/apache/dubbo/common/utils/StringUtils.java +++ b/dubbo-common/src/main/java/org/apache/dubbo/common/utils/StringUtils.java @@ -53,7 +53,7 @@ public final class StringUtils { private static final Pattern INT_PATTERN = Pattern.compile("^\\d+$"); private static final int PAD_LIMIT = 8192; - protected StringUtils() { + private StringUtils() { } /** diff --git a/dubbo-compatible/src/main/java/com/alibaba/dubbo/common/utils/UrlUtils.java b/dubbo-compatible/src/main/java/com/alibaba/dubbo/common/utils/UrlUtils.java index 6d95df12332..b16e6aa55d5 100644 --- a/dubbo-compatible/src/main/java/com/alibaba/dubbo/common/utils/UrlUtils.java +++ b/dubbo-compatible/src/main/java/com/alibaba/dubbo/common/utils/UrlUtils.java @@ -24,7 +24,7 @@ import java.util.stream.Collectors; /** - * @author cvictory ON 2019-04-17 + * 2019-04-17 */ @Deprecated public class UrlUtils { @@ -34,7 +34,7 @@ public static URL parseURL(String address, Map defaults) { } public static List parseURLs(String address, Map defaults) { - return UrlUtils.parseURLs(address, defaults).stream().map(e -> new URL(e)).collect(Collectors.toList()); + return org.apache.dubbo.common.utils.UrlUtils.parseURLs(address, defaults).stream().map(e -> new URL(e)).collect(Collectors.toList()); } public static Map> convertRegister(Map> register) { diff --git a/dubbo-compatible/src/main/java/com/alibaba/dubbo/registry/support/FailbackRegistry.java b/dubbo-compatible/src/main/java/com/alibaba/dubbo/registry/support/FailbackRegistry.java index 623b4e73245..0156ddb4624 100644 --- a/dubbo-compatible/src/main/java/com/alibaba/dubbo/registry/support/FailbackRegistry.java +++ b/dubbo-compatible/src/main/java/com/alibaba/dubbo/registry/support/FailbackRegistry.java @@ -24,7 +24,7 @@ import java.util.stream.Collectors; /** - * @author cvictory ON 2019-04-17 + * 2019-04-17 */ @Deprecated public abstract class FailbackRegistry implements org.apache.dubbo.registry.Registry, Registry { diff --git a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/support/FailbackRegistry.java b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/support/FailbackRegistry.java index c4c5f661336..936b707a8ba 100644 --- a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/support/FailbackRegistry.java +++ b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/support/FailbackRegistry.java @@ -206,52 +206,22 @@ private void removeFailedNotified(URL url, NotifyListener listener) { } } - /** - * remove public modifier. - * - * @return - * @since 2.7.2 - */ ConcurrentMap getFailedRegistered() { return failedRegistered; } - /** - * remove public modifier. - * - * @return - * @since 2.7.2 - */ ConcurrentMap getFailedUnregistered() { return failedUnregistered; } - /** - * remove public modifier. - * - * @return - * @since 2.7.2 - */ ConcurrentMap getFailedSubscribed() { return failedSubscribed; } - /** - * remove public modifier. - * - * @return - * @since 2.7.2 - */ ConcurrentMap getFailedUnsubscribed() { return failedUnsubscribed; } - /** - * remove public modifier. - * - * @return - * @since 2.7.2 - */ ConcurrentMap getFailedNotified() { return failedNotified; } From a15eb55ae194e40ede24cb1e4064257fca975802 Mon Sep 17 00:00:00 2001 From: cvictory Date: Fri, 17 May 2019 15:57:01 +0800 Subject: [PATCH 6/6] #3883 --- .../src/main/java/com/alibaba/dubbo/common/utils/UrlUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dubbo-compatible/src/main/java/com/alibaba/dubbo/common/utils/UrlUtils.java b/dubbo-compatible/src/main/java/com/alibaba/dubbo/common/utils/UrlUtils.java index b16e6aa55d5..c8417610b52 100644 --- a/dubbo-compatible/src/main/java/com/alibaba/dubbo/common/utils/UrlUtils.java +++ b/dubbo-compatible/src/main/java/com/alibaba/dubbo/common/utils/UrlUtils.java @@ -30,7 +30,7 @@ public class UrlUtils { public static URL parseURL(String address, Map defaults) { - return new URL(UrlUtils.parseURL(address, defaults)); + return new URL(org.apache.dubbo.common.utils.UrlUtils.parseURL(address, defaults)); } public static List parseURLs(String address, Map defaults) {