diff --git a/apollo-configservice/src/main/java/com/ctrip/framework/apollo/metaservice/service/DiscoveryService.java b/apollo-configservice/src/main/java/com/ctrip/framework/apollo/metaservice/service/DiscoveryService.java index ac0545ff45d2559946d00dd804a4a73e53542395..49539fe16325dbf4043691a1136962f15c9e368c 100644 --- a/apollo-configservice/src/main/java/com/ctrip/framework/apollo/metaservice/service/DiscoveryService.java +++ b/apollo-configservice/src/main/java/com/ctrip/framework/apollo/metaservice/service/DiscoveryService.java @@ -9,7 +9,7 @@ import com.netflix.discovery.shared.Application; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.util.ArrayList; +import java.util.Collections; import java.util.List; @Service @@ -23,7 +23,7 @@ public class DiscoveryService { if (application == null) { Tracer.logEvent("Apollo.EurekaDiscovery.NotFound", ServiceNameConsts.APOLLO_CONFIGSERVICE); } - return application != null ? application.getInstances() : new ArrayList<>(); + return application != null ? application.getInstances() : Collections.emptyList(); } public List getMetaServiceInstances() { @@ -31,7 +31,7 @@ public class DiscoveryService { if (application == null) { Tracer.logEvent("Apollo.EurekaDiscovery.NotFound", ServiceNameConsts.APOLLO_METASERVICE); } - return application != null ? application.getInstances() : new ArrayList<>(); + return application != null ? application.getInstances() : Collections.emptyList(); } public List getAdminServiceInstances() { @@ -39,6 +39,6 @@ public class DiscoveryService { if (application == null) { Tracer.logEvent("Apollo.EurekaDiscovery.NotFound", ServiceNameConsts.APOLLO_ADMINSERVICE); } - return application != null ? application.getInstances() : new ArrayList<>(); + return application != null ? application.getInstances() : Collections.emptyList(); } }