提交 5ad3c0e0 编写于 作者: P powerYao

采用emptyList()

上级 d61803b4
......@@ -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<InstanceInfo> 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<InstanceInfo> 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();
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册