You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by su...@apache.org on 2023/02/04 14:00:01 UTC

[shardingsphere] branch master updated: Revert TypedSPILoader.getAllServices (#24004)

This is an automated email from the ASF dual-hosted git repository.

sunnianjun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 19377e060f4 Revert TypedSPILoader.getAllServices (#24004)
19377e060f4 is described below

commit 19377e060f43daa63fb34ec4a169ab50ebce0093
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Sat Feb 4 21:59:53 2023 +0800

    Revert TypedSPILoader.getAllServices (#24004)
---
 .../infra/util/spi/type/typed/TypedSPILoader.java           | 13 -------------
 .../infra/util/spi/type/typed/TypedSPILoaderTest.java       |  5 -----
 2 files changed, 18 deletions(-)

diff --git a/infra/util/src/main/java/org/apache/shardingsphere/infra/util/spi/type/typed/TypedSPILoader.java b/infra/util/src/main/java/org/apache/shardingsphere/infra/util/spi/type/typed/TypedSPILoader.java
index ea87f2bb92a..f63b5950ddf 100644
--- a/infra/util/src/main/java/org/apache/shardingsphere/infra/util/spi/type/typed/TypedSPILoader.java
+++ b/infra/util/src/main/java/org/apache/shardingsphere/infra/util/spi/type/typed/TypedSPILoader.java
@@ -22,10 +22,8 @@ import lombok.NoArgsConstructor;
 import org.apache.shardingsphere.infra.util.spi.ShardingSphereServiceLoader;
 import org.apache.shardingsphere.infra.util.spi.exception.ServiceProviderNotFoundServerException;
 
-import java.util.Collection;
 import java.util.Optional;
 import java.util.Properties;
-import java.util.stream.Collectors;
 
 /**
  * Typed SPI loader.
@@ -45,17 +43,6 @@ public final class TypedSPILoader {
         return ShardingSphereServiceLoader.getServiceInstances(spiClass).stream().anyMatch(each -> matchesType(type, each));
     }
     
-    /**
-     * Get all services.
-     * 
-     * @param spiClass SPI class
-     * @param <T> SPI class type 
-     * @return all services
-     */
-    public static <T extends TypedSPI> Collection<T> getAllServices(final Class<T> spiClass) {
-        return ShardingSphereServiceLoader.getServiceInstances(spiClass).stream().map(each -> getService(spiClass, each.getType())).collect(Collectors.toList());
-    }
-    
     /**
      * Find service.
      *
diff --git a/infra/util/src/test/java/org/apache/shardingsphere/infra/util/spi/type/typed/TypedSPILoaderTest.java b/infra/util/src/test/java/org/apache/shardingsphere/infra/util/spi/type/typed/TypedSPILoaderTest.java
index 1f809fbc558..040345ba377 100644
--- a/infra/util/src/test/java/org/apache/shardingsphere/infra/util/spi/type/typed/TypedSPILoaderTest.java
+++ b/infra/util/src/test/java/org/apache/shardingsphere/infra/util/spi/type/typed/TypedSPILoaderTest.java
@@ -41,11 +41,6 @@ public final class TypedSPILoaderTest {
         assertFalse(TypedSPILoader.contains(TypedSPIFixture.class, "NOT_EXISTED"));
     }
     
-    @Test
-    public void assertGetAllServices() {
-        assertThat(TypedSPILoader.getAllServices(TypedSPIFixture.class).size(), is(1));
-    }
-    
     @Test
     public void assertFindServiceWithoutProperties() {
         assertTrue(TypedSPILoader.findService(TypedSPIFixture.class, "TYPED.FIXTURE").isPresent());