[GitHub] [servicecomb-java-chassis] liuguangrong opened a new issue #2145: 边缘服务和业务服务交互

2020-12-16 Thread GitBox


liuguangrong opened a new issue #2145:
URL: https://github.com/apache/servicecomb-java-chassis/issues/2145


   利用边缘服务edge做网关与其他服务交互时。链接不通,异常信息是在RestClientInvocation.java的
   clientRequest.exceptionHandler(e -> {
 invocation.getTraceIdLogger().error(LOGGER, "Failed to send request, 
local:{}, remote:{}.",
 getLocalAddress(), ipPort.getSocketAddress(), e);
 throwableHandler.handle(e);
   });
   里面捕获了吗?有没有什么办法可以拿到这个异常信息



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [servicecomb-java-chassis] yaotingli opened a new issue #2144: 流控

2020-12-16 Thread GitBox


yaotingli opened a new issue #2144:
URL: https://github.com/apache/servicecomb-java-chassis/issues/2144


   大佬,您好:
   
   假设有一个ServiceA启动并注册到了servicecomb注册中心。
   ServiceA配置Provider.global.limit=5
   
   请问:
   我直接通过Http调用ServiceA的接口,这时会有流控吗?若有流控,流控限制是:Provider.global.limit吗?



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [servicecomb-java-chassis] hypggg commented on issue #2137: 升级serviceComb到2.1.3后,项目有时候会启动不起来,一直转圈圈

2020-12-16 Thread GitBox


hypggg commented on issue #2137:
URL: 
https://github.com/apache/servicecomb-java-chassis/issues/2137#issuecomment-747174822


   原因不明,先关闭



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [servicecomb-java-chassis] hypggg closed issue #2137: 升级serviceComb到2.1.3后,项目有时候会启动不起来,一直转圈圈

2020-12-16 Thread GitBox


hypggg closed issue #2137:
URL: https://github.com/apache/servicecomb-java-chassis/issues/2137


   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [servicecomb-java-chassis] HoyerIsAlexander edited a comment on issue #2081: servicecomb升级至2.1.2版本后,接口List对象请求参数设置值方式修改

2020-12-16 Thread GitBox


HoyerIsAlexander edited a comment on issue #2081:
URL: 
https://github.com/apache/servicecomb-java-chassis/issues/2081#issuecomment-747170110


   CSE版本:3.1.5 ServiceComb版本:2.1.2 Jackson版本:2.11.0
   
   业务代码:
   
   ```
   API接口
   
   public interface ApiInterface {
QueryRsp query(@Valid QueryParam queryParam);
   }
   
   API实现类
   
   @RestSchema(schemaId = "apiImpl")
   @Path("")
   @Consumes({MediaType.APPLICATION_JSON, MediaType.TEXT_XML})
   @Produces({"application/json; charset=UTF-8", "text/xml; charset=UTF-8"})
   public class ApiImpl {
   @GET
   @Path("/query")
   @Override
   QueryRsp query(@BeanParam QueryParam queryParam) {
   //TODO
   }
   }
   
   QueryParam 
   
   @Data
   public class QueryParam{
   @QueryParam("params")
   private List<@NotNull Integer> params;
   }
   ```
   
   浏览器请求:
   
   `http://localhost:8080/query?params=`
   
   结果:
   
   `params:[null]`
   
   
   另外新增Post接口
   
   业务代码:
   `Param  private List params`
   
   请求参数:
   `{
   params: ''
}`
   
   结果:
   
   `params:[""]`
   
   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [servicecomb-java-chassis] HoyerIsAlexander edited a comment on issue #2081: servicecomb升级至2.1.2版本后,接口List对象请求参数设置值方式修改

2020-12-16 Thread GitBox


HoyerIsAlexander edited a comment on issue #2081:
URL: 
https://github.com/apache/servicecomb-java-chassis/issues/2081#issuecomment-747170110


   CSE版本:3.1.5 ServiceComb版本:2.1.2 Jackson版本:2.11.0
   
   业务代码:
   
   ```
   API接口
   
   public interface ApiInterface {
QueryRsp query(@Valid QueryParam queryParam);
   }
   
   API实现类
   
   @RestSchema(schemaId = "apiImpl")
   @Path("")
   @Consumes({MediaType.APPLICATION_JSON, MediaType.TEXT_XML})
   @Produces({"application/json; charset=UTF-8", "text/xml; charset=UTF-8"})
   public class ApiImpl {
   @GET
   @Path("/query")
   @Override
   QueryRsp query(@BeanParam QueryParam queryParam) {
   //TODO
   }
   }
   
   QueryParam 
   
   @Data
   public class IncidentLogQueryParam{
   @QueryParam("params")
   private List<@NotNull Integer> params;
   }
   ```
   
   浏览器请求:
   
   `http://localhost:8080/query?params=`
   
   结果:
   
   `params:[null]`
   
   
   另外新增Post接口
   
   业务代码:
   `Param  private List params`
   
   请求参数:
   `{
   params: ''
}`
   
   结果:
   
   `params:[""]`
   
   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [servicecomb-java-chassis] HoyerIsAlexander edited a comment on issue #2081: servicecomb升级至2.1.2版本后,接口List对象请求参数设置值方式修改

2020-12-16 Thread GitBox


HoyerIsAlexander edited a comment on issue #2081:
URL: 
https://github.com/apache/servicecomb-java-chassis/issues/2081#issuecomment-747170110


   CSE版本:3.1.5 ServiceComb版本:2.1.2 Jackson版本:2.11.0
   
   业务代码:
   
   `
   API接口
   
   public interface ApiInterface {
QueryRsp query(@Valid QueryParam queryParam);
   }
   
   API实现类
   
   @RestSchema(schemaId = "apiImpl")
   @Path("")
   @Consumes({MediaType.APPLICATION_JSON, MediaType.TEXT_XML})
   @Produces({"application/json; charset=UTF-8", "text/xml; charset=UTF-8"})
   public class ApiImpl {
   @GET
   @Path("/query")
   @Override
   QueryRsp query(@BeanParam QueryParam queryParam) {
   //TODO
   }
   }
   
   QueryParam 
   
   @Data
   public class IncidentLogQueryParam{
   @QueryParam("params")
   private List<@NotNull Integer> params;
   }
   `
   
   浏览器请求:
   
   `http://localhost:8080/query?params=`
   
   结果:
   
   `params:[null]`
   
   
   另外新增Post接口
   
   业务代码:
   `Param  private List params`
   
   请求参数:
   `{
   params: ''
}`
   
   结果:
   
   `params:[""]`
   
   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [servicecomb-java-chassis] HoyerIsAlexander commented on issue #2081: servicecomb升级至2.1.2版本后,接口List对象请求参数设置值方式修改

2020-12-16 Thread GitBox


HoyerIsAlexander commented on issue #2081:
URL: 
https://github.com/apache/servicecomb-java-chassis/issues/2081#issuecomment-747170110


   CSE版本:3.1.5 ServiceComb版本:2.1.2 Jackson版本:2.11.0
   
   业务代码:
   
   `
   API接口
   
   public interface ApiInterface {
QueryRsp query(@Valid QueryParam queryParam);
   }
   
   API实现类
   
   @RestSchema(schemaId = "apiImpl")
   @Path("")
   @Consumes({MediaType.APPLICATION_JSON, MediaType.TEXT_XML})
   @Produces({"application/json; charset=UTF-8", "text/xml; charset=UTF-8"})
   public class ApiImpl {
   @GET
   @Path("/query")
   @Override
   QueryRsp query(@BeanParam QueryParam queryParam) {
   //TODO
   }
   }
   
   QueryParam 
   
   @Data
   public class IncidentLogQueryParam{
   @QueryParam("params")
   private List<@NotNull Integer> params;
   }
   `
   
   浏览器请求:
   
   `http://localhost:8080/query?params=`
   
   结果:
   
   "params:[null]"
   
   
   另外新增Post接口
   
   业务代码:
   `Param  private List params`
   
   请求参数:
   `{
   params: ''
}`
   
   结果:
   
   "params:[""]"
   
   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[servicecomb-java-chassis] branch master updated: [SCB-2165] allow @ConditionalOnProperty work with configuration from microservice.yaml (#2141)

2020-12-16 Thread liubao
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 323d5b7  [SCB-2165] allow @ConditionalOnProperty work with 
configuration from microservice.yaml (#2141)
323d5b7 is described below

commit 323d5b7c406583867eacaa758b28e0fdcfcbe2c6
Author: wujimin 
AuthorDate: Thu Dec 17 10:39:44 2020 +0800

[SCB-2165] allow @ConditionalOnProperty work with configuration from 
microservice.yaml (#2141)
---
 .../core/ConfigurationSpringInitializer.java   | 132 +
 ...andaloneApplication.java => ConditionBean.java} |  20 ++--
 .../it/SpringBoot2StandaloneApplication.java   |  10 ++
 .../src/main/resources/microservice.yaml   |   2 +
 .../ConfigurationSpringBootInitializer.java|  24 ++--
 .../src/main/resources/META-INF/spring.factories   |  17 +++
 6 files changed, 132 insertions(+), 73 deletions(-)

diff --git 
a/core/src/main/java/org/apache/servicecomb/core/ConfigurationSpringInitializer.java
 
b/core/src/main/java/org/apache/servicecomb/core/ConfigurationSpringInitializer.java
index dfe9413..afb8417 100644
--- 
a/core/src/main/java/org/apache/servicecomb/core/ConfigurationSpringInitializer.java
+++ 
b/core/src/main/java/org/apache/servicecomb/core/ConfigurationSpringInitializer.java
@@ -36,6 +36,7 @@ import 
org.apache.servicecomb.foundation.common.utils.SPIServiceUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.context.EnvironmentAware;
+import org.springframework.context.annotation.Conditional;
 import 
org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
 import org.springframework.core.Ordered;
 import org.springframework.core.env.CompositePropertySource;
@@ -43,6 +44,7 @@ import org.springframework.core.env.ConfigurableEnvironment;
 import org.springframework.core.env.EnumerablePropertySource;
 import org.springframework.core.env.Environment;
 import org.springframework.core.env.MapPropertySource;
+import org.springframework.core.env.MutablePropertySources;
 import org.springframework.core.env.PropertySource;
 import org.springframework.util.StringUtils;
 
@@ -68,6 +70,10 @@ public class ConfigurationSpringInitializer extends 
PropertySourcesPlaceholderCo
 
   public static final String EXTRA_CONFIG_SOURCE_PREFIX = "extraConfig-";
 
+  public static final String MICROSERVICE_PROPERTY_SOURCE_NAME = 
"microservice.yaml";
+
+  public static final String MAPPING_PROPERTY_SOURCE_NAME = "mapping.yaml";
+
   private final List bootStrapServices =
   SPIServiceUtils.getSortedService(BootStrapService.class);
 
@@ -82,77 +88,95 @@ public class ConfigurationSpringInitializer extends 
PropertySourcesPlaceholderCo
*/
   @Override
   public void setEnvironment(Environment environment) {
+syncFromSpring(environment);
+syncToSpring(environment);
+
+startupBootStrapService(environment);
+ConfigCenterConfigurationSource configCenterConfigurationSource = 
ConfigUtil.installDynamicConfig();
+addDynamicConfigurationToSpring(environment, 
configCenterConfigurationSource);
+  }
+
+  private void syncFromSpring(Environment environment) {
 String environmentName = generateNameForEnvironment(environment);
 LOGGER.info("Environment received, will get configurations from [{}].", 
environmentName);
 
 Map extraConfig = getAllProperties(environment);
-
-addMicroserviceYAMLToSpring(environment);
-
-addMappingToString(environment);
-
-startupBootStrapService(environment);
-
 ConfigUtil.addExtraConfig(EXTRA_CONFIG_SOURCE_PREFIX + environmentName, 
extraConfig);
+  }
 
-ConfigCenterConfigurationSource configCenterConfigurationSource = 
ConfigUtil.installDynamicConfig();
-
-addDynamicConfigurationToSpring(environment, 
configCenterConfigurationSource);
+  public static void syncToSpring(Environment environment) {
+addMicroserviceYAMLToSpring(environment);
+addMappingToSpring(environment);
   }
 
   private void startupBootStrapService(Environment environment) {
 bootStrapServices.forEach(bootStrapService -> 
bootStrapService.startup(environment));
   }
 
-  private void addMicroserviceYAMLToSpring(Environment environment) {
+  /**
+   * make springboot have a change to add microservice.yaml source earlier
+   * to affect {@link Conditional}
+   * @param environment environment
+   */
+  private static void addMicroserviceYAMLToSpring(Environment environment) {
 if (!(environment instanceof ConfigurableEnvironment)) {
   return;
 }
 
-((ConfigurableEnvironment) environment).getPropertySources()
-.addLast(new 
EnumerablePropertySource("microservice.yaml") {
-  private final Map values = new HashMap<>();
-
-  private final String[] propertyNames;
-
-  {
-MicroserviceConfigLoader loader = new 

[GitHub] [servicecomb-java-chassis] liubao68 merged pull request #2141: [SCB-2165] allow @ConditionalOnProperty work with configuration from …

2020-12-16 Thread GitBox


liubao68 merged pull request #2141:
URL: https://github.com/apache/servicecomb-java-chassis/pull/2141


   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [servicecomb-java-chassis] liubao68 merged pull request #2143: [SCB-2164]InstanceCacheCheckTask only print necessary message to avoi…

2020-12-16 Thread GitBox


liubao68 merged pull request #2143:
URL: https://github.com/apache/servicecomb-java-chassis/pull/2143


   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[servicecomb-java-chassis] branch 1.3.x updated: [SCB-2164]InstanceCacheCheckTask only print necessary message to avoid information leak (#2143)

2020-12-16 Thread liubao
This is an automated email from the ASF dual-hosted git repository.

liubao pushed a commit to branch 1.3.x
in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git


The following commit(s) were added to refs/heads/1.3.x by this push:
 new 5995adb  [SCB-2164]InstanceCacheCheckTask only print necessary message 
to avoid information leak (#2143)
5995adb is described below

commit 5995adb0b0c662e3340b0fea37d4d864ca81b2ed
Author: bao liu 
AuthorDate: Thu Dec 17 10:10:28 2020 +0800

[SCB-2164]InstanceCacheCheckTask only print necessary message to avoid 
information leak (#2143)
---
 .../serviceregistry/api/registry/MicroserviceInstance.java | 10 ++
 .../diagnosis/instance/InstanceCacheCheckTask.java |  4 +---
 .../diagnosis/instance/InstanceCacheChecker.java   |  9 +++--
 .../serviceregistry/api/registry/TestMicroServiceInstance.java |  3 +++
 4 files changed, 21 insertions(+), 5 deletions(-)

diff --git 
a/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/api/registry/MicroserviceInstance.java
 
b/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/api/registry/MicroserviceInstance.java
index 445b42a..5154f00 100644
--- 
a/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/api/registry/MicroserviceInstance.java
+++ 
b/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/api/registry/MicroserviceInstance.java
@@ -69,6 +69,16 @@ public class MicroserviceInstance {
 
   private String timestamp;
 
+  @Override
+  public String toString() {
+StringBuilder sb = new StringBuilder();
+sb.append("instanceId=" + instanceId + ";");
+sb.append("serviceId=" + serviceId + ";");
+sb.append("status=" + status + ";");
+sb.append("endpoints=" + endpoints.toString());
+return sb.toString();
+  }
+
   public String getTimestamp() {
 return timestamp;
   }
diff --git 
a/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/diagnosis/instance/InstanceCacheCheckTask.java
 
b/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/diagnosis/instance/InstanceCacheCheckTask.java
index b6dd615..40283e6 100644
--- 
a/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/diagnosis/instance/InstanceCacheCheckTask.java
+++ 
b/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/diagnosis/instance/InstanceCacheCheckTask.java
@@ -31,8 +31,6 @@ import com.netflix.config.DynamicIntProperty;
 import com.netflix.config.DynamicPropertyFactory;
 import com.netflix.config.DynamicStringProperty;
 
-import io.vertx.core.json.Json;
-
 public class InstanceCacheCheckTask implements ServiceRegistryTaskInitializer {
   private static final Logger LOGGER = 
LoggerFactory.getLogger(InstanceCacheCheckTask.class);
 
@@ -131,7 +129,7 @@ public class InstanceCacheCheckTask implements 
ServiceRegistryTaskInitializer {
   InstanceCacheSummary instanceCacheSummary = checker.check();
   eventBus.post(instanceCacheSummary);
 
-  LOGGER.info("check instance cache, result={}.", 
Json.encode(instanceCacheSummary));
+  LOGGER.info("check instance cache, result={}.", 
instanceCacheSummary.getStatus());
 } catch (Throwable e) {
   LOGGER.error("failed check instance cache..", e);
 }
diff --git 
a/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/diagnosis/instance/InstanceCacheChecker.java
 
b/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/diagnosis/instance/InstanceCacheChecker.java
index f086cc3..8842fb5 100644
--- 
a/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/diagnosis/instance/InstanceCacheChecker.java
+++ 
b/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/diagnosis/instance/InstanceCacheChecker.java
@@ -114,6 +114,11 @@ public class InstanceCacheChecker {
 String local = Json.encode(microserviceVersions.getPulledInstances());
 String remote = Json.encode(remoteInstances);
 if (local.equals(remote)) {
+  LOGGER.info("instance cache match. appId={}, microservice={}.\n"
+  + "current cache: {}\n",
+  microserviceVersions.getAppId(),
+  microserviceVersions.getMicroserviceName(),
+  remoteInstances.toString());
   instanceCacheResult.setStatus(Status.NORMAL);
   return instanceCacheResult;
 }
@@ -123,8 +128,8 @@ public class InstanceCacheChecker {
 + "remote cache: {}",
 microserviceVersions.getAppId(),
 microserviceVersions.getMicroserviceName(),
-local,
-remote);
+microserviceVersions.getPulledInstances().toString(),
+remoteInstances.toString());
 instanceCacheResult.setStatus(Status.ABNORMAL);
 instanceCacheResult.setDetail("instance cache not match");
 
diff --git 
a/service-registry/src/test/java/org/apache/servicecomb/serviceregistry/api/registry/TestMicroServiceInstance.java
 

[GitHub] [servicecomb-java-chassis] liubao68 commented on issue #2081: servicecomb升级至2.1.2版本后,接口List对象请求参数设置值方式修改

2020-12-16 Thread GitBox


liubao68 commented on issue #2081:
URL: 
https://github.com/apache/servicecomb-java-chassis/issues/2081#issuecomment-747153718


   你能发下你的代码是怎么写的吗?前面的讨论和例子,实际上都说明了你的用法不会返回 new String[]{null}。 我测试也没发现这种情况。 
   
   可以按照下面格式反馈下:
   
   业务代码:
   
   ```
 @Path("queryListCSV")
 @GET
 public String queryListCSV(@ApiParam(collectionFormat = "csv") 
@QueryParam("queryList") List queryList) {
   return queryList == null ? "null" : queryList.size() + ":" + 
queryList.toString();
 }
   ```
   
   浏览器请求:
   
   ```
   http://localhost:8080/queryList/queryListCSV?queryList=
   ```
   
   预期结果:
   
   ```
   "1:[]"
   ```
   
   浏览器请求:
   
   ```
   http://localhost:8080/queryList/queryListCSV
   ```
   
   预期结果:
   
   ```
   "0:[]"
   ```



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [servicecomb-java-chassis] liubao68 commented on issue #2139: @RequestBody 启动报错2.x

2020-12-16 Thread GitBox


liubao68 commented on issue #2139:
URL: 
https://github.com/apache/servicecomb-java-chassis/issues/2139#issuecomment-747148745


   
[升级指南](https://docs.servicecomb.io/java-chassis/zh_CN/featured-topics/upgrading/1_3_0T2_0_0/)
  有说明这个问题



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [servicecomb-java-chassis] liubao68 opened a new pull request #2143: [SCB-2164]InstanceCacheCheckTask only print necessary message to avoi…

2020-12-16 Thread GitBox


liubao68 opened a new pull request #2143:
URL: https://github.com/apache/servicecomb-java-chassis/pull/2143


   …d information leak
   
   Follow this checklist to help us incorporate your contribution quickly and 
easily:
   
- [ ] Make sure there is a [JIRA 
issue](https://issues.apache.org/jira/browse/SCB) filed for the change (usually 
before you start working on it).  Trivial changes like typos do not require a 
JIRA issue.  Your pull request should address just this issue, without pulling 
in other changes.
- [ ] Each commit in the pull request should have a meaningful subject line 
and body.
- [ ] Format the pull request title like `[SCB-XXX] Fixes bug in 
ApproximateQuantiles`, where you replace `SCB-XXX` with the appropriate JIRA 
issue.
- [ ] Write a pull request description that is detailed enough to 
understand what the pull request does, how, and why.
- [ ] Run `mvn clean install -Pit` to make sure basic checks pass. A more 
thorough check will be performed on your pull request automatically.
- [ ] If this contribution is large, please file an Apache [Individual 
Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
   
   ---
   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [servicecomb-java-chassis] wujimin commented on a change in pull request #2141: [SCB-2165] allow @ConditionalOnProperty work with configuration from …

2020-12-16 Thread GitBox


wujimin commented on a change in pull request #2141:
URL: 
https://github.com/apache/servicecomb-java-chassis/pull/2141#discussion_r544743882



##
File path: 
spring-boot/spring-boot-starters/java-chassis-spring-boot-starter/src/main/java/org/apache/servicecomb/springboot2/starter/ConfigurationSpringBootInitializer.java
##
@@ -0,0 +1,34 @@
+/*
+ * 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 org.apache.servicecomb.springboot2.starter;
+
+import org.apache.servicecomb.core.ConfigurationSpringInitializer;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.env.EnvironmentPostProcessor;
+import org.springframework.context.annotation.Conditional;
+import org.springframework.core.env.ConfigurableEnvironment;
+
+/**
+ * when run with springboot, add microservice.yaml to Environment earlier
+ * to affect {@link Conditional}
+ */
+public class ConfigurationSpringBootInitializer implements 
EnvironmentPostProcessor {
+  @Override
+  public void postProcessEnvironment(ConfigurableEnvironment environment, 
SpringApplication application) {
+ConfigurationSpringInitializer.addMicroserviceYAMLToSpring(environment);

Review comment:
   done





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [servicecomb-java-chassis] HoyerIsAlexander edited a comment on issue #2081: servicecomb升级至2.1.2版本后,GET接口请求参数设置值方式修改

2020-12-16 Thread GitBox


HoyerIsAlexander edited a comment on issue #2081:
URL: 
https://github.com/apache/servicecomb-java-chassis/issues/2081#issuecomment-747139925


   之前的1.3.0版本中,这么传值接受是空数组,现在传null包括传一个“”都会认为是new String[]{null}或者new 
String[]{""},包括Post接口,导致很多兼容性问题,虽然之前客户的用法不太正确,但是当时确实可以,然后引起了客户投诉,想了解下后续这方面的修改我们在版本升级的时候应该从哪里获取,另外我们是否可以自定义



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [servicecomb-java-chassis] HoyerIsAlexander edited a comment on issue #2081: servicecomb升级至2.1.2版本后,GET接口请求参数设置值方式修改

2020-12-16 Thread GitBox


HoyerIsAlexander edited a comment on issue #2081:
URL: 
https://github.com/apache/servicecomb-java-chassis/issues/2081#issuecomment-747139925


   之前的1.3.0版本中,这么传值接受是空数组,现在传null包括传一个“”都会认为是new String[]{null}或者new 
String[]{""},包括Post接口,导致很多兼容性问题,引起了客户投诉,想了解下后续这方面的修改我们在版本升级的时候应该从哪里获取,另外我们是否可以自定义



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [servicecomb-java-chassis] HoyerIsAlexander edited a comment on issue #2081: servicecomb升级至2.1.2版本后,GET接口请求参数设置值方式修改

2020-12-16 Thread GitBox


HoyerIsAlexander edited a comment on issue #2081:
URL: 
https://github.com/apache/servicecomb-java-chassis/issues/2081#issuecomment-747139925


   之前的1.3.0版本中,这么传值接受是空数组,现在传null包括传一个“”都会认为是new String[]{null}或者new 
String[]{""},包括Post接口,导致很多兼容性问题,引起了客户投诉,想了解下后续这方面的修改我们在版本升级的时候应该从哪里获取,另外我们是否可以只定义



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [servicecomb-java-chassis] HoyerIsAlexander commented on issue #2081: servicecomb升级至2.1.2版本后,GET接口请求参数设置值方式修改

2020-12-16 Thread GitBox


HoyerIsAlexander commented on issue #2081:
URL: 
https://github.com/apache/servicecomb-java-chassis/issues/2081#issuecomment-747139925


   之前的1.3.0版本中,这么传值接受是空数组,现在传null包括传一个“”都会认为是new String[]{null}或者new 
String[]{""},导致很多兼容性问题,引起了客户投诉,想了解下后续这方面的修改我们在版本升级的时候应该从哪里获取,另外我们是否可以只定义



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [servicecomb-java-chassis] liubao68 merged pull request #2142: [SCB-2166] swagger generator support securityDefinition

2020-12-16 Thread GitBox


liubao68 merged pull request #2142:
URL: https://github.com/apache/servicecomb-java-chassis/pull/2142


   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[servicecomb-java-chassis] branch master updated (7f8f71d -> b79423c)

2020-12-16 Thread liubao
This is an automated email from the ASF dual-hosted git repository.

liubao pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git.


from 7f8f71d  [SCB-2164]InstanceCacheCheckTask only print necessary message 
to avoid information leak
 add b79423c  [SCB-2166] swagger generator support securityDefinition 
(#2142)

No new revisions were added by this update.

Summary of changes:
 .../annotation/SwaggerDefinitionProcessor.java | 129 +
 .../annotation/SwaggerDefinitionProcessorTest.java |  62 ++
 ...SwaggerDefinition.yaml => security-apikey.yaml} |  16 ++-
 ...ySwaggerDefinition.yaml => security-basic.yaml} |  10 +-
 ...SwaggerDefinition.yaml => security-oauth2.yaml} |  28 -
 5 files changed, 212 insertions(+), 33 deletions(-)
 copy 
swagger/swagger-generator/generator-core/src/test/resources/schemas/{emptySwaggerDefinition.yaml
 => security-apikey.yaml} (81%)
 copy 
swagger/swagger-generator/generator-core/src/test/resources/schemas/{emptySwaggerDefinition.yaml
 => security-basic.yaml} (87%)
 copy 
swagger/swagger-generator/generator-core/src/test/resources/schemas/{emptySwaggerDefinition.yaml
 => security-oauth2.yaml} (68%)



[GitHub] [servicecomb-java-chassis] HoyerIsAlexander closed issue #2124: 可以自定义Timetamp的返回格式吗?

2020-12-16 Thread GitBox


HoyerIsAlexander closed issue #2124:
URL: https://github.com/apache/servicecomb-java-chassis/issues/2124


   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [servicecomb-java-chassis] HoyerIsAlexander commented on issue #2125: servicecomb 2.1.0版本,单独升级Jackson后启动失败

2020-12-16 Thread GitBox


HoyerIsAlexander commented on issue #2125:
URL: 
https://github.com/apache/servicecomb-java-chassis/issues/2125#issuecomment-747137959


   项目里应该是用了kafka或者其他依赖jackson的包吧,把对应的包升级到支持jackson 2.11就行



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [servicecomb-java-chassis] liubao68 commented on a change in pull request #2141: [SCB-2165] allow @ConditionalOnProperty work with configuration from …

2020-12-16 Thread GitBox


liubao68 commented on a change in pull request #2141:
URL: 
https://github.com/apache/servicecomb-java-chassis/pull/2141#discussion_r544734160



##
File path: 
spring-boot/spring-boot-starters/java-chassis-spring-boot-starter/src/main/java/org/apache/servicecomb/springboot2/starter/ConfigurationSpringBootInitializer.java
##
@@ -0,0 +1,34 @@
+/*
+ * 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 org.apache.servicecomb.springboot2.starter;
+
+import org.apache.servicecomb.core.ConfigurationSpringInitializer;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.env.EnvironmentPostProcessor;
+import org.springframework.context.annotation.Conditional;
+import org.springframework.core.env.ConfigurableEnvironment;
+
+/**
+ * when run with springboot, add microservice.yaml to Environment earlier
+ * to affect {@link Conditional}
+ */
+public class ConfigurationSpringBootInitializer implements 
EnvironmentPostProcessor {
+  @Override
+  public void postProcessEnvironment(ConfigurableEnvironment environment, 
SpringApplication application) {
+ConfigurationSpringInitializer.addMicroserviceYAMLToSpring(environment);

Review comment:
   Is it better to add a new method 'addXXX' that has
   `addMicroserviceYAMLToSpring` & `addMappingToString`

##
File path: 
spring-boot/spring-boot-starters/java-chassis-spring-boot-starter/src/main/java/org/apache/servicecomb/springboot2/starter/ConfigurationSpringBootInitializer.java
##
@@ -0,0 +1,34 @@
+/*
+ * 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 org.apache.servicecomb.springboot2.starter;
+
+import org.apache.servicecomb.core.ConfigurationSpringInitializer;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.env.EnvironmentPostProcessor;
+import org.springframework.context.annotation.Conditional;
+import org.springframework.core.env.ConfigurableEnvironment;
+
+/**
+ * when run with springboot, add microservice.yaml to Environment earlier
+ * to affect {@link Conditional}
+ */
+public class ConfigurationSpringBootInitializer implements 
EnvironmentPostProcessor {
+  @Override
+  public void postProcessEnvironment(ConfigurableEnvironment environment, 
SpringApplication application) {
+ConfigurationSpringInitializer.addMicroserviceYAMLToSpring(environment);

Review comment:
   Is it better to add a new method 'addXXX' that has
   `addMicroserviceYAMLToSpring` & `addMappingToString` ?





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [servicecomb-java-chassis] codecov-io commented on pull request #2142: [SCB-2166] swagger generator support securityDefinition

2020-12-16 Thread GitBox


codecov-io commented on pull request #2142:
URL: 
https://github.com/apache/servicecomb-java-chassis/pull/2142#issuecomment-746675122


   # 
[Codecov](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/2142?src=pr=h1)
 Report
   > Merging 
[#2142](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/2142?src=pr=desc)
 (bade17d) into 
[master](https://codecov.io/gh/apache/servicecomb-java-chassis/commit/7f8f71d97e1b405f09536f537b20c995843856e1?el=desc)
 (7f8f71d) will **decrease** coverage by `0.00%`.
   > The diff coverage is `82.14%`.
   
   [![Impacted file tree 
graph](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/2142/graphs/tree.svg?width=650=150=pr=KXfDcr9rX2)](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/2142?src=pr=tree)
   
   ```diff
   @@ Coverage Diff  @@
   ## master#2142  +/-   ##
   
   - Coverage 80.73%   80.73%   -0.01% 
 Complexity 1337 1337  
   
 Files  1462 1462  
 Lines 4009340127  +34 
 Branches   3399 3407   +8 
   
   + Hits  3236832395  +27 
   - Misses 6259 6264   +5 
   - Partials   1466 1468   +2 
   ```
   
   
   | [Impacted 
Files](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/2142?src=pr=tree)
 | Coverage Δ | Complexity Δ | |
   |---|---|---|---|
   | 
[...ocessor/annotation/SwaggerDefinitionProcessor.java](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/2142/diff?src=pr=tree#diff-c3dhZ2dlci9zd2FnZ2VyLWdlbmVyYXRvci9nZW5lcmF0b3ItY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2VydmljZWNvbWIvc3dhZ2dlci9nZW5lcmF0b3IvY29yZS9wcm9jZXNzb3IvYW5ub3RhdGlvbi9Td2FnZ2VyRGVmaW5pdGlvblByb2Nlc3Nvci5qYXZh)
 | `87.28% <82.14%> (-0.81%)` | `0.00 <0.00> (ø)` | |
   | 
[.../servicecomb/registry/discovery/DiscoveryTree.java](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/2142/diff?src=pr=tree#diff-Zm91bmRhdGlvbnMvZm91bmRhdGlvbi1yZWdpc3RyeS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2VydmljZWNvbWIvcmVnaXN0cnkvZGlzY292ZXJ5L0Rpc2NvdmVyeVRyZWUuamF2YQ==)
 | `96.49% <0.00%> (-3.51%)` | `0.00% <0.00%> (ø%)` | |
   
   --
   
   [Continue to review full report at 
Codecov](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/2142?src=pr=continue).
   > **Legend** - [Click here to learn 
more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute  (impact)`, `ø = not affected`, `? = missing data`
   > Powered by 
[Codecov](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/2142?src=pr=footer).
 Last update 
[7f8f71d...bade17d](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/2142?src=pr=lastupdated).
 Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [servicecomb-java-chassis] wujimin opened a new pull request #2142: [SCB-2166] swagger generator support securityDefinition

2020-12-16 Thread GitBox


wujimin opened a new pull request #2142:
URL: https://github.com/apache/servicecomb-java-chassis/pull/2142


   Follow this checklist to help us incorporate your contribution quickly and 
easily:
   
- [ ] Make sure there is a [JIRA 
issue](https://issues.apache.org/jira/browse/SCB) filed for the change (usually 
before you start working on it).  Trivial changes like typos do not require a 
JIRA issue.  Your pull request should address just this issue, without pulling 
in other changes.
- [ ] Each commit in the pull request should have a meaningful subject line 
and body.
- [ ] Format the pull request title like `[SCB-XXX] Fixes bug in 
ApproximateQuantiles`, where you replace `SCB-XXX` with the appropriate JIRA 
issue.
- [ ] Write a pull request description that is detailed enough to 
understand what the pull request does, how, and why.
- [ ] Run `mvn clean install -Pit` to make sure basic checks pass. A more 
thorough check will be performed on your pull request automatically.
- [ ] If this contribution is large, please file an Apache [Individual 
Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
   
   ---
   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [servicecomb-java-chassis] wujimin opened a new pull request #2141: [SCB-2165] allow @ConditionalOnProperty work with configuration from …

2020-12-16 Thread GitBox


wujimin opened a new pull request #2141:
URL: https://github.com/apache/servicecomb-java-chassis/pull/2141


   …microservice.yaml
   
   Follow this checklist to help us incorporate your contribution quickly and 
easily:
   
- [ ] Make sure there is a [JIRA 
issue](https://issues.apache.org/jira/browse/SCB) filed for the change (usually 
before you start working on it).  Trivial changes like typos do not require a 
JIRA issue.  Your pull request should address just this issue, without pulling 
in other changes.
- [ ] Each commit in the pull request should have a meaningful subject line 
and body.
- [ ] Format the pull request title like `[SCB-XXX] Fixes bug in 
ApproximateQuantiles`, where you replace `SCB-XXX` with the appropriate JIRA 
issue.
- [ ] Write a pull request description that is detailed enough to 
understand what the pull request does, how, and why.
- [ ] Run `mvn clean install -Pit` to make sure basic checks pass. A more 
thorough check will be performed on your pull request automatically.
- [ ] If this contribution is large, please file an Apache [Individual 
Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
   
   ---
   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [servicecomb-java-chassis] wujimin commented on issue #2139: @RequestBody 启动报错2.x

2020-12-16 Thread GitBox


wujimin commented on issue #2139:
URL: 
https://github.com/apache/servicecomb-java-chassis/issues/2139#issuecomment-746413300


   ```
   Caused by: java.lang.IllegalStateException: parameter name is not present, 
method=org.example.controller.HelloController:result
   solution:
   change pom.xml, add compiler argument: -parameter
   ```



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[servicecomb-java-chassis] branch master updated: [SCB-2164]InstanceCacheCheckTask only print necessary message to avoid information leak

2020-12-16 Thread wujimin
This is an automated email from the ASF dual-hosted git repository.

wujimin 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 7f8f71d  [SCB-2164]InstanceCacheCheckTask only print necessary message 
to avoid information leak
7f8f71d is described below

commit 7f8f71d97e1b405f09536f537b20c995843856e1
Author: liubao 
AuthorDate: Wed Dec 16 17:16:26 2020 +0800

[SCB-2164]InstanceCacheCheckTask only print necessary message to avoid 
information leak
---
 .../registry/api/registry/MicroserviceInstance.java | 10 ++
 .../diagnosis/instance/InstanceCacheCheckTask.java  |  2 +-
 .../diagnosis/instance/InstanceCacheChecker.java| 13 +
 .../api/registry/TestMicroServiceInstance.java  |  3 +++
 4 files changed, 23 insertions(+), 5 deletions(-)

diff --git 
a/foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/api/registry/MicroserviceInstance.java
 
b/foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/api/registry/MicroserviceInstance.java
index 3622286..5ece9ec 100644
--- 
a/foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/api/registry/MicroserviceInstance.java
+++ 
b/foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/api/registry/MicroserviceInstance.java
@@ -65,6 +65,16 @@ public class MicroserviceInstance {
 
   private String timestamp;
 
+  @Override
+  public String toString() {
+StringBuilder sb = new StringBuilder();
+sb.append("instanceId=" + instanceId + ";");
+sb.append("serviceId=" + serviceId + ";");
+sb.append("status=" + status + ";");
+sb.append("endpoints=" + endpoints.toString());
+return sb.toString();
+  }
+
   public String getTimestamp() {
 return timestamp;
   }
diff --git 
a/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/serviceregistry/diagnosis/instance/InstanceCacheCheckTask.java
 
b/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/serviceregistry/diagnosis/instance/InstanceCacheCheckTask.java
index c8eb0e7..36b9ab9 100644
--- 
a/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/serviceregistry/diagnosis/instance/InstanceCacheCheckTask.java
+++ 
b/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/serviceregistry/diagnosis/instance/InstanceCacheCheckTask.java
@@ -124,7 +124,7 @@ public class InstanceCacheCheckTask implements 
ServiceRegistryTaskInitializer {
   InstanceCacheSummary instanceCacheSummary = checker.check();
   eventBus.post(instanceCacheSummary);
 
-  LOGGER.info("check instance cache, result={}.", 
Json.encode(instanceCacheSummary));
+  LOGGER.info("check instance cache, result={}.", 
instanceCacheSummary.getStatus());
 } catch (Throwable e) {
   LOGGER.error("failed check instance cache..", e);
 }
diff --git 
a/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/serviceregistry/diagnosis/instance/InstanceCacheChecker.java
 
b/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/serviceregistry/diagnosis/instance/InstanceCacheChecker.java
index 4ad8b54..0359b4b 100644
--- 
a/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/serviceregistry/diagnosis/instance/InstanceCacheChecker.java
+++ 
b/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/serviceregistry/diagnosis/instance/InstanceCacheChecker.java
@@ -24,7 +24,6 @@ import java.util.Objects;
 import java.util.Set;
 
 import org.apache.servicecomb.foundation.common.utils.TimeUtils;
-import org.apache.servicecomb.serviceregistry.RegistryUtils;
 import org.apache.servicecomb.registry.api.registry.MicroserviceInstance;
 import org.apache.servicecomb.registry.api.registry.MicroserviceInstances;
 import org.apache.servicecomb.registry.consumer.AppManager;
@@ -32,6 +31,7 @@ import 
org.apache.servicecomb.registry.consumer.MicroserviceManager;
 import org.apache.servicecomb.registry.consumer.MicroserviceVersions;
 import org.apache.servicecomb.registry.consumer.StaticMicroserviceVersions;
 import org.apache.servicecomb.registry.definition.DefinitionConst;
+import org.apache.servicecomb.serviceregistry.RegistryUtils;
 import org.apache.servicecomb.serviceregistry.diagnosis.Status;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -40,7 +40,7 @@ import io.vertx.core.json.Json;
 
 public class InstanceCacheChecker {
   private static final Logger LOGGER = 
LoggerFactory.getLogger(InstanceCacheChecker.class);
-  
+
   Clock clock = TimeUtils.getSystemDefaultZoneClock();
 
   private AppManager appManager;
@@ -117,6 +117,11 @@ public class InstanceCacheChecker {
 String local = Json.encode(microserviceVersions.getPulledInstances());
 

[GitHub] [servicecomb-java-chassis] wujimin merged pull request #2140: [SCB-2164]InstanceCacheCheckTask only print necessary message to avoi…

2020-12-16 Thread GitBox


wujimin merged pull request #2140:
URL: https://github.com/apache/servicecomb-java-chassis/pull/2140


   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [servicecomb-service-center] tianxiaoliang commented on pull request #787: [SCD-2133] add new display data interface

2020-12-16 Thread GitBox


tianxiaoliang commented on pull request #787:
URL: 
https://github.com/apache/servicecomb-service-center/pull/787#issuecomment-746038377


   补充UT,已经有mock实现了,用mock做



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [servicecomb-java-chassis] myVictor commented on issue #2139: @RequestBody 启动报错2.x

2020-12-16 Thread GitBox


myVictor commented on issue #2139:
URL: 
https://github.com/apache/servicecomb-java-chassis/issues/2139#issuecomment-746038469


   具体信息:
   实体类:
   public class StudentVo {
   
   private String name;
   
   private int age;
   
   private Date time;
   
   public String getName() {
   return name;
   }
   
   public void setName(String name) {
   this.name = name;
   }
   
   public int getAge() {
   return age;
   }
   
   public void setAge(int age) {
   this.age = age;
   }
   
   public Date getTime() {
   return time;
   }
   
   public void setTime(Date time) {
   this.time = time;
   }
   }
   
   
   异常信息:
   java.lang.IllegalStateException: ServiceComb init failed.
at org.apache.servicecomb.core.SCBEngine.run(SCBEngine.java:331) 
~[java-chassis-core-2.1.3.jar:2.1.3]
at 
org.apache.servicecomb.core.CseApplicationListener.onApplicationEvent(CseApplicationListener.java:87)
 ~[java-chassis-core-2.1.3.jar:2.1.3]
at 
org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
 ~[spring-context-5.1.14.RELEASE.jar:5.1.14.RELEASE]
at 
org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
 ~[spring-context-5.1.14.RELEASE.jar:5.1.14.RELEASE]
at 
org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
 ~[spring-context-5.1.14.RELEASE.jar:5.1.14.RELEASE]
at 
org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:402)
 ~[spring-context-5.1.14.RELEASE.jar:5.1.14.RELEASE]
at 
org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:359)
 ~[spring-context-5.1.14.RELEASE.jar:5.1.14.RELEASE]
at 
org.springframework.boot.context.event.EventPublishingRunListener.running(EventPublishingRunListener.java:102)
 ~[spring-boot-2.1.6.RELEASE.jar:2.1.6.RELEASE]
at 
org.springframework.boot.SpringApplicationRunListeners.running(SpringApplicationRunListeners.java:77)
 ~[spring-boot-2.1.6.RELEASE.jar:2.1.6.RELEASE]
at 
org.springframework.boot.SpringApplication.run(SpringApplication.java:326) 
[spring-boot-2.1.6.RELEASE.jar:2.1.6.RELEASE]
at 
org.springframework.boot.SpringApplication.run(SpringApplication.java:1213) 
[spring-boot-2.1.6.RELEASE.jar:2.1.6.RELEASE]
at 
org.springframework.boot.SpringApplication.run(SpringApplication.java:1202) 
[spring-boot-2.1.6.RELEASE.jar:2.1.6.RELEASE]
at org.example.StudentMan.main(StudentMan.java:18) [classes/:na]
   Caused by: java.lang.IllegalStateException: generate swagger operation 
failed, method=org.example.controller.HelloController:result.
at 
org.apache.servicecomb.swagger.generator.core.AbstractSwaggerGenerator.scanMethods(AbstractSwaggerGenerator.java:301)
 ~[swagger-generator-core-2.1.3.jar:2.1.3]
at 
org.apache.servicecomb.swagger.generator.core.AbstractSwaggerGenerator.generate(AbstractSwaggerGenerator.java:119)
 ~[swagger-generator-core-2.1.3.jar:2.1.3]
at 
org.apache.servicecomb.swagger.generator.SwaggerGenerator.generate(SwaggerGenerator.java:32)
 ~[swagger-generator-core-2.1.3.jar:2.1.3]
at 
org.apache.servicecomb.swagger.engine.SwaggerEnvironment.checkAndGenerateSwagger(SwaggerEnvironment.java:165)
 ~[swagger-invocation-core-2.1.3.jar:2.1.3]
at 
org.apache.servicecomb.swagger.engine.SwaggerEnvironment.createProducer(SwaggerEnvironment.java:109)
 ~[swagger-invocation-core-2.1.3.jar:2.1.3]
at 
org.apache.servicecomb.core.provider.producer.ProducerProviderManager.registerSchema(ProducerProviderManager.java:102)
 ~[java-chassis-core-2.1.3.jar:2.1.3]
at 
org.apache.servicecomb.core.provider.producer.ProducerProviderManager.registerProducerMetas(ProducerProviderManager.java:87)
 ~[java-chassis-core-2.1.3.jar:2.1.3]
at 
org.apache.servicecomb.core.provider.producer.ProducerProviderManager.init(ProducerProviderManager.java:73)
 ~[java-chassis-core-2.1.3.jar:2.1.3]
at org.apache.servicecomb.core.SCBEngine.doRun(SCBEngine.java:368) 
~[java-chassis-core-2.1.3.jar:2.1.3]
at org.apache.servicecomb.core.SCBEngine.run(SCBEngine.java:319) 
~[java-chassis-core-2.1.3.jar:2.1.3]
... 12 common frames omitted
   Caused by: java.lang.IllegalStateException: parameter name is not present, 
method=org.example.controller.HelloController:result
   solution:
 change pom.xml, add compiler argument: -parameters, for example:
   
 org.apache.maven.plugins
 maven-compiler-plugin
 
   -parameters
 
   
at 
org.apache.servicecomb.swagger.generator.SwaggerGeneratorUtils.collectParameterName(SwaggerGeneratorUtils.java:212)
 

[GitHub] [servicecomb-service-center] tianxiaoliang commented on pull request #787: [SCD-2133] add new display data interface

2020-12-16 Thread GitBox


tianxiaoliang commented on pull request #787:
URL: 
https://github.com/apache/servicecomb-service-center/pull/787#issuecomment-746036884


   补充下Use case



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [servicecomb-java-chassis] codecov-io commented on pull request #2140: [SCB-2164]InstanceCacheCheckTask only print necessary message to avoi…

2020-12-16 Thread GitBox


codecov-io commented on pull request #2140:
URL: 
https://github.com/apache/servicecomb-java-chassis/pull/2140#issuecomment-746028876


   # 
[Codecov](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/2140?src=pr=h1)
 Report
   > Merging 
[#2140](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/2140?src=pr=desc)
 (93bdf2f) into 
[master](https://codecov.io/gh/apache/servicecomb-java-chassis/commit/4d613ee7e142116531b9bec31ae15c364980d01d?el=desc)
 (4d613ee) will **decrease** coverage by `0.03%`.
   > The diff coverage is `69.23%`.
   
   [![Impacted file tree 
graph](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/2140/graphs/tree.svg?width=650=150=pr=KXfDcr9rX2)](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/2140?src=pr=tree)
   
   ```diff
   @@ Coverage Diff  @@
   ## master#2140  +/-   ##
   
   - Coverage 80.77%   80.73%   -0.04% 
 Complexity 1337 1337  
   
 Files  1462 1462  
 Lines 4008140093  +12 
 Branches   3399 3399  
   
   - Hits  3237432368   -6 
   - Misses 6243 6259  +16 
   - Partials   1464 1466   +2 
   ```
   
   
   | [Impacted 
Files](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/2140?src=pr=tree)
 | Coverage Δ | Complexity Δ | |
   |---|---|---|---|
   | 
[...istry/diagnosis/instance/InstanceCacheChecker.java](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/2140/diff?src=pr=tree#diff-c2VydmljZS1yZWdpc3RyeS9yZWdpc3RyeS1zZXJ2aWNlLWNlbnRlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2VydmljZWNvbWIvc2VydmljZXJlZ2lzdHJ5L2RpYWdub3Npcy9pbnN0YW5jZS9JbnN0YW5jZUNhY2hlQ2hlY2tlci5qYXZh)
 | `90.00% <33.33%> (-5.32%)` | `0.00 <0.00> (ø)` | |
   | 
[...mb/registry/api/registry/MicroserviceInstance.java](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/2140/diff?src=pr=tree#diff-Zm91bmRhdGlvbnMvZm91bmRhdGlvbi1yZWdpc3RyeS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2VydmljZWNvbWIvcmVnaXN0cnkvYXBpL3JlZ2lzdHJ5L01pY3Jvc2VydmljZUluc3RhbmNlLmphdmE=)
 | `97.26% <100.00%> (+0.24%)` | `0.00 <0.00> (ø)` | |
   | 
[...try/diagnosis/instance/InstanceCacheCheckTask.java](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/2140/diff?src=pr=tree#diff-c2VydmljZS1yZWdpc3RyeS9yZWdpc3RyeS1zZXJ2aWNlLWNlbnRlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2VydmljZWNvbWIvc2VydmljZXJlZ2lzdHJ5L2RpYWdub3Npcy9pbnN0YW5jZS9JbnN0YW5jZUNhY2hlQ2hlY2tUYXNrLmphdmE=)
 | `90.00% <100.00%> (ø)` | `0.00 <0.00> (ø)` | |
   | 
[...pache/servicecomb/config/kie/client/KieClient.java](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/2140/diff?src=pr=tree#diff-ZHluYW1pYy1jb25maWcvY29uZmlnLWtpZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2VydmljZWNvbWIvY29uZmlnL2tpZS9jbGllbnQvS2llQ2xpZW50LmphdmE=)
 | `72.61% <0.00%> (-5.96%)` | `0.00% <0.00%> (ø%)` | |
   | 
[...mb/serviceregistry/client/http/RestClientUtil.java](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/2140/diff?src=pr=tree#diff-c2VydmljZS1yZWdpc3RyeS9yZWdpc3RyeS1zZXJ2aWNlLWNlbnRlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2VydmljZWNvbWIvc2VydmljZXJlZ2lzdHJ5L2NsaWVudC9odHRwL1Jlc3RDbGllbnRVdGlsLmphdmE=)
 | `75.70% <0.00%> (-1.87%)` | `0.00% <0.00%> (ø%)` | |
   | 
[...egistry/client/http/ServiceRegistryClientImpl.java](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/2140/diff?src=pr=tree#diff-c2VydmljZS1yZWdpc3RyeS9yZWdpc3RyeS1zZXJ2aWNlLWNlbnRlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2VydmljZWNvbWIvc2VydmljZXJlZ2lzdHJ5L2NsaWVudC9odHRwL1NlcnZpY2VSZWdpc3RyeUNsaWVudEltcGwuamF2YQ==)
 | `69.32% <0.00%> (-1.17%)` | `0.00% <0.00%> (ø%)` | |
   | 
[.../servicecomb/config/client/ConfigCenterClient.java](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/2140/diff?src=pr=tree#diff-ZHluYW1pYy1jb25maWcvY29uZmlnLWNjL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zZXJ2aWNlY29tYi9jb25maWcvY2xpZW50L0NvbmZpZ0NlbnRlckNsaWVudC5qYXZh)
 | `52.11% <0.00%> (-0.43%)` | `0.00% <0.00%> (ø%)` | |
   
   --
   
   [Continue to review full report at 
Codecov](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/2140?src=pr=continue).
   > **Legend** - [Click here to learn 
more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute  (impact)`, `ø = not affected`, `? = missing data`
   > Powered by 
[Codecov](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/2140?src=pr=footer).
 Last update 
[4d613ee...93bdf2f](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/2140?src=pr=lastupdated).
 Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the 

[GitHub] [servicecomb-java-chassis] liubao68 edited a comment on issue #2139: @RequestBody 启动报错2.x

2020-12-16 Thread GitBox


liubao68 edited a comment on issue #2139:
URL: 
https://github.com/apache/servicecomb-java-chassis/issues/2139#issuecomment-746011264


   可能是 StudentVo 或者 StudentVo  存在抽象类和接口, 需要看下你的详细错误。 
[类型支持说明参考](https://docs.servicecomb.io/java-chassis/zh_CN/build-provider/interface-constraints/),
 可以先了解下和 spring boot的差异。 



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [servicecomb-java-chassis] liubao68 commented on issue #2139: @RequestBody 启动报错2.x

2020-12-16 Thread GitBox


liubao68 commented on issue #2139:
URL: 
https://github.com/apache/servicecomb-java-chassis/issues/2139#issuecomment-746011264


   可能是 StudentVo 存在抽象类和接口, 需要看下你的详细错误。 
[类型支持说明参考](https://docs.servicecomb.io/java-chassis/zh_CN/build-provider/interface-constraints/),
 可以先了解下和 spring boot的差异。 



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [servicecomb-service-center] GuoYL123 opened a new pull request #787: [SCD-2133] add new display data interface

2020-12-16 Thread GitBox


GuoYL123 opened a new pull request #787:
URL: https://github.com/apache/servicecomb-service-center/pull/787


   Follow this checklist to help us incorporate your contribution quickly and 
easily:
   
- [ ] Make sure there is a [JIRA 
issue](https://issues.apache.org/jira/browse/SCB) filed for the change (usually 
before you start working on it).  Trivial changes like typos do not require a 
JIRA issue.  Your pull request should address just this issue, without pulling 
in other changes.
- [ ] Each commit in the pull request should have a meaningful subject line 
and body.
- [ ] Format the pull request title like `[SCB-XXX] Fixes bug in 
ApproximateQuantiles`, where you replace `SCB-XXX` with the appropriate JIRA 
issue.
- [ ] Write a pull request description that is detailed enough to 
understand what the pull request does, how, and why.
- [ ] Run `go build` `go test` `go fmt` `go vet` to make sure basic checks 
pass. A more thorough check will be performed on your pull request 
automatically.
- [ ] If this contribution is large, please file an Apache [Individual 
Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
- [ ] Never comment source code, delete it.
- [ ] UT should has "context, subject, expected result" result as test case 
name, when you call t.Run().
   ---
   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [servicecomb-java-chassis] liubao68 opened a new pull request #2140: [SCB-2164]InstanceCacheCheckTask only print necessary message to avoi…

2020-12-16 Thread GitBox


liubao68 opened a new pull request #2140:
URL: https://github.com/apache/servicecomb-java-chassis/pull/2140


   …d information leak
   
   Follow this checklist to help us incorporate your contribution quickly and 
easily:
   
- [ ] Make sure there is a [JIRA 
issue](https://issues.apache.org/jira/browse/SCB) filed for the change (usually 
before you start working on it).  Trivial changes like typos do not require a 
JIRA issue.  Your pull request should address just this issue, without pulling 
in other changes.
- [ ] Each commit in the pull request should have a meaningful subject line 
and body.
- [ ] Format the pull request title like `[SCB-XXX] Fixes bug in 
ApproximateQuantiles`, where you replace `SCB-XXX` with the appropriate JIRA 
issue.
- [ ] Write a pull request description that is detailed enough to 
understand what the pull request does, how, and why.
- [ ] Run `mvn clean install -Pit` to make sure basic checks pass. A more 
thorough check will be performed on your pull request automatically.
- [ ] If this contribution is large, please file an Apache [Individual 
Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
   
   ---
   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [servicecomb-java-chassis] xiaoyuer11 closed issue #2129: 服务启动后,不会自动下载被调用服务实例接口锲约,只有接口第一次调用的时候才会去获取

2020-12-16 Thread GitBox


xiaoyuer11 closed issue #2129:
URL: https://github.com/apache/servicecomb-java-chassis/issues/2129


   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [servicecomb-java-chassis] xiaoyuer11 commented on issue #2129: 服务启动后,不会自动下载被调用服务实例接口锲约,只有接口第一次调用的时候才会去获取

2020-12-16 Thread GitBox


xiaoyuer11 commented on issue #2129:
URL: 
https://github.com/apache/servicecomb-java-chassis/issues/2129#issuecomment-745967205


   已解决  ths



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [servicecomb-java-chassis] myVictor opened a new issue #2139: @RequestBody 启动报错2.x

2020-12-16 Thread GitBox


myVictor opened a new issue #2139:
URL: https://github.com/apache/servicecomb-java-chassis/issues/2139


   Caused by: java.lang.IllegalStateException: generate swagger operation failed
   
   我看springmvc标签支持表是支持的。 
[](https://docs.servicecomb.io/java-chassis/zh_CN/build-provider/springmvc/)
   
@RequestMapping(value = "/result.action",produces = "application/json")
@ResponseBody
public ModelMap result(@RequestBody StudentVo studentVo)
   
   这种写法问题在哪,应该怎么写?



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[servicecomb-java-chassis] branch master updated: [SCB-2163] tiny code improve (#2138)

2020-12-16 Thread liubao
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 4d613ee  [SCB-2163] tiny code improve (#2138)
4d613ee is described below

commit 4d613ee7e142116531b9bec31ae15c364980d01d
Author: wujimin 
AuthorDate: Wed Dec 16 16:24:14 2020 +0800

[SCB-2163] tiny code improve (#2138)
---
 .../foundation/vertx/client/http/HttpClients.java  | 50 --
 1 file changed, 28 insertions(+), 22 deletions(-)

diff --git 
a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/client/http/HttpClients.java
 
b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/client/http/HttpClients.java
index 74c3593..1f62e4a 100644
--- 
a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/client/http/HttpClients.java
+++ 
b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/client/http/HttpClients.java
@@ -36,6 +36,7 @@ import io.vertx.core.Context;
 import io.vertx.core.DeploymentOptions;
 import io.vertx.core.Vertx;
 import io.vertx.core.VertxOptions;
+import io.vertx.core.dns.AddressResolverOptions;
 
 /**
  *  load and manages a set of HttpClient at boot up.
@@ -65,7 +66,7 @@ public class HttpClients {
   }
 
   /* used for configurations module: these module must be boot before other 
HttpClients is initialized. so can
-  *  not load by SPI, must add manually  */
+   * not load by SPI, must add manually  */
   public static void addNewClientPoolManager(HttpClientOptionsSPI option) {
 httpClients.put(option.clientName(), createClientPoolManager(option));
   }
@@ -80,20 +81,7 @@ public class HttpClients {
   }
 
   private static ClientPoolManager 
createClientPoolManager(HttpClientOptionsSPI option) {
-Vertx vertx;
-
-if (option.useSharedVertx()) {
-  vertx = SharedVertxFactory.getSharedVertx();
-} else {
-  VertxOptions vertxOptions = new VertxOptions()
-  .setAddressResolverOptions(AddressResolverConfig
-  .getAddressResover(option.getConfigTag(), 
option.getConfigReader()))
-  .setEventLoopPoolSize(option.getEventLoopPoolSize());
-
-  // Maybe we can deploy only one vert.x for the application. However this 
has did it like this.
-  vertx = VertxUtils.getOrCreateVertxByName(option.clientName(), 
vertxOptions);
-}
-
+Vertx vertx = getOrCreateVertx(option);
 ClientPoolManager clientPoolManager = new 
ClientPoolManager<>(vertx,
 new 
HttpClientPoolFactory(HttpClientOptionsSPI.createHttpClientOptions(option)));
 
@@ -104,10 +92,25 @@ public class HttpClients {
 .setWorkerPoolSize(option.getWorkerPoolSize());
 try {
   VertxUtils.blockDeploy(vertx, ClientVerticle.class, deployOptions);
+  return clientPoolManager;
 } catch (InterruptedException e) {
   throw new IllegalStateException(e);
 }
-return clientPoolManager;
+  }
+
+  private static Vertx getOrCreateVertx(HttpClientOptionsSPI option) {
+if (option.useSharedVertx()) {
+  return SharedVertxFactory.getSharedVertx();
+}
+
+AddressResolverOptions resolverOptions = AddressResolverConfig
+.getAddressResover(option.getConfigTag(), option.getConfigReader());
+VertxOptions vertxOptions = new VertxOptions()
+.setAddressResolverOptions(resolverOptions)
+.setEventLoopPoolSize(option.getEventLoopPoolSize());
+
+// Maybe we can deploy only one vert.x for the application. However this 
has did it like this.
+return VertxUtils.getOrCreateVertxByName(option.clientName(), 
vertxOptions);
   }
 
   /**
@@ -116,11 +119,12 @@ public class HttpClients {
* @return the deployed instance name
*/
   public static HttpClientWithContext getClient(String clientName) {
-if (httpClients.get(clientName) == null) {
+ClientPoolManager poolManager = 
httpClients.get(clientName);
+if (poolManager == null) {
   LOGGER.error("client name [{}] not exists, should only happen in 
tests.", clientName);
   return null;
 }
-return httpClients.get(clientName).findThreadBindClientPool();
+return poolManager.findThreadBindClientPool();
   }
 
   /**
@@ -130,11 +134,12 @@ public class HttpClients {
* @return the deployed instance name
*/
   public static HttpClientWithContext getClient(String clientName, boolean 
sync) {
-if (httpClients.get(clientName) == null) {
+ClientPoolManager poolManager = 
httpClients.get(clientName);
+if (poolManager == null) {
   LOGGER.error("client name [{}] not exists, should only happen in 
tests.", clientName);
   return null;
 }
-return httpClients.get(clientName).findClientPool(sync);
+return poolManager.findClientPool(sync);
   }
 
   /**
@@ -145,10 +150,11 @@ public class HttpClients {
* 

[GitHub] [servicecomb-java-chassis] liubao68 merged pull request #2138: [SCB-2163] tiny code improve

2020-12-16 Thread GitBox


liubao68 merged pull request #2138:
URL: https://github.com/apache/servicecomb-java-chassis/pull/2138


   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org