Skip to content

Commit

Permalink
Merge pull request #395 from lowzj/consul-api
Browse files Browse the repository at this point in the history
polish ConsulEcwidClient
  • Loading branch information
rayzhang0603 authored Mar 22, 2017
2 parents 9f5dcf0 + 3e7e181 commit dc3532a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion motan-registry-consul/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<dependency>
<groupId>com.ecwid.consul</groupId>
<artifactId>consul-api</artifactId>
<version>1.1.4</version>
<version>1.2.1</version>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import com.weibo.api.motan.registry.consul.ConsulService;
import com.weibo.api.motan.registry.consul.ConsulUtils;
import com.weibo.api.motan.util.LoggerUtil;
import org.apache.commons.codec.binary.Base64;

import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -54,13 +53,13 @@ public ConsulResponse<List<ConsulService>> lookupHealthService(
if (orgResponse != null && orgResponse.getValue() != null
&& !orgResponse.getValue().isEmpty()) {
List<HealthService> HealthServices = orgResponse.getValue();
List<ConsulService> ConsulServcies = new ArrayList<ConsulService>(
List<ConsulService> ConsulServices = new ArrayList<ConsulService>(
HealthServices.size());

for (HealthService orgService : HealthServices) {
try {
ConsulService newService = convertToConsulService(orgService);
ConsulServcies.add(newService);
ConsulServices.add(newService);
} catch (Exception e) {
String servcieid = "null";
if (orgService.getService() != null) {
Expand All @@ -71,9 +70,9 @@ public ConsulResponse<List<ConsulService>> lookupHealthService(
+ servcieid, e);
}
}
if (!ConsulServcies.isEmpty()) {
if (!ConsulServices.isEmpty()) {
newResponse = new ConsulResponse<List<ConsulService>>();
newResponse.setValue(ConsulServcies);
newResponse.setValue(ConsulServices);
newResponse.setConsulIndex(orgResponse.getConsulIndex());
newResponse.setConsulLastContact(orgResponse
.getConsulLastContact());
Expand All @@ -93,7 +92,7 @@ public String lookupCommand(String group) {
if (value == null) {
LoggerUtil.info("no command in group: " + group);
} else if (value.getValue() != null) {
command = new String(Base64.decodeBase64(value.getValue()));
command = value.getDecodedValue();
}
return command;
}
Expand Down

0 comments on commit dc3532a

Please sign in to comment.