You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by li...@apache.org on 2020/11/26 12:11:05 UTC
[servicecomb-java-chassis] branch master updated: [SCB-2130]vert.x
3.9.4 ping/pong message will call on message (#2084)
This is an automated email from the ASF dual-hosted git repository.
liubao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git
The following commit(s) were added to refs/heads/master by this push:
new e65d46d [SCB-2130]vert.x 3.9.4 ping/pong message will call on message (#2084)
e65d46d is described below
commit e65d46da2290d27bb89fb6b3aafe2e5244eed7b0
Author: bao liu <bi...@qq.com>
AuthorDate: Thu Nov 26 20:10:53 2020 +0800
[SCB-2130]vert.x 3.9.4 ping/pong message will call on message (#2084)
---
.../ConfigCenterConfigurationSourceImpl.java | 2 +-
.../config/client/ConfigCenterClient.java | 30 ++++++++++++++--------
.../client/http/WebsocketClientUtil.java | 8 +++++-
3 files changed, 28 insertions(+), 12 deletions(-)
diff --git a/dynamic-config/config-cc/src/main/java/org/apache/servicecomb/config/archaius/sources/ConfigCenterConfigurationSourceImpl.java b/dynamic-config/config-cc/src/main/java/org/apache/servicecomb/config/archaius/sources/ConfigCenterConfigurationSourceImpl.java
index 1c2a5cc..eb40703 100644
--- a/dynamic-config/config-cc/src/main/java/org/apache/servicecomb/config/archaius/sources/ConfigCenterConfigurationSourceImpl.java
+++ b/dynamic-config/config-cc/src/main/java/org/apache/servicecomb/config/archaius/sources/ConfigCenterConfigurationSourceImpl.java
@@ -145,7 +145,7 @@ public class ConfigCenterConfigurationSourceImpl implements ConfigCenterConfigur
LOGGER.error("action: {} is invalid.", action);
return;
}
- LOGGER.warn("Config value cache changed: action:{}; item:{}", action, configuration.keySet());
+ LOGGER.info("Config value cache changed: action:{}; item:{}", action, configuration.keySet());
}
}
}
diff --git a/dynamic-config/config-cc/src/main/java/org/apache/servicecomb/config/client/ConfigCenterClient.java b/dynamic-config/config-cc/src/main/java/org/apache/servicecomb/config/client/ConfigCenterClient.java
index 6a40c85..26e7314 100644
--- a/dynamic-config/config-cc/src/main/java/org/apache/servicecomb/config/client/ConfigCenterClient.java
+++ b/dynamic-config/config-cc/src/main/java/org/apache/servicecomb/config/client/ConfigCenterClient.java
@@ -243,16 +243,26 @@ public class ConfigCenterClient {
// ignore, just prevent NPE.
});
asyncResult.result().frameHandler(frame -> {
- Buffer action = frame.binaryData();
- LOGGER.info("watching config recieved {}", action);
- Map<String, Object> mAction = action.toJsonObject().getMap();
- if ("CREATE".equals(mAction.get("action"))) {
- //event loop can not be blocked,we just keep nothing changed in push mode
- refreshConfig(configCenter, false);
- } else if ("MEMBER_CHANGE".equals(mAction.get("action"))) {
- refreshMembers(memberdis);
- } else {
- parseConfigUtils.refreshConfigItemsIncremental(mAction);
+ if (frame.isText() || frame.isBinary()) {
+ Buffer action = frame.binaryData();
+ LOGGER.debug("watching config received {}", action);
+ Map<String, Object> mAction = null;
+
+ try {
+ mAction = action.toJsonObject().getMap();
+ } catch (Exception e) {
+ LOGGER.error("parse config item failed.", e);
+ return;
+ }
+
+ if ("CREATE".equals(mAction.get("action"))) {
+ //event loop can not be blocked,we just keep nothing changed in push mode
+ refreshConfig(configCenter, false);
+ } else if ("MEMBER_CHANGE".equals(mAction.get("action"))) {
+ refreshMembers(memberdis);
+ } else {
+ parseConfigUtils.refreshConfigItemsIncremental(mAction);
+ }
}
});
startHeartBeatThread(asyncResult.result());
diff --git a/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/serviceregistry/client/http/WebsocketClientUtil.java b/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/serviceregistry/client/http/WebsocketClientUtil.java
index cb9aef5..c646358 100644
--- a/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/serviceregistry/client/http/WebsocketClientUtil.java
+++ b/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/serviceregistry/client/http/WebsocketClientUtil.java
@@ -78,7 +78,13 @@ public final class WebsocketClientUtil {
asyncResult.result().pongHandler(pong -> {
// ignore, just prevent NPE.
});
- asyncResult.result().frameHandler((frame) -> onMessage.handle(frame.binaryData()));
+ asyncResult.result().frameHandler((frame) ->
+ {
+ if (frame.isBinary() || frame.isText()) {
+ onMessage.handle(frame.binaryData());
+ }
+ }
+ );
}
});
});