[dubbo] branch master updated: publish event when exported. (#5715)
This is an automated email from the ASF dual-hosted git repository. mercyblitz pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/dubbo.git The following commit(s) were added to refs/heads/master by this push: new ee6 publish event when exported. (#5715) ee6 is described below commit ee6296732aa7ee3c2e913210ff077ee9e0d5 Author: ken.lj AuthorDate: Thu Feb 6 11:19:02 2020 +0800 publish event when exported. (#5715) --- .../main/java/org/apache/dubbo/config/ServiceConfigBase.java | 4 .../src/main/java/org/apache/dubbo/config/ServiceConfig.java | 10 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/dubbo-common/src/main/java/org/apache/dubbo/config/ServiceConfigBase.java b/dubbo-common/src/main/java/org/apache/dubbo/config/ServiceConfigBase.java index 3d73efd..9810207 100644 --- a/dubbo-common/src/main/java/org/apache/dubbo/config/ServiceConfigBase.java +++ b/dubbo-common/src/main/java/org/apache/dubbo/config/ServiceConfigBase.java @@ -92,10 +92,6 @@ public abstract class ServiceConfigBase extends AbstractServiceConfig { setMethods(MethodConfig.constructMethodConfig(service.methods())); } -public void exported() { - -} - @Deprecated private static List convertProviderToProtocol(List providers) { if (CollectionUtils.isEmpty(providers)) { 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 aaeb851..83e1127 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 @@ -204,6 +204,13 @@ public class ServiceConfig extends ServiceConfigBase { } else { doExport(); } + +exported(); +} + +public void exported() { +// dispatch a ServiceConfigExportedEvent since 2.7.4 +dispatch(new ServiceConfigExportedEvent(this)); } private void checkAndUpdateSubConfigs() { @@ -290,9 +297,6 @@ public class ServiceConfig extends ServiceConfigBase { path = interfaceName; } doExportUrls(); - -// dispatch a ServiceConfigExportedEvent since 2.7.4 -dispatch(new ServiceConfigExportedEvent(this)); } @SuppressWarnings({"unchecked", "rawtypes"})
[dubbo-go] branch develop updated (bfef9d2 -> 0074a01)
This is an automated email from the ASF dual-hosted git repository. flycash pushed a change to branch develop in repository https://gitbox.apache.org/repos/asf/dubbo-go.git. from bfef9d2 Merge pull request #351 from pantianying/change_zk_version new 9298c7e Implemented prometheus reporter new 9cb3965 Tested prometheus new fcae1b7 Add protocol.Result into Report method new 061eb82 Rearrange imports new 8ceeefd Fix review new 10d0ac8 Fix BUG new 2d66552 Support histogram new 9d5943a Lazy initialization new 83d3ca6 Remove remote key and local key new b22c9a3 Merge branch 'develop' of github.com:apache/dubbo-go into feature/prometheus new 5e74a2c fmt code new d4ee2bf Move GetXXXConfig to config_load file new 6404fbb fmt comments new 3810992 Merge branch 'develop' of github.com:apache/dubbo-go into feature/prometheus new 229e027 fix review new 31ca039 Merge develop new 0074a01 Merge pull request #342 from flycash/feature/prometheus The 1366 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: common/{node.go => constant/time.go} | 15 +- common/extension/{registry.go => metrics.go} | 27 +-- .../extension/metrics_test.go | 32 ++-- config/base_config.go | 4 +- config/config_loader.go| 56 ++- config/consumer_config.go | 9 - ...shutdown_signal_windows.go => metric_config.go} | 26 +-- cluster/cluster.go => config/metric_config_test.go | 14 +- config/provider_config.go | 9 - filter/filter_impl/metrics_filter.go | 93 +++ ...acing_filter_test.go => metrics_filter_test.go} | 51 -- go.mod | 2 +- metrics/prometheus/reporter.go | 184 + .../prometheus/reporter_test.go| 56 +++ filter/filter.go => metrics/reporter.go| 17 +- 15 files changed, 469 insertions(+), 126 deletions(-) copy common/{node.go => constant/time.go} (88%) copy common/extension/{registry.go => metrics.go} (52%) copy config/config_utils_test.go => common/extension/metrics_test.go (62%) copy config/{graceful_shutdown_signal_windows.go => metric_config.go} (59%) copy cluster/cluster.go => config/metric_config_test.go (82%) create mode 100644 filter/filter_impl/metrics_filter.go copy filter/filter_impl/{tracing_filter_test.go => metrics_filter_test.go} (63%) create mode 100644 metrics/prometheus/reporter.go copy filter/filter_impl/access_log_filter_test.go => metrics/prometheus/reporter_test.go (62%) copy filter/filter.go => metrics/reporter.go (74%)
[dubbo] branch master updated: Fix compile error of Jsonrpc Protocol
This is an automated email from the ASF dual-hosted git repository. liujun pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/dubbo.git The following commit(s) were added to refs/heads/master by this push: new 0f4cbd9 Fix compile error of Jsonrpc Protocol 0f4cbd9 is described below commit 0f4cbd984cbcad683146c4202c78024564e5d0b7 Author: ken.lj AuthorDate: Wed Feb 5 15:55:03 2020 +0800 Fix compile error of Jsonrpc Protocol --- .../org/apache/dubbo/rpc/protocol/http/JsonRemoteInvocation.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dubbo-rpc/dubbo-rpc-http/src/main/java/org/apache/dubbo/rpc/protocol/http/JsonRemoteInvocation.java b/dubbo-rpc/dubbo-rpc-http/src/main/java/org/apache/dubbo/rpc/protocol/http/JsonRemoteInvocation.java index 1e0b426..e038726 100644 --- a/dubbo-rpc/dubbo-rpc-http/src/main/java/org/apache/dubbo/rpc/protocol/http/JsonRemoteInvocation.java +++ b/dubbo-rpc/dubbo-rpc-http/src/main/java/org/apache/dubbo/rpc/protocol/http/JsonRemoteInvocation.java @@ -17,9 +17,10 @@ package org.apache.dubbo.rpc.protocol.http; -import org.aopalliance.intercept.MethodInvocation; import org.apache.dubbo.common.utils.StringUtils; import org.apache.dubbo.rpc.RpcContext; + +import org.aopalliance.intercept.MethodInvocation; import org.springframework.remoting.support.RemoteInvocation; import java.lang.reflect.InvocationTargetException; @@ -44,7 +45,7 @@ public class JsonRemoteInvocation extends RemoteInvocation { public Object invoke(Object targetObject) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { RpcContext context = RpcContext.getContext(); -context.setAttachments((Map) getAttribute(DUBBO_ATTACHMENTS_ATTR_NAME)); +context.setAttachments((Map) getAttribute(DUBBO_ATTACHMENTS_ATTR_NAME)); String generic = (String) getAttribute(GENERIC_KEY); if (StringUtils.isNotEmpty(generic)) {
[dubbo] branch master updated: Remove registry from factory that already destroyed. #5483 (#5608)
This is an automated email from the ASF dual-hosted git repository. liujieqin pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/dubbo.git The following commit(s) were added to refs/heads/master by this push: new 2c9d7f5 Remove registry from factory that already destroyed. #5483 (#5608) 2c9d7f5 is described below commit 2c9d7f5a0cf1a33e79bb46bf57837079c45d5fe2 Author: GuoHao AuthorDate: Wed Feb 5 16:12:01 2020 +0800 Remove registry from factory that already destroyed. #5483 (#5608) --- .../org/apache/dubbo/registry/support/AbstractRegistry.java | 1 + .../dubbo/registry/support/AbstractRegistryFactory.java | 9 + .../dubbo/registry/support/AbstractRegistryFactoryTest.java | 11 ++- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/support/AbstractRegistry.java b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/support/AbstractRegistry.java index d6537f5..a005f63 100644 --- a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/support/AbstractRegistry.java +++ b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/support/AbstractRegistry.java @@ -493,6 +493,7 @@ public abstract class AbstractRegistry implements Registry { } } } +AbstractRegistryFactory.removeDestroyedRegistry(this); } protected boolean acceptable(URL urlToRegistry) { diff --git a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/support/AbstractRegistryFactory.java b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/support/AbstractRegistryFactory.java index af8ee12..7a3be4a 100644 --- a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/support/AbstractRegistryFactory.java +++ b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/support/AbstractRegistryFactory.java @@ -175,6 +175,15 @@ public abstract class AbstractRegistryFactory implements RegistryFactory { } }; +public static void removeDestroyedRegistry(Registry toRm){ +LOCK.lock(); +try { +REGISTRIES.entrySet().removeIf(entry -> entry.getValue().equals(toRm)); +} finally { +LOCK.unlock(); +} +} + // for unit test public static void clearRegistryNotDestroy() { REGISTRIES.clear(); diff --git a/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/support/AbstractRegistryFactoryTest.java b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/support/AbstractRegistryFactoryTest.java index 1fd1e6d..a43583b 100644 --- a/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/support/AbstractRegistryFactoryTest.java +++ b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/support/AbstractRegistryFactoryTest.java @@ -30,7 +30,6 @@ import java.util.List; /** * AbstractRegistryFactoryTest - * */ public class AbstractRegistryFactoryTest { @@ -107,10 +106,20 @@ public class AbstractRegistryFactoryTest { public void testDestroyAllRegistries() { Registry registry1 = registryFactory.getRegistry(URL.valueOf("dubbo://" + NetUtils.getLocalHost() + ":?group=xxx")); Registry registry2 = registryFactory.getRegistry(URL.valueOf("dubbo://" + NetUtils.getLocalHost() + ":?group=yyy")); +Registry registry3 = new AbstractRegistry(URL.valueOf("dubbo://" + NetUtils.getLocalHost() + ":2020?group=yyy")) { +@Override +public boolean isAvailable() { +return true; +} +}; Collection registries = AbstractRegistryFactory.getRegistries(); Assertions.assertTrue(registries.contains(registry1)); Assertions.assertTrue(registries.contains(registry2)); +registry3.destroy(); +registries = AbstractRegistryFactory.getRegistries(); +Assertions.assertFalse(registries.contains(registry3)); AbstractRegistryFactory.destroyAll(); +registries = AbstractRegistryFactory.getRegistries(); Assertions.assertFalse(registries.contains(registry1)); Assertions.assertFalse(registries.contains(registry2)); }