Skip to content

Commit

Permalink
采用emptyList()
Browse files Browse the repository at this point in the history
  • Loading branch information
powerYao committed Aug 15, 2017
1 parent d61803b commit 5ad3c0e
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
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
Expand All @@ -23,22 +23,22 @@ public List<InstanceInfo> getConfigServiceInstances() {
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() {
Application application = eurekaClient.getApplication(ServiceNameConsts.APOLLO_METASERVICE);
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() {
Application application = eurekaClient.getApplication(ServiceNameConsts.APOLLO_ADMINSERVICE);
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();
}
}

0 comments on commit 5ad3c0e

Please sign in to comment.