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/06/04 11:40:06 UTC
[servicecomb-java-chassis] branch master updated: [SCB-1966] print
filter chain information after bootup
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 a72feb6 [SCB-1966] print filter chain information after bootup
a72feb6 is described below
commit a72feb615d7c9801b8cd4e6de40b9b6abba463b0
Author: wujimin <wu...@huawei.com>
AuthorDate: Thu Jun 4 09:45:09 2020 +0800
[SCB-1966] print filter chain information after bootup
---
.../org/apache/servicecomb/core/SCBEngine.java | 5 ++++-
.../core/bootup/BootUpInformationCollector.java | 6 ++++++
...ionCollector.java => FilterChainCollector.java} | 25 +++++++++++++++++++---
...vicecomb.core.bootup.BootUpInformationCollector | 3 ++-
4 files changed, 34 insertions(+), 5 deletions(-)
diff --git a/core/src/main/java/org/apache/servicecomb/core/SCBEngine.java b/core/src/main/java/org/apache/servicecomb/core/SCBEngine.java
index cec49d6..2bbef3d 100644
--- a/core/src/main/java/org/apache/servicecomb/core/SCBEngine.java
+++ b/core/src/main/java/org/apache/servicecomb/core/SCBEngine.java
@@ -329,7 +329,10 @@ public class SCBEngine {
StringBuilder serviceInfo = new StringBuilder();
serviceInfo.append("Service information is shown below:\n");
for (BootUpInformationCollector bootUpInformationCollector : bootUpInformationCollectors) {
- serviceInfo.append(bootUpInformationCollector.collect()).append('\n');
+ String info = bootUpInformationCollector.collect(this);
+ if (!StringUtils.isEmpty(info)) {
+ serviceInfo.append(info).append('\n');
+ }
}
LOGGER.info(serviceInfo.toString());
}
diff --git a/core/src/main/java/org/apache/servicecomb/core/bootup/BootUpInformationCollector.java b/core/src/main/java/org/apache/servicecomb/core/bootup/BootUpInformationCollector.java
index 3d0ff7e..62a9ac5 100644
--- a/core/src/main/java/org/apache/servicecomb/core/bootup/BootUpInformationCollector.java
+++ b/core/src/main/java/org/apache/servicecomb/core/bootup/BootUpInformationCollector.java
@@ -17,7 +17,13 @@
package org.apache.servicecomb.core.bootup;
+import org.apache.servicecomb.core.SCBEngine;
+
public interface BootUpInformationCollector {
+ default String collect(SCBEngine engine) {
+ return collect();
+ }
+
String collect();
int getOrder();
diff --git a/core/src/main/java/org/apache/servicecomb/core/bootup/BootUpInformationCollector.java b/core/src/main/java/org/apache/servicecomb/core/bootup/FilterChainCollector.java
similarity index 62%
copy from core/src/main/java/org/apache/servicecomb/core/bootup/BootUpInformationCollector.java
copy to core/src/main/java/org/apache/servicecomb/core/bootup/FilterChainCollector.java
index 3d0ff7e..8d1a872 100644
--- a/core/src/main/java/org/apache/servicecomb/core/bootup/BootUpInformationCollector.java
+++ b/core/src/main/java/org/apache/servicecomb/core/bootup/FilterChainCollector.java
@@ -17,8 +17,27 @@
package org.apache.servicecomb.core.bootup;
-public interface BootUpInformationCollector {
- String collect();
+import org.apache.servicecomb.core.SCBEngine;
+import org.apache.servicecomb.core.filter.FilterChainsManager;
- int getOrder();
+public class FilterChainCollector implements BootUpInformationCollector {
+ @Override
+ public String collect(SCBEngine engine) {
+ FilterChainsManager mgr = engine.getFilterChainsManager();
+ if (!mgr.isEnabled()) {
+ return null;
+ }
+
+ return mgr.collectResolvedChains();
+ }
+
+ @Override
+ public String collect() {
+ return null;
+ }
+
+ @Override
+ public int getOrder() {
+ return 300;
+ }
}
diff --git a/core/src/main/resources/META-INF/services/org.apache.servicecomb.core.bootup.BootUpInformationCollector b/core/src/main/resources/META-INF/services/org.apache.servicecomb.core.bootup.BootUpInformationCollector
index 502d780..0490161 100644
--- a/core/src/main/resources/META-INF/services/org.apache.servicecomb.core.bootup.BootUpInformationCollector
+++ b/core/src/main/resources/META-INF/services/org.apache.servicecomb.core.bootup.BootUpInformationCollector
@@ -16,4 +16,5 @@
#
org.apache.servicecomb.core.bootup.ServiceInformationCollector
-org.apache.servicecomb.core.bootup.AddressInformationCollector
\ No newline at end of file
+org.apache.servicecomb.core.bootup.AddressInformationCollector
+org.apache.servicecomb.core.bootup.FilterChainCollector
\ No newline at end of file