[incubator-servicecomb-website] branch asf-site updated (737b25a -> 429d351)

2018-03-30 Thread ningjiang
This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a change to branch asf-site
in repository 
https://gitbox.apache.org/repos/asf/incubator-servicecomb-website.git.


from 737b25a  Published the website
 add 4f41cd0  Update the download page as per the comments from moderator 
(#50)
 new 677e43b  Merge branch 'master' into asf-site
 new 429d351  Publish the website

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 _data/navigation.yml   |  6 +-
 _release/cn/release.md | 37 +
 _release/cn/saga_binaries.md   |  4 +-
 _release/cn/saga_downloads.md  | 14 
 _release/cn/service_center_binaries.md |  5 +-
 _release/cn/service_center_downloads.md| 16 
 _release/release.md| 37 +
 _release/saga_binaries.md  |  4 +-
 _release/saga_downloads.md | 14 
 _release/service_center_binaries.md|  5 +-
 _release/service_center_downloads.md   | 15 
 content/cn/release/index.html  | 36 +
 content/cn/release/saga-binary/index.html  |  7 +-
 .../{saga-binary => saga-downloads}/index.html | 19 +++--
 content/cn/release/sc-binary/index.html|  8 +-
 .../release/{sc-binary => sc-downloads}/index.html | 20 +++--
 content/feed.xml   |  2 +-
 content/release/index.html | 42 +-
 content/release/java-chassis-binary/index.html |  6 +-
 .../release/java-chassis-release-notes/index.html  |  6 +-
 content/release/saga-binary/index.html | 13 +++-
 .../{saga-binary => saga-downloads}/index.html | 23 +++---
 content/release/saga-release-notes/index.html  |  6 +-
 content/release/sc-binary/index.html   | 14 +++-
 .../release/{sc-binary => sc-downloads}/index.html | 24 +++---
 content/release/sc-release-notes/index.html|  6 +-
 content/sitemap.xml| 90 +-
 27 files changed, 377 insertions(+), 102 deletions(-)
 create mode 100644 _release/cn/saga_downloads.md
 create mode 100644 _release/cn/service_center_downloads.md
 create mode 100644 _release/saga_downloads.md
 create mode 100644 _release/service_center_downloads.md
 copy content/cn/release/{saga-binary => saga-downloads}/index.html (87%)
 copy content/cn/release/{sc-binary => sc-downloads}/index.html (83%)
 copy content/release/{saga-binary => saga-downloads}/index.html (86%)
 copy content/release/{sc-binary => sc-downloads}/index.html (82%)

-- 
To stop receiving notification emails like this one, please contact
ningji...@apache.org.


[incubator-servicecomb-website] 01/02: Merge branch 'master' into asf-site

2018-03-30 Thread ningjiang
This is an automated email from the ASF dual-hosted git repository.

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

commit 677e43b83866b295259edd30a0eeab9a0d3b3f60
Merge: 737b25a 4f41cd0
Author: Willem Jiang 
AuthorDate: Fri Mar 30 22:24:18 2018 +0800

Merge branch 'master' into asf-site

 _data/navigation.yml|  6 +++---
 _release/cn/release.md  | 37 +
 _release/cn/saga_binaries.md|  4 +++-
 _release/cn/saga_downloads.md   | 14 +
 _release/cn/service_center_binaries.md  |  5 -
 _release/cn/service_center_downloads.md | 16 ++
 _release/release.md | 37 +
 _release/saga_binaries.md   |  4 +++-
 _release/saga_downloads.md  | 14 +
 _release/service_center_binaries.md |  5 -
 _release/service_center_downloads.md| 15 +
 11 files changed, 150 insertions(+), 7 deletions(-)


-- 
To stop receiving notification emails like this one, please contact
ningji...@apache.org.


[incubator-servicecomb-website] branch master updated: Update the download page as per the comments from moderator (#50)

2018-03-30 Thread ningjiang
This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch master
in repository 
https://gitbox.apache.org/repos/asf/incubator-servicecomb-website.git


The following commit(s) were added to refs/heads/master by this push:
 new 4f41cd0  Update the download page as per the comments from moderator 
(#50)
4f41cd0 is described below

commit 4f41cd0e4ae0ed0bc4157f96cec41aa407f806af
Author: Mohammad Asif Siddiqui 
AuthorDate: Fri Mar 30 19:53:12 2018 +0530

Update the download page as per the comments from moderator (#50)

* Update the download page as per the comments for moderator

* Rename the links to downloads
---
 _data/navigation.yml|  6 +++---
 _release/cn/release.md  | 37 +
 _release/cn/saga_binaries.md|  4 +++-
 _release/cn/saga_downloads.md   | 14 +
 _release/cn/service_center_binaries.md  |  5 -
 _release/cn/service_center_downloads.md | 16 ++
 _release/release.md | 37 +
 _release/saga_binaries.md   |  4 +++-
 _release/saga_downloads.md  | 14 +
 _release/service_center_binaries.md |  5 -
 _release/service_center_downloads.md| 15 +
 11 files changed, 150 insertions(+), 7 deletions(-)

diff --git a/_data/navigation.yml b/_data/navigation.yml
index a0313f7..6fa0c15 100755
--- a/_data/navigation.yml
+++ b/_data/navigation.yml
@@ -137,19 +137,19 @@ t:
 children:
   - title: "Release Notes"
 url: /release/sc-release-notes/
-  - title: "Binaries"
+  - title: "Donwloads"
 url: /release/sc-binary/
   - title: "Java-Chassis"
 children:
   - title: "Release Notes"
 url: /release/java-chassis-release-notes/
-  - title: "Binaries"
+  - title: "Downloads"
 url: /release/java-chassis-binary/
   - title: "Saga"
 children:
   - title: "Release Notes"
 url: /release/saga-release-notes/
-  - title: "Binaries"
+  - title: "Downloads"
 url: /release/saga-binary/
 
 
diff --git a/_release/cn/release.md b/_release/cn/release.md
index ba4e96a..e5da903 100644
--- a/_release/cn/release.md
+++ b/_release/cn/release.md
@@ -17,3 +17,40 @@ Only current recommended releases are available on the main 
distribution site an
 * [Apache ServiceComb (incubating) Service-Center 
1.0.0-m1](https://apache.org/dyn/closer.cgi/incubator/servicecomb/incubator-servicecomb-service-center/1.0.0-m1/){:target="_blank"}
 (released on 2018-03-27)
 
 * [Apache ServiceComb (incubating) Saga 
0.1.0](https://apache.org/dyn/closer.cgi/incubator/servicecomb/incubator-servicecomb-saga/0.1.0/){:target="_blank"}
 (released on 2018-03-27)
+
+
+**Verifying the release**
+
+It is essential that you verify the integrity of the downloaded files using 
the PGP or SHA signatures.
+ The PGP signatures can  be verified using GPG or PGP. 
+ Please download the 
[KEYS](https://www.apache.org/dist/incubator/servicecomb/KEYS){:target="_blank"}
 as well as the asc signature files for relevant distribution. It is 
recommended to get these files from the main distribution 
[directory](https://www.apache.org/dist/incubator/servicecomb/){:target="_blank"}
 and not from the mirrors.
+ ```
+ gpg -i KEYS
+ 
+ or
+ 
+ pgpk -a KEYS
+ 
+ or
+ 
+ pgp -ka KEYS
+
+```
+
+To verify the binaries/sources you can download the relevant asc files for it 
from main distribution directory and follow the below guide.
+
+```
+gpg --verify apache-servicecomb-incubating.asc 
apache-servicecomb-incubating*
+
+or
+
+pgpv apache-servicecomb-incubating.asc
+
+or 
+
+pgp apache-servicecomb-incubating.asc
+
+
+```
+
+Alternatively you can download the SHA signatures from main distribution 
[repo](https://www.apache.org/dist/incubator/servicecomb/){:target="_blank"} 
and verify the downloads using sha512sum.
diff --git a/_release/cn/saga_binaries.md b/_release/cn/saga_binaries.md
index a3af711..9e8ea8f 100644
--- a/_release/cn/saga_binaries.md
+++ b/_release/cn/saga_binaries.md
@@ -9,4 +9,6 @@ last_modified_at: 2018-03-28T00:50:43-55:00
 
 ## Releases
 
-* Apache ServiceComb (incubating) Saga 0.1.0 
[[Distribution]](https://apache.org/dyn/closer.cgi/incubator/servicecomb/incubator-servicecomb-saga/0.1.0/apache-servicecomb-incubating-saga-distribution-0.1.0-bin.zip)
 
[[SRC]](https://apache.org/dyn/closer.cgi/incubator/servicecomb/incubator-servicecomb-saga/0.1.0/apache-servicecomb-incubating-saga-distribution-0.1.0-src.zip)
 
+* Apache ServiceComb (incubating) Saga 0.1.0
+- Source 
[[src]](https://apache.org/dyn/closer.cgi/incubator/servicecomb/incubator-servicecomb-saga/0.1.0/apache-servicecomb-incubating-saga-distribution-0.1.0-src.zip)
 

[incubator-servicecomb-java-chassis] 03/04: SCB-447 delete repeated log

2018-03-30 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/incubator-servicecomb-java-chassis.git

commit 774787c69a41759979d298a058269714555a9831
Author: wujimin 
AuthorDate: Thu Mar 29 13:08:37 2018 +0800

SCB-447 delete repeated log
---
 .../apache/servicecomb/foundation/metrics/MetricsBootstrap.java   | 6 --
 .../swagger/generator/core/CompositeSwaggerGeneratorContext.java  | 8 
 .../swagger/invocation/response/ResponseMapperFactorys.java   | 7 ---
 .../servicecomb/transport/rest/client/http/VertxHttpMethod.java   | 6 --
 .../transport/rest/vertx/AbstractVertxHttpDispatcher.java | 6 --
 .../servicecomb/transport/rest/vertx/RestServerVerticle.java  | 1 -
 6 files changed, 34 deletions(-)

diff --git 
a/foundations/foundation-metrics/src/main/java/org/apache/servicecomb/foundation/metrics/MetricsBootstrap.java
 
b/foundations/foundation-metrics/src/main/java/org/apache/servicecomb/foundation/metrics/MetricsBootstrap.java
index 2335264..0c6a523 100644
--- 
a/foundations/foundation-metrics/src/main/java/org/apache/servicecomb/foundation/metrics/MetricsBootstrap.java
+++ 
b/foundations/foundation-metrics/src/main/java/org/apache/servicecomb/foundation/metrics/MetricsBootstrap.java
@@ -22,8 +22,6 @@ import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.TimeUnit;
 
 import org.apache.servicecomb.foundation.common.utils.SPIServiceUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 import com.google.common.collect.Lists;
 import com.google.common.eventbus.EventBus;
@@ -32,8 +30,6 @@ import com.netflix.spectator.api.CompositeRegistry;
 import com.netflix.spectator.api.Meter;
 
 public class MetricsBootstrap {
-  private static final Logger LOGGER = 
LoggerFactory.getLogger(MetricsBootstrap.class);
-
   private CompositeRegistry globalRegistry;
 
   private EventBus eventBus;
@@ -60,8 +56,6 @@ public class MetricsBootstrap {
 
   protected void loadMetricsInitializers() {
 
SPIServiceUtils.getSortedService(MetricsInitializer.class).forEach(initializer 
-> {
-  LOGGER.info("Found MetricsInitializer: {}", 
initializer.getClass().getName());
-
   initializer.init(globalRegistry, eventBus, config);
 });
   }
diff --git 
a/swagger/swagger-generator/generator-core/src/main/java/org/apache/servicecomb/swagger/generator/core/CompositeSwaggerGeneratorContext.java
 
b/swagger/swagger-generator/generator-core/src/main/java/org/apache/servicecomb/swagger/generator/core/CompositeSwaggerGeneratorContext.java
index b69ebba..ef39793 100644
--- 
a/swagger/swagger-generator/generator-core/src/main/java/org/apache/servicecomb/swagger/generator/core/CompositeSwaggerGeneratorContext.java
+++ 
b/swagger/swagger-generator/generator-core/src/main/java/org/apache/servicecomb/swagger/generator/core/CompositeSwaggerGeneratorContext.java
@@ -20,24 +20,16 @@ package org.apache.servicecomb.swagger.generator.core;
 import java.util.List;
 
 import org.apache.servicecomb.foundation.common.utils.SPIServiceUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.springframework.context.EmbeddedValueResolverAware;
 import org.springframework.stereotype.Component;
 import org.springframework.util.StringValueResolver;
 
 @Component
 public class CompositeSwaggerGeneratorContext implements 
EmbeddedValueResolverAware {
-  private static final Logger LOGGER = 
LoggerFactory.getLogger(CompositeSwaggerGeneratorContext.class);
-
   private List contextList;
 
   public CompositeSwaggerGeneratorContext() {
 contextList = 
SPIServiceUtils.getSortedService(SwaggerGeneratorContext.class);
-
-for (SwaggerGeneratorContext context : contextList) {
-  LOGGER.info("Found swagger generator context: {}", 
context.getClass().getName());
-}
   }
 
   @Override
diff --git 
a/swagger/swagger-invocation/invocation-core/src/main/java/org/apache/servicecomb/swagger/invocation/response/ResponseMapperFactorys.java
 
b/swagger/swagger-invocation/invocation-core/src/main/java/org/apache/servicecomb/swagger/invocation/response/ResponseMapperFactorys.java
index 5a9d2c2..92e95c6 100644
--- 
a/swagger/swagger-invocation/invocation-core/src/main/java/org/apache/servicecomb/swagger/invocation/response/ResponseMapperFactorys.java
+++ 
b/swagger/swagger-invocation/invocation-core/src/main/java/org/apache/servicecomb/swagger/invocation/response/ResponseMapperFactorys.java
@@ -21,12 +21,8 @@ import java.util.List;
 
 import org.apache.servicecomb.foundation.common.utils.SPIServiceUtils;
 import org.apache.servicecomb.swagger.invocation.converter.ConverterMgr;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 public class ResponseMapperFactorys {
-  private static final Logger LOGGER = 
LoggerFactory.getLogger(ResponseMapperFactorys.class);
-
   private List factorys;
 
   public 

[incubator-servicecomb-java-chassis] 04/04: SCB-447 confirmed with the author, delete useless test case

2018-03-30 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/incubator-servicecomb-java-chassis.git

commit 38a1d8b42196b2291ceabbeefc767f85fa27f4e9
Author: wujimin 
AuthorDate: Fri Mar 30 09:41:53 2018 +0800

SCB-447 confirmed with the author, delete useless test case
---
 .../consumer/TestMicroserviceManager.java  | 26 --
 1 file changed, 26 deletions(-)

diff --git 
a/service-registry/src/test/java/org/apache/servicecomb/serviceregistry/consumer/TestMicroserviceManager.java
 
b/service-registry/src/test/java/org/apache/servicecomb/serviceregistry/consumer/TestMicroserviceManager.java
index c87504c..8a5f236 100644
--- 
a/service-registry/src/test/java/org/apache/servicecomb/serviceregistry/consumer/TestMicroserviceManager.java
+++ 
b/service-registry/src/test/java/org/apache/servicecomb/serviceregistry/consumer/TestMicroserviceManager.java
@@ -90,32 +90,6 @@ public class TestMicroserviceManager {
   }
 
   @Test
-  public void testCreateRuleServiceTooMany() throws Exception {
-new Expectations(RegistryUtils.class) {
-  {
-RegistryUtils.findServiceInstances(appId, anyString, 
DefinitionConst.VERSION_RULE_ALL, null);
-result = microserviceInstances;
-  }
-};
-
-for (int i = 0; i < 1005; i++) {
-  MicroserviceVersionRule microserviceVersionRule =
-  microserviceManager.getOrCreateMicroserviceVersionRule(serviceName + 
i, versionRule);
-  Assert.assertEquals("0.0.0+", 
microserviceVersionRule.getVersionRule().getVersionRule());
-  
Assert.assertNull(microserviceVersionRule.getLatestMicroserviceVersion());
-  if (i == 499) {
-Thread.sleep(1);
-  }
-}
-
-Assert.assertEquals(1005, cachedVersions.size());
-Assert.assertEquals("msName1004", 
cachedVersions.get("msName1004").getMicroserviceName());
-Assert.assertEquals("msName1000", 
cachedVersions.get("msName1000").getMicroserviceName());
-Assert.assertEquals("msName500", 
cachedVersions.get("msName500").getMicroserviceName());
-Assert.assertEquals("msName0", 
cachedVersions.get("msName0").getMicroserviceName());
-  }
-
-  @Test
   public void testCreateRuleServiceNotExists() {
 new Expectations(RegistryUtils.class) {
   {

-- 
To stop receiving notification emails like this one, please contact
liu...@apache.org.


[incubator-servicecomb-java-chassis] 02/04: SCB-447 modify test cases that are affected by SPI cache.

2018-03-30 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/incubator-servicecomb-java-chassis.git

commit 3315da4664305a13c2d1d87291bedc9a3e954e99
Author: wujimin 
AuthorDate: Thu Mar 29 15:05:12 2018 +0800

SCB-447 modify test cases that are affected by SPI cache.
---
 .../apache/servicecomb/common/rest/TestAbstractRestInvocation.java | 2 +-
 .../transport/rest/servlet/TestRestServletProducerInvocation.java  | 7 +++
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git 
a/common/common-rest/src/test/java/org/apache/servicecomb/common/rest/TestAbstractRestInvocation.java
 
b/common/common-rest/src/test/java/org/apache/servicecomb/common/rest/TestAbstractRestInvocation.java
index 363bfab..72d0b13 100644
--- 
a/common/common-rest/src/test/java/org/apache/servicecomb/common/rest/TestAbstractRestInvocation.java
+++ 
b/common/common-rest/src/test/java/org/apache/servicecomb/common/rest/TestAbstractRestInvocation.java
@@ -656,7 +656,7 @@ public class TestAbstractRestInvocation {
 }.getMockInstance();
 
 initRestInvocation();
-List httpServerFilters = 
SPIServiceUtils.getSortedService(HttpServerFilter.class);
+List httpServerFilters = 
SPIServiceUtils.loadSortedService(HttpServerFilter.class);
 httpServerFilters.add(filter);
 restInvocation.setHttpServerFilters(httpServerFilters);
 
diff --git 
a/transports/transport-rest/transport-rest-servlet/src/test/java/org/apache/servicecomb/transport/rest/servlet/TestRestServletProducerInvocation.java
 
b/transports/transport-rest/transport-rest-servlet/src/test/java/org/apache/servicecomb/transport/rest/servlet/TestRestServletProducerInvocation.java
index b623fe5..a83480a 100644
--- 
a/transports/transport-rest/transport-rest-servlet/src/test/java/org/apache/servicecomb/transport/rest/servlet/TestRestServletProducerInvocation.java
+++ 
b/transports/transport-rest/transport-rest-servlet/src/test/java/org/apache/servicecomb/transport/rest/servlet/TestRestServletProducerInvocation.java
@@ -26,7 +26,6 @@ import 
org.apache.servicecomb.common.rest.RestProducerInvocation;
 import org.apache.servicecomb.common.rest.definition.RestOperationMeta;
 import org.apache.servicecomb.common.rest.filter.HttpServerFilter;
 import org.apache.servicecomb.core.definition.OperationMeta;
-import org.apache.servicecomb.foundation.common.utils.SPIServiceUtils;
 import org.apache.servicecomb.foundation.vertx.http.HttpServletRequestEx;
 import 
org.apache.servicecomb.foundation.vertx.http.StandardHttpServletRequestEx;
 import org.junit.Assert;
@@ -60,7 +59,7 @@ public class TestRestServletProducerInvocation {
 };
 
 List httpServerFilters = Arrays.asList(f1);
-new Expectations(SPIServiceUtils.class) {
+new Expectations() {
   {
 f1.needCacheRequest(operationMeta);
 result = true;
@@ -76,7 +75,7 @@ public class TestRestServletProducerInvocation {
   @Test
   public void collectCacheRequestCacheTrue(@Mocked HttpServerFilter f1) {
 List httpServerFilters = Arrays.asList(f1);
-new Expectations(SPIServiceUtils.class) {
+new Expectations() {
   {
 f1.needCacheRequest(operationMeta);
 result = true;
@@ -90,7 +89,7 @@ public class TestRestServletProducerInvocation {
   @Test
   public void collectCacheRequestCacheFalse(@Mocked HttpServerFilter f1) {
 List httpServerFilters = Arrays.asList(f1);
-new Expectations(SPIServiceUtils.class) {
+new Expectations() {
   {
 f1.needCacheRequest(operationMeta);
 result = false;

-- 
To stop receiving notification emails like this one, please contact
liu...@apache.org.


[incubator-servicecomb-java-chassis] 01/04: SCB-447 cache instances by SPI type

2018-03-30 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/incubator-servicecomb-java-chassis.git

commit 862006574e7cd6d4b6abf964378565b1206146a0
Author: wujimin 
AuthorDate: Thu Mar 29 13:06:55 2018 +0800

SCB-447 cache instances by SPI type
---
 .../foundation/common/utils/SPIServiceUtils.java   | 90 +-
 .../common/utils/SPIServiceDef0Impl.java   | 22 ++
 .../common/utils/TestSPIServiceUtils.java  | 23 ++
 3 files changed, 114 insertions(+), 21 deletions(-)

diff --git 
a/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/SPIServiceUtils.java
 
b/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/SPIServiceUtils.java
index 5011abe..9cbfc86 100644
--- 
a/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/SPIServiceUtils.java
+++ 
b/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/SPIServiceUtils.java
@@ -22,8 +22,10 @@ import java.util.AbstractMap.SimpleEntry;
 import java.util.ArrayList;
 import java.util.Comparator;
 import java.util.List;
+import java.util.Map;
 import java.util.Map.Entry;
 import java.util.ServiceLoader;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.stream.Collectors;
 
 import org.slf4j.Logger;
@@ -38,31 +40,21 @@ import org.springframework.util.ReflectionUtils;
 public final class SPIServiceUtils {
   private static final Logger LOGGER = 
LoggerFactory.getLogger(SPIServiceUtils.class);
 
+  // load one service, maybe trigger load another service
+  // computeIfAbsent can not support this feature
+  // so use double check
+  private static final Object LOCK = new Object();
+
+  private static final Map cache = new 
ConcurrentHashMap<>();
+
   private SPIServiceUtils() {
 
   }
 
   /**
-   * get target service.if target services are array,only random access to a 
service.
+   * no cache, return new instances every time.
*/
-  public static  T getTargetService(Class serviceType) {
-ServiceLoader loader = ServiceLoader.load(serviceType);
-for (T service : loader) {
-  LOGGER.info("get the SPI service success, the extend service is: {}", 
service.getClass());
-  return service;
-}
-LOGGER.info("Can not get the SPI service, the interface type is: {}", 
serviceType.toString());
-return null;
-  }
-
-  public static  List getAllService(Class serviceType) {
-List list = new ArrayList<>();
-ServiceLoader.load(serviceType).forEach(list::add);
-
-return list;
-  }
-
-  public static  List getSortedService(Class serviceType) {
+  public static  List loadSortedService(Class serviceType) {
 List> serviceEntries = new ArrayList<>();
 ServiceLoader serviceLoader = ServiceLoader.load(serviceType);
 serviceLoader.forEach(service -> {
@@ -76,18 +68,74 @@ public final class SPIServiceUtils {
   serviceEntries.add(entry);
 });
 
-return serviceEntries.stream()
+List services = serviceEntries.stream()
 .sorted(Comparator.comparingInt(Entry::getKey))
 .map(Entry::getValue)
 .collect(Collectors.toList());
+
+LOGGER.info("Found SPI service {}, count={}.", serviceType.getName(), 
services.size());
+for (int idx = 0; idx < services.size(); idx++) {
+  T service = services.get(idx);
+  LOGGER.info("  {}. {}.", idx, service.getClass().getName());
+}
+
+return services;
+  }
+
+  @SuppressWarnings("unchecked")
+  public static  List getOrLoadSortedService(Class serviceType) {
+List services = cache.get(serviceType);
+if (services == null) {
+  synchronized (LOCK) {
+services = cache.get(serviceType);
+if (services == null) {
+  services = (List) loadSortedService(serviceType);
+  cache.put(serviceType, services);
+}
+  }
+}
+
+return (List) services;
+  }
+
+  /**
+   * get target service.if target services are array,only random access to a 
service.
+   */
+  public static  T getTargetService(Class serviceType) {
+List services = getOrLoadSortedService(serviceType);
+if (services.isEmpty()) {
+  LOGGER.info("Can not find SPI service for {}", serviceType.getName());
+  return null;
+}
+
+return services.get(0);
+  }
+
+  public static  List getAllService(Class serviceType) {
+return getOrLoadSortedService(serviceType);
+  }
+
+  public static  List getSortedService(Class serviceType) {
+return getOrLoadSortedService(serviceType);
   }
 
   public static  T getPriorityHighestService(Class serviceType) {
-List services = getSortedService(serviceType);
+List services = getOrLoadSortedService(serviceType);
 if (services.isEmpty()) {
+  LOGGER.info("Can not find SPI service for {}", serviceType.getName());
   

[incubator-servicecomb-java-chassis] branch master updated (ae28a9f -> 38a1d8b)

2018-03-30 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/incubator-servicecomb-java-chassis.git.


from ae28a9f  SCB-383 subscribe invocation life event and statistics
 new 8620065  SCB-447 cache instances by SPI type
 new 3315da4  SCB-447 modify test cases that are affected by SPI cache.
 new 774787c  SCB-447 delete repeated log
 new 38a1d8b  SCB-447 confirmed with the author, delete useless test case

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../common/rest/TestAbstractRestInvocation.java|  2 +-
 .../foundation/common/utils/SPIServiceUtils.java   | 90 +-
 ...{SPIServiceDef.java => SPIServiceDef0Impl.java} |  2 +-
 .../common/utils/TestSPIServiceUtils.java  | 23 ++
 .../foundation/metrics/MetricsBootstrap.java   |  6 --
 .../consumer/TestMicroserviceManager.java  | 26 ---
 .../core/CompositeSwaggerGeneratorContext.java |  8 --
 .../response/ResponseMapperFactorys.java   |  7 --
 .../rest/client/http/VertxHttpMethod.java  |  6 --
 .../servlet/TestRestServletProducerInvocation.java |  7 +-
 .../rest/vertx/AbstractVertxHttpDispatcher.java|  6 --
 .../transport/rest/vertx/RestServerVerticle.java   |  1 -
 12 files changed, 97 insertions(+), 87 deletions(-)
 copy 
foundations/foundation-common/src/test/java/org/apache/servicecomb/foundation/common/utils/{SPIServiceDef.java
 => SPIServiceDef0Impl.java} (93%)

-- 
To stop receiving notification emails like this one, please contact
liu...@apache.org.