From 852dca92107f8194004bfb672f1467d7347881b1 Mon Sep 17 00:00:00 2001 From: Ahoo Wang Date: Thu, 22 Jul 2021 00:09:35 +0800 Subject: [PATCH] optimize code --- .../src/main/java/me/ahoo/cosky/rest/security/user/User.java | 3 ++- .../spring/cloud/discovery/ribbon/CoskyServerList.java | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cosky-rest-api/src/main/java/me/ahoo/cosky/rest/security/user/User.java b/cosky-rest-api/src/main/java/me/ahoo/cosky/rest/security/user/User.java index 1c227dfa..c7589d23 100644 --- a/cosky-rest-api/src/main/java/me/ahoo/cosky/rest/security/user/User.java +++ b/cosky-rest-api/src/main/java/me/ahoo/cosky/rest/security/user/User.java @@ -22,7 +22,8 @@ * @author ahoo wang */ public class User { - public static String SUPER_USER = CoSky.COSKY; + + public final static String SUPER_USER = CoSky.COSKY; private String username; private Set roleBind; diff --git a/spring-cloud-starter-cosky-discovery-ribbon/src/main/java/me/ahoo/cosky/discovery/spring/cloud/discovery/ribbon/CoskyServerList.java b/spring-cloud-starter-cosky-discovery-ribbon/src/main/java/me/ahoo/cosky/discovery/spring/cloud/discovery/ribbon/CoskyServerList.java index b3666cdf..881943bc 100644 --- a/spring-cloud-starter-cosky-discovery-ribbon/src/main/java/me/ahoo/cosky/discovery/spring/cloud/discovery/ribbon/CoskyServerList.java +++ b/spring-cloud-starter-cosky-discovery-ribbon/src/main/java/me/ahoo/cosky/discovery/spring/cloud/discovery/ribbon/CoskyServerList.java @@ -49,7 +49,7 @@ private List getCoskyServers() { var getInstancesFuture = serviceDiscovery.getInstances(this.serviceId); var instances = Futures.getUnChecked(getInstancesFuture, Duration.ofSeconds(2)); if (instances.isEmpty()) { - Collections.emptyList(); + return Collections.emptyList(); } return instances.stream().map(CoskyServer::new).collect(Collectors.toList()); }