[incubator-dubbo-ops] branch develop updated: add codemirror (#101)

2018-09-09 Thread iluo
This is an automated email from the ASF dual-hosted git repository.

iluo pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo-ops.git


The following commit(s) were added to refs/heads/develop by this push:
 new 2803639  add codemirror (#101)
2803639 is described below

commit 28036397737cd472a95dbd1e905efe77c3a6664d
Author: min 
AuthorDate: Mon Sep 10 10:40:41 2018 +0800

add codemirror (#101)

* add codemirror

* remove unused import
---
 .../dubbo/admin/controller/RoutesController.java   |  17 +++
 dubbo-admin/dubbo-admin-frontend/package.json  |   2 +-
 .../src/components/RoutingRule.vue | 135 +
 3 files changed, 77 insertions(+), 77 deletions(-)

diff --git 
a/dubbo-admin/dubbo-admin-backend/src/main/java/org/apache/dubbo/admin/controller/RoutesController.java
 
b/dubbo-admin/dubbo-admin-backend/src/main/java/org/apache/dubbo/admin/controller/RoutesController.java
new file mode 100644
index 000..3928d5f
--- /dev/null
+++ 
b/dubbo-admin/dubbo-admin-backend/src/main/java/org/apache/dubbo/admin/controller/RoutesController.java
@@ -0,0 +1,17 @@
+package org.apache.dubbo.admin.controller;
+
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMapping("/api/routes")
+public class RoutesController {
+
+
+@RequestMapping("/create")
+public void createRule(@RequestParam String serviceName, @RequestParam 
String rule) {
+
+}
+
+}
\ No newline at end of file
diff --git a/dubbo-admin/dubbo-admin-frontend/package.json 
b/dubbo-admin/dubbo-admin-frontend/package.json
index 70c0488..9843430 100644
--- a/dubbo-admin/dubbo-admin-frontend/package.json
+++ b/dubbo-admin/dubbo-admin-frontend/package.json
@@ -12,8 +12,8 @@
   },
   "dependencies": {
 "axios": "^0.18.0",
-"codemirror": "^5.39.2",
 "vue": "^2.5.2",
+"vue-codemirror": "^4.0.5",
 "vue-router": "^3.0.1",
 "vuetify": "^1.0.0",
 "vuex": "^3.0.1"
diff --git a/dubbo-admin/dubbo-admin-frontend/src/components/RoutingRule.vue 
b/dubbo-admin/dubbo-admin-frontend/src/components/RoutingRule.vue
index a91a5e7..01b46ac 100644
--- a/dubbo-admin/dubbo-admin-frontend/src/components/RoutingRule.vue
+++ b/dubbo-admin/dubbo-admin-frontend/src/components/RoutingRule.vue
@@ -20,30 +20,13 @@
 
   
 
-  
-
-  
-
-  
-  
-
-  
-
-  
-
-  
   
 
-
-  
-
-  
-
-  
-Search
-  
-
+  
+
+Search
+  
 
 
 
@@ -53,7 +36,7 @@
   
 Search Result
 
-CREATE
+CREATE
   
   Create new Routing rule
 
 
-  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
 
 
   
@@ -123,13 +118,22 @@
 
 
 

[incubator-dubbo-website] branch asf-site updated: fix typo (#147)

2018-09-09 Thread jerrick
This is an automated email from the ASF dual-hosted git repository.

jerrick pushed a commit to branch asf-site
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo-website.git


The following commit(s) were added to refs/heads/asf-site by this push:
 new 0fd63b0  fix typo (#147)
0fd63b0 is described below

commit 0fd63b083caed42fe96beb2d20d448448722a2b6
Author: Song Kun 
AuthorDate: Mon Sep 10 09:00:08 2018 +0800

fix typo (#147)
---
 site_config/community.jsx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/site_config/community.jsx b/site_config/community.jsx
index 3b2b4ad..d39dfcc 100644
--- a/site_config/community.jsx
+++ b/site_config/community.jsx
@@ -611,7 +611,7 @@ export default {
 },
 {
   title: 'Cluster',
-  content: Dubbo支持一下容错机制:,
+  content: Dubbo支持以下容错机制:,
   tags: [
 {
   text: 'Fail over',



[incubator-dubbo] branch dev-metadata updated: Fix small bugs and add comments

2018-09-09 Thread liujun
This is an automated email from the ASF dual-hosted git repository.

liujun pushed a commit to branch dev-metadata
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo.git


The following commit(s) were added to refs/heads/dev-metadata by this push:
 new 4ef7f28  Fix small bugs and add comments
4ef7f28 is described below

commit 4ef7f28d367d8f2066871575ab6d2d985f8f8928
Author: ken.lj 
AuthorDate: Sun Sep 9 17:09:13 2018 +0800

Fix small bugs and add comments
---
 .../java/org/apache/dubbo/rpc/cluster/router/InvokerTreeCache.java  | 6 +++---
 .../java/org/apache/dubbo/rpc/cluster/router/tag/TagRouter.java | 3 ++-
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git 
a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/InvokerTreeCache.java
 
b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/InvokerTreeCache.java
index 7a497a3..5ce835b 100644
--- 
a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/InvokerTreeCache.java
+++ 
b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/InvokerTreeCache.java
@@ -31,7 +31,7 @@ import java.util.List;
  */
 public class InvokerTreeCache {
 
-TreeNode tree;
+private TreeNode tree;
 
 public TreeNode buildTree() {
 tree = new TreeNode<>();
@@ -43,7 +43,7 @@ public class InvokerTreeCache {
 
 public List> getInvokers(TreeNode node, URL url, Invocation 
invocation) {
 // We have reached the leaf node.
-if (node.getChildren() == null || node.getChildren().size() == 0) {
+if (node.isLeaf()) {
 return node.getInvokers();
 }
 
@@ -102,7 +102,7 @@ public class InvokerTreeCache {
 String forceKey = "force." + failoverNode.getConditionKey();
 if (Boolean.valueOf(invocation.getAttachment(forceKey, 
url.getParameter(forceKey, "false" {
 /**
- * This may mistakely return empty list for runtime routers
+ * This may mistakenly return empty list for runtime routers
  * see {@link 
org.apache.dubbo.rpc.cluster.router.tag.TagRouter.getKey()} for the workaround.
  */
 return Collections.emptyList();
diff --git 
a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/tag/TagRouter.java
 
b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/tag/TagRouter.java
index 4638815..9d14d96 100644
--- 
a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/tag/TagRouter.java
+++ 
b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/tag/TagRouter.java
@@ -132,7 +132,8 @@ public class TagRouter extends AbstractRouter implements 
Comparable, Con
 // dynamic tag group doesn't have any item about the requested app 
OR it's null after filtered by dynamic tag group but force=false.
 // check static tag
 result = filterInvoker(invokers, invoker -> 
tag.equals(invoker.getUrl().getParameter(Constants.TAG_KEY)));
-if (CollectionUtils.isNotEmpty(result) || 
url.getParameter(Constants.FORCE_USE_TAG, true)) {
+// If there's no tagged providers that can match the value in this 
tag. force.tag is set by default to true, which means it will not invoker any 
providers without a tag unless it's explicitly allowed.
+if (CollectionUtils.isNotEmpty(result) || 
Boolean.valueOf(invocation.getAttachment(Constants.FORCE_USE_TAG, 
url.getParameter(Constants.FORCE_USE_TAG, "false" {
 return result;
 }
 // FAILOVER: return all Providers without any tags.



[incubator-dubbo] 02/02: Update config connecting status when ZK connection changes.

2018-09-09 Thread liujun
This is an automated email from the ASF dual-hosted git repository.

liujun pushed a commit to branch dev-metadata
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo.git

commit 507f5bfc2967442a5b40b2f535c9f17cd5519ef0
Author: ken.lj 
AuthorDate: Sun Sep 9 17:08:04 2018 +0800

Update config connecting status when ZK connection changes.
---
 .../dynamic/support/archaius/sources/ZooKeeperConfigurationSource.java | 3 +++
 1 file changed, 3 insertions(+)

diff --git 
a/dubbo-config/dubbo-config-dynamic/src/main/java/org/apache/dubbo/config/dynamic/support/archaius/sources/ZooKeeperConfigurationSource.java
 
b/dubbo-config/dubbo-config-dynamic/src/main/java/org/apache/dubbo/config/dynamic/support/archaius/sources/ZooKeeperConfigurationSource.java
index 6e91624..41d6861 100644
--- 
a/dubbo-config/dubbo-config-dynamic/src/main/java/org/apache/dubbo/config/dynamic/support/archaius/sources/ZooKeeperConfigurationSource.java
+++ 
b/dubbo-config/dubbo-config-dynamic/src/main/java/org/apache/dubbo/config/dynamic/support/archaius/sources/ZooKeeperConfigurationSource.java
@@ -117,6 +117,9 @@ public class ZooKeeperConfigurationSource implements 
WatchedConfigurationSource,
 
 TreeCacheEvent.Type type = event.getType();
 ChildData data = event.getData();
+if (type == TreeCacheEvent.Type.INITIALIZED || type == 
TreeCacheEvent.Type.CONNECTION_RECONNECTED) {
+connected = true;
+}
 
 // TODO, ignore other event types
 if (data == null) {



[incubator-dubbo] 01/02: Refactor dynamic config, 1. Extract common method to AbstractDynamicConfiguration 2. Unify strategy when config server cannot be reached at startup: start using local snapshot

2018-09-09 Thread liujun
This is an automated email from the ASF dual-hosted git repository.

liujun pushed a commit to branch dev-metadata
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo.git

commit ca057cb003bd6ee89bf4022bbf678463dd8c6419
Author: ken.lj 
AuthorDate: Sun Sep 9 17:04:26 2018 +0800

Refactor dynamic config,
1. Extract common method to AbstractDynamicConfiguration
2. Unify strategy when config server cannot be reached at startup: start 
using local snapshot and try to connect in background.
---
 .../dynamic/AbstractDynamicConfiguration.java  | 35 ++-
 .../dubbo/config/dynamic/DynamicConfiguration.java |  4 +--
 .../support/apollo/ApolloDynamicConfiguration.java | 34 ++
 .../archaius/ArchaiusDynamicConfiguration.java | 40 +-
 .../sources/ZooKeeperConfigurationSource.java  | 26 ++
 5 files changed, 85 insertions(+), 54 deletions(-)

diff --git 
a/dubbo-config/dubbo-config-dynamic/src/main/java/org/apache/dubbo/config/dynamic/AbstractDynamicConfiguration.java
 
b/dubbo-config/dubbo-config-dynamic/src/main/java/org/apache/dubbo/config/dynamic/AbstractDynamicConfiguration.java
index 84129d6..e459bcc 100644
--- 
a/dubbo-config/dubbo-config-dynamic/src/main/java/org/apache/dubbo/config/dynamic/AbstractDynamicConfiguration.java
+++ 
b/dubbo-config/dubbo-config-dynamic/src/main/java/org/apache/dubbo/config/dynamic/AbstractDynamicConfiguration.java
@@ -18,36 +18,51 @@ package org.apache.dubbo.config.dynamic;
 
 import org.apache.dubbo.common.URL;
 
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
 /**
  *
  */
-public abstract class AbstractDynamicConfiguration implements 
DynamicConfiguration {
+public abstract class AbstractDynamicConfiguration 
implements DynamicConfiguration {
 protected URL url;
+/**
+ * One key can register multiple target listeners, but one target listener 
only maps to one configuration listener
+ */
+private ConcurrentMap> listenerToTargetListenerMap;
 
 public AbstractDynamicConfiguration() {
 }
 
 @Override
 public void addListener(String key, ConfigurationListener listener) {
-
+ConcurrentMap listeners = 
listenerToTargetListenerMap.computeIfAbsent(key, k -> new 
ConcurrentHashMap<>());
+TargetConfigListener targetListener = 
listeners.computeIfAbsent(listener, k -> createTargetConfigListener(key, 
listener));
+addTargetListener(key, targetListener);
 }
 
 @Override
 public String getConfig(String key, String group) {
-return null;
+return getConfig(key, group, null);
 }
 
 @Override
 public String getConfig(String key, String group, ConfigurationListener 
listener) {
-return null;
+return getConfig(key, group, 0l, listener);
 }
 
 @Override
-public String getConfig(String key, String group, long timeout) {
-return null;
+public String getConfig(String key, String group, long timeout, 
ConfigurationListener listener) {
+try {
+if (listener != null) {
+this.addListener(key, listener);
+}
+return getInternalProperty(key, group, timeout, listener);
+} catch (Exception e) {
+throw new IllegalStateException(e.getMessage(), e);
+}
 }
 
-
 public URL getUrl() {
 return url;
 }
@@ -56,6 +71,10 @@ public abstract class AbstractDynamicConfiguration 
implements DynamicConfigurati
 this.url = url;
 }
 
-protected abstract String getInternalProperty(String key, String group, 
long timeout);
+protected abstract String getInternalProperty(String key, String group, 
long timeout, ConfigurationListener listener);
+
+protected abstract void addTargetListener(String key, TargetConfigListener 
listener);
+
+protected abstract TargetConfigListener createTargetConfigListener(String 
key, ConfigurationListener listener);
 
 }
diff --git 
a/dubbo-config/dubbo-config-dynamic/src/main/java/org/apache/dubbo/config/dynamic/DynamicConfiguration.java
 
b/dubbo-config/dubbo-config-dynamic/src/main/java/org/apache/dubbo/config/dynamic/DynamicConfiguration.java
index 8d05aca..799f670 100644
--- 
a/dubbo-config/dubbo-config-dynamic/src/main/java/org/apache/dubbo/config/dynamic/DynamicConfiguration.java
+++ 
b/dubbo-config/dubbo-config-dynamic/src/main/java/org/apache/dubbo/config/dynamic/DynamicConfiguration.java
@@ -25,7 +25,7 @@ import org.apache.dubbo.common.extension.SPI;
 @SPI("zookeeper")
 public interface DynamicConfiguration {
 
-public void init();
+void init();
 
 URL getUrl();
 
@@ -35,7 +35,7 @@ public interface DynamicConfiguration {
 
 String getConfig(String key, String group);
 
-String getConfig(String key, String group, long timeout);
+String getConfig(String key, String group, long timeout, 
ConfigurationListener listener);
 
 String getConfig(String key, String