summaryrefslogtreecommitdiffstats
path: root/msb-core/apiroute/apiroute-service
diff options
context:
space:
mode:
authorJian Huang <huang.jian12@zte.com.cn>2016-09-27 02:21:15 +0000
committerGerrit Code Review <gerrit@open-o.org>2016-09-27 02:21:15 +0000
commit7ad9ea1bab02270ed5bcc10e36d6f1e391752bf6 (patch)
tree2eaf03f35202ee94159c88f284cbc61e42f96b5e /msb-core/apiroute/apiroute-service
parent53367202519152b1f7991d1ab97d0568cb874a31 (diff)
parented32196391ae54cd58ecdf2e5e15ce89570b0dd1 (diff)
Merge "OCS-52 Translate Chinese annotation"
Diffstat (limited to 'msb-core/apiroute/apiroute-service')
-rw-r--r--msb-core/apiroute/apiroute-service/src/main/java/org/openo/msb/api/ApiRouteInfo.java2
-rw-r--r--msb-core/apiroute/apiroute-service/src/main/java/org/openo/msb/api/CustomRouteInfo.java2
-rw-r--r--msb-core/apiroute/apiroute-service/src/main/java/org/openo/msb/api/IuiRouteInfo.java2
-rw-r--r--msb-core/apiroute/apiroute-service/src/main/java/org/openo/msb/api/Service.java12
-rw-r--r--msb-core/apiroute/apiroute-service/src/main/java/org/openo/msb/wrapper/ApiRouteServiceWrapper.java131
-rw-r--r--msb-core/apiroute/apiroute-service/src/main/java/org/openo/msb/wrapper/CustomRouteServiceWrapper.java60
-rw-r--r--msb-core/apiroute/apiroute-service/src/main/java/org/openo/msb/wrapper/IuiRouteServiceWrapper.java61
-rw-r--r--msb-core/apiroute/apiroute-service/src/main/java/org/openo/msb/wrapper/MicroServiceWrapper.java1
-rw-r--r--msb-core/apiroute/apiroute-service/src/main/java/org/openo/msb/wrapper/util/JedisUtil.java2
9 files changed, 33 insertions, 240 deletions
diff --git a/msb-core/apiroute/apiroute-service/src/main/java/org/openo/msb/api/ApiRouteInfo.java b/msb-core/apiroute/apiroute-service/src/main/java/org/openo/msb/api/ApiRouteInfo.java
index 83e1a76..fcde8d7 100644
--- a/msb-core/apiroute/apiroute-service/src/main/java/org/openo/msb/api/ApiRouteInfo.java
+++ b/msb-core/apiroute/apiroute-service/src/main/java/org/openo/msb/api/ApiRouteInfo.java
@@ -50,7 +50,7 @@ public class ApiRouteInfo implements Serializable{
private String visualRange = "1";
@ApiModelProperty(value = "[LB Policy]non_ip_hash:0,ip_hash:1", allowableValues = "0,1", example = "0")
- private String useOwnUpstream="0"; //负载均衡策略
+ private String useOwnUpstream="0";
@ApiModelProperty(required = true)
private RouteServer servers[];
diff --git a/msb-core/apiroute/apiroute-service/src/main/java/org/openo/msb/api/CustomRouteInfo.java b/msb-core/apiroute/apiroute-service/src/main/java/org/openo/msb/api/CustomRouteInfo.java
index 05145e2..0d84857 100644
--- a/msb-core/apiroute/apiroute-service/src/main/java/org/openo/msb/api/CustomRouteInfo.java
+++ b/msb-core/apiroute/apiroute-service/src/main/java/org/openo/msb/api/CustomRouteInfo.java
@@ -38,7 +38,7 @@ public class CustomRouteInfo implements Serializable{
private String visualRange = "1";
@ApiModelProperty(value = "[LB Policy]non_ip_hash:0,ip_hash:1", allowableValues = "0,1", example = "0")
- private String useOwnUpstream="0"; //负载均衡策略
+ private String useOwnUpstream="0";
@ApiModelProperty(required = true)
private RouteServer servers[];
diff --git a/msb-core/apiroute/apiroute-service/src/main/java/org/openo/msb/api/IuiRouteInfo.java b/msb-core/apiroute/apiroute-service/src/main/java/org/openo/msb/api/IuiRouteInfo.java
index 043bc02..64676d3 100644
--- a/msb-core/apiroute/apiroute-service/src/main/java/org/openo/msb/api/IuiRouteInfo.java
+++ b/msb-core/apiroute/apiroute-service/src/main/java/org/openo/msb/api/IuiRouteInfo.java
@@ -38,7 +38,7 @@ public class IuiRouteInfo implements Serializable{
private String visualRange = "1";
@ApiModelProperty(value = "[LB Policy]non_ip_hash:0,ip_hash:1", allowableValues = "0,1", example = "0")
- private String useOwnUpstream="0"; //负载均衡策略
+ private String useOwnUpstream="0";
@ApiModelProperty(required = true)
private RouteServer servers[];
diff --git a/msb-core/apiroute/apiroute-service/src/main/java/org/openo/msb/api/Service.java b/msb-core/apiroute/apiroute-service/src/main/java/org/openo/msb/api/Service.java
index 6db6a11..6e19a71 100644
--- a/msb-core/apiroute/apiroute-service/src/main/java/org/openo/msb/api/Service.java
+++ b/msb-core/apiroute/apiroute-service/src/main/java/org/openo/msb/api/Service.java
@@ -25,24 +25,24 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@JsonIgnoreProperties(ignoreUnknown = true)
public class Service<T> implements Serializable {
private static final long serialVersionUID = 1L;
- // 服务名
+
@ApiModelProperty(required = true)
private String serviceName;
- // 版本号
+
@ApiModelProperty(example = "v1")
private String version="";
- // 服务url
+
@ApiModelProperty(value = "Target Service URL,start with /",example = "/api/serviceName/v1", required = true)
private String url="";
- // 服务对应协议,比如REST、UI、MQ、FTP、SNMP、TCP、UDP
+
@ApiModelProperty(value = "Service Protocol", allowableValues = "REST,UI, MQ, FTP,SNMP,TCP,UDP", example = "REST",required = true)
private String protocol = "";
- //服务的可见范围 系统间:0 系统内:1
+
@ApiModelProperty(value = "[visual Range]interSystem:0,inSystem:1", allowableValues = "0,1", example = "1")
private String visualRange = "1";
- //负载均衡策略类型
+
@ApiModelProperty(value = "lb policy", allowableValues = "round-robin,hash,least_conn", example = "hash")
private String lb_policy="";
diff --git a/msb-core/apiroute/apiroute-service/src/main/java/org/openo/msb/wrapper/ApiRouteServiceWrapper.java b/msb-core/apiroute/apiroute-service/src/main/java/org/openo/msb/wrapper/ApiRouteServiceWrapper.java
index e0ecd01..6bd104b 100644
--- a/msb-core/apiroute/apiroute-service/src/main/java/org/openo/msb/wrapper/ApiRouteServiceWrapper.java
+++ b/msb-core/apiroute/apiroute-service/src/main/java/org/openo/msb/wrapper/ApiRouteServiceWrapper.java
@@ -39,14 +39,6 @@ import org.slf4j.LoggerFactory;
import redis.clients.jedis.Jedis;
-
-/**
- * @ClassName: ApiRouteServiceWrapper
- * @Description: TODO(ApiRoute服务类)
- * @author tanghua10186366
- * @date 2015年9月25日 上午9:44:04
- *
- */
public class ApiRouteServiceWrapper {
private static final Logger LOGGER = LoggerFactory.getLogger(ApiRouteServiceWrapper.class);
@@ -60,12 +52,7 @@ public class ApiRouteServiceWrapper {
return instance;
}
- /**
- * @Title: getAllApiRouteInstances
- * @Description: TODO(获取全部服务列表)
- * @param: @return
- * @return: ApiRouteInfoBean[]
- */
+
public ApiRouteInfo[] getAllApiRouteInstances() {
@@ -78,7 +65,7 @@ public class ApiRouteServiceWrapper {
"fetch from jedis pool failed,null object!");
}
- // 获取全部服务列表
+
String routekey =
RouteUtil
.getPrefixedKey("", RouteUtil.APIROUTE, "*", RouteUtil.ROUTE_PATH_INFO);
@@ -126,14 +113,7 @@ public class ApiRouteServiceWrapper {
return false;
}
- /**
- * @Title: getApiRouteInstance
- * @Description: TODO(通过服务名+版本号获取单个服务对象信息)
- * @param: @param serviceName
- * @param: @param version
- * @param: @return
- * @return: ApiRouteInfo
- */
+
public ApiRouteInfo getApiRouteInstance(String serviceName, String version) {
if (StringUtils.isBlank(serviceName)) {
@@ -191,7 +171,7 @@ public class ApiRouteServiceWrapper {
ApiRouteInfo apiRouteInfo = null;
- // 获取info信息
+
String routekey =
RouteUtil.getPrefixedKey("", RouteUtil.APIROUTE, serviceName, version,
RouteUtil.ROUTE_PATH_INFO);
@@ -210,7 +190,7 @@ public class ApiRouteServiceWrapper {
apiRouteInfo.setUseOwnUpstream(infomap.get("useOwnUpstream"));
- // 获取负载均衡信息
+
String serviceLBkey =
RouteUtil.getPrefixedKey("", RouteUtil.APIROUTE, serviceName, version,
RouteUtil.ROUTE_PATH_LOADBALANCE);
@@ -230,34 +210,14 @@ public class ApiRouteServiceWrapper {
apiRouteInfo.setServers(apiRouteServerList);
- // 获取生命周期信息
-
-// ApiRouteLifeCycle lifeCycle = new ApiRouteLifeCycle();
-// String serviceLifekey =
-// RouteUtil.getPrefixedKey("", RouteUtil.APIROUTE, serviceName, version,
-// RouteUtil.APIROUTE_PATH_LIFE);
-// Map<String, String> serviceLifeMap = jedis.hgetAll(serviceLifekey);
-//
-// lifeCycle.setInstallPath(serviceLifeMap.get("path"));
-// lifeCycle.setStartScript(serviceLifeMap.get("start"));
-// lifeCycle.setStopScript(serviceLifeMap.get("stop"));
-//
-// apiRouteInfo.setLifeCycle(lifeCycle);
+
}
return apiRouteInfo;
}
- /**
- * @Title: updateApiRouteInstance
- * @Description: TODO(更新单个服务信息)
- * @param: @param serviceName
- * @param: @param version
- * @param: @param apiRouteInfo
- * @param: @return
- * @return: ApiRouteInfo
- */
+
public synchronized ApiRouteInfo updateApiRouteInstance(String serviceName, String version,
ApiRouteInfo apiRouteInfo, String serverPort) {
@@ -284,12 +244,12 @@ public class ApiRouteServiceWrapper {
if (serviceName.equals(apiRouteInfo.getServiceName())
&& version.equals(apiRouteInfo.getVersion())) {
- // 删除已存在负载均衡服务器信息
+
deleteApiRoute(serviceName, version, RouteUtil.ROUTE_PATH_LOADBALANCE + "*",
serverPort);
} else {
- // 如果已修改服务名或者版本号,先删除此服务全部已有信息
+
deleteApiRoute(serviceName, version, "*", serverPort);
}
@@ -310,15 +270,7 @@ public class ApiRouteServiceWrapper {
}
- /**
- * @Title updateApiRouteStatus
- * @Description TODO(更新单个服务状态)
- * @param serviceName
- * @param version
- * @param status
- * @return
- * @return RouteResult
- */
+
public synchronized ApiRouteInfo updateApiRouteStatus(String serviceName, String version,
String status) {
@@ -346,7 +298,7 @@ public class ApiRouteServiceWrapper {
ApiRouteInfo new_apiRouteInfo = getApiRouteInstance(serviceName, version);
- // 准备info信息
+
String serviceInfokey =
RouteUtil.getPrefixedKey("", RouteUtil.APIROUTE, serviceName, version,
RouteUtil.ROUTE_PATH_INFO);
@@ -360,7 +312,7 @@ public class ApiRouteServiceWrapper {
if (jedis == null) {
throw new Exception("fetch from jedis pool failed,null object!");
}
- // 保存info信息
+
jedis.hmset(serviceInfokey, serviceInfoMap);
new_apiRouteInfo.setStatus(status);
@@ -378,13 +330,7 @@ public class ApiRouteServiceWrapper {
}
- /**
- * @Title: saveApiRouteInstance
- * @Description: TODO(存储单个服务信息)
- * @param: @param apiRouteInfo
- * @param: @return
- * @return: ApiRouteInfo
- */
+
public synchronized ApiRouteInfo saveApiRouteInstance(ApiRouteInfo apiRouteInfo,
String serverPort) {
@@ -435,7 +381,7 @@ public class ApiRouteServiceWrapper {
+ RouteUtil.show(RouteUtil.useOwnUpstreamRangeMatches) + ")");
}
- // 检查服务实例格式
+
RouteServer[] serverList = apiRouteInfo.getServers();
for (int i = 0; i < serverList.length; i++) {
RouteServer server = serverList[i];
@@ -450,7 +396,7 @@ public class ApiRouteServiceWrapper {
}
}
- // 准备info信息
+
String serviceInfokey =
RouteUtil.getPrefixedKey(serverPort, RouteUtil.APIROUTE,
apiRouteInfo.getServiceName().trim(), apiRouteInfo.getVersion().trim(),
@@ -466,7 +412,7 @@ public class ApiRouteServiceWrapper {
serviceInfoMap.put("visualRange", apiRouteInfo.getVisualRange());
serviceInfoMap.put("useOwnUpstream", apiRouteInfo.getUseOwnUpstream());
- // 准备负载均衡信息
+
String serviceLBkey =
RouteUtil.getPrefixedKey(serverPort, RouteUtil.APIROUTE,
apiRouteInfo.getServiceName(), apiRouteInfo.getVersion(),
@@ -480,10 +426,9 @@ public class ApiRouteServiceWrapper {
throw new ExtendedInternalServerErrorException(
"fetch from jedis pool failed,null object!");
}
- // 保存info信息
jedis.hmset(serviceInfokey, serviceInfoMap);
- // 保存负载均衡信息
+
for (int i = 0; i < serverList.length; i++) {
Map<String, String> servermap = new HashMap<String, String>();
RouteServer server = serverList[i];
@@ -494,22 +439,7 @@ public class ApiRouteServiceWrapper {
jedis.hmset(serviceLBkey + ":server" + (i + 1), servermap);
}
- // 保存生命周期信息
-
-// ApiRouteLifeCycle lifeCycle = apiRouteInfo.getLifeCycle();
-// if (lifeCycle != null) {
-// String serviceLifekey =
-// RouteUtil.getPrefixedKey(serverPort, RouteUtil.APIROUTE,
-// apiRouteInfo.getServiceName(), apiRouteInfo.getVersion(),
-// RouteUtil.APIROUTE_PATH_LIFE);
-// Map<String, String> serviceLifeMap = new HashMap<String, String>();
-// serviceLifeMap.put("path", lifeCycle.getInstallPath());
-// serviceLifeMap.put("start", lifeCycle.getStartScript());
-// serviceLifeMap.put("stop", lifeCycle.getStopScript());
-// jedis.hmset(serviceLifekey, serviceLifeMap);
-// }
-
-
+
} catch (Exception e) {
LOGGER.error("call redis throw exception", e);
@@ -525,16 +455,7 @@ public class ApiRouteServiceWrapper {
- /**
- * @Title: deleteApiRoute
- * @Description: TODO(删除单个服务信息)
- * @param: @param type
- * @param: @param serviceName
- * @param: @param version
- * @param: @param delKey
- * @param: @return
- * @return: void
- */
+
public synchronized void deleteApiRoute(String serviceName, String version, String delKey,
String serverPort) {
@@ -562,7 +483,7 @@ public class ApiRouteServiceWrapper {
"fetch from jedis pool failed,null object!");
}
- // 获取info信息
+
String routekey =
RouteUtil.getPrefixedKey(serverPort, RouteUtil.APIROUTE, serviceName, version,
delKey);
@@ -575,7 +496,7 @@ public class ApiRouteServiceWrapper {
String[] paths = new String[infoSet.size()];
- // Set-->数组
+
infoSet.toArray(paths);
jedis.del(paths);
@@ -594,12 +515,7 @@ public class ApiRouteServiceWrapper {
}
- /**
- * @Title: getAllApiDocs
- * @Description: TODO(获取本地ext\initSwaggerJson目录的全部json文件目录)
- * @param: @return
- * @return: String[]
- */
+
public String[] getAllApiDocs() {
URL apiDocsPath = ApiRouteServiceWrapper.class.getResource("/ext/initSwaggerJson");
if (apiDocsPath != null) {
@@ -625,9 +541,6 @@ public class ApiRouteServiceWrapper {
return null;
}
- /**
- * 读取某个文件夹下的所有文件
- */
public String[] readfile(String filepath) throws FileNotFoundException, IOException {
File file = new File(filepath);
if (file.isDirectory()) {
diff --git a/msb-core/apiroute/apiroute-service/src/main/java/org/openo/msb/wrapper/CustomRouteServiceWrapper.java b/msb-core/apiroute/apiroute-service/src/main/java/org/openo/msb/wrapper/CustomRouteServiceWrapper.java
index 52e30c0..d0d4250 100644
--- a/msb-core/apiroute/apiroute-service/src/main/java/org/openo/msb/wrapper/CustomRouteServiceWrapper.java
+++ b/msb-core/apiroute/apiroute-service/src/main/java/org/openo/msb/wrapper/CustomRouteServiceWrapper.java
@@ -47,12 +47,7 @@ public class CustomRouteServiceWrapper {
}
- /**
- * @Title: getAllCustomRouteService
- * @Description: TODO(获取全部内容服务列表)
- * @param: @return
- * @return: CustomRouteInfo[]
- */
+
public CustomRouteInfo[] getAllCustomRouteInstances() {
@@ -65,7 +60,6 @@ public class CustomRouteServiceWrapper {
"fetch from jedis pool failed,null object!");
}
- // 获取全部服务列表
String routekey =
RouteUtil.getPrefixedKey("", RouteUtil.CUSTOMROUTE, "*",
RouteUtil.ROUTE_PATH_INFO);
@@ -95,13 +89,6 @@ public class CustomRouteServiceWrapper {
- /**
- * @Title: getCustomRouteInstance
- * @Description: TODO(通过服务名获取单个内容服务对象信息)
- * @param: @param serviceName
- * @param: @return
- * @return: CustomRouteInfo
- */
public CustomRouteInfo getCustomRouteInstance(String serviceName) {
if (StringUtils.isBlank(serviceName)) {
@@ -146,7 +133,6 @@ public class CustomRouteServiceWrapper {
CustomRouteInfo customRouteInfo = null;
- // 获取info信息
String routekey =
RouteUtil.getPrefixedKey("", RouteUtil.CUSTOMROUTE, serviceName,
RouteUtil.ROUTE_PATH_INFO);
@@ -161,7 +147,6 @@ public class CustomRouteServiceWrapper {
customRouteInfo.setUseOwnUpstream(infomap.get("useOwnUpstream"));
- // 获取负载均衡信息
String serviceLBkey =
RouteUtil.getPrefixedKey("", RouteUtil.CUSTOMROUTE, serviceName,
RouteUtil.ROUTE_PATH_LOADBALANCE);
@@ -186,14 +171,6 @@ public class CustomRouteServiceWrapper {
return customRouteInfo;
}
- /**
- * @Title: updateCustomRouteInstance
- * @Description: TODO(更新单个服务信息)
- * @param: @param serviceName
- * @param: @param CustomRouteInfo
- * @param: @return
- * @return: CustomRouteInfo
- */
public synchronized CustomRouteInfo updateCustomRouteInstance(String serviceName,
CustomRouteInfo customRouteInfo, String serverPort) {
if (StringUtils.isBlank(serviceName)) {
@@ -203,10 +180,8 @@ public class CustomRouteServiceWrapper {
try {
if (serviceName.equals(customRouteInfo.getServiceName())) {
- // 删除已存在负载均衡服务器信息
deleteCustomRoute(serviceName, RouteUtil.ROUTE_PATH_LOADBALANCE + "*", serverPort);
} else {
- // 如果已修改服务名,先删除此服务全部已有信息
deleteCustomRoute(serviceName, "*", serverPort);
}
@@ -228,14 +203,6 @@ public class CustomRouteServiceWrapper {
}
- /**
- * @Title updateCustomRouteStatus
- * @Description TODO(更新单个服务状态)
- * @param serviceName
- * @param status
- * @return
- * @return RouteResult
- */
public synchronized CustomRouteInfo updateCustomRouteStatus(String serviceName, String status) {
if (StringUtils.isBlank(serviceName)) {
@@ -252,7 +219,6 @@ public class CustomRouteServiceWrapper {
- // 准备info信息
String serviceInfokey =
RouteUtil.getPrefixedKey("", RouteUtil.CUSTOMROUTE, serviceName,
RouteUtil.ROUTE_PATH_INFO);
@@ -267,7 +233,6 @@ public class CustomRouteServiceWrapper {
throw new ExtendedInternalServerErrorException(
"fetch from jedis pool failed,null object!");
}
- // 保存info信息
jedis.hmset(serviceInfokey, serviceInfoMap);
new_customRouteInfo.setStatus(status);
@@ -284,13 +249,6 @@ public class CustomRouteServiceWrapper {
return new_customRouteInfo;
}
- /**
- * @Title: saveCustomRouteInstance
- * @Description: TODO(存储单个服务信息)
- * @param: @param CustomRouteInfo
- * @param: @return
- * @return: CustomRouteInfo
- */
public synchronized CustomRouteInfo saveCustomRouteInstance(CustomRouteInfo customRouteInfo,
String serverPort) {
@@ -339,7 +297,6 @@ public class CustomRouteServiceWrapper {
+ RouteUtil.show(RouteUtil.useOwnUpstreamRangeMatches) + ")");
}
- // 检查服务实例格式
RouteServer[] serverList = customRouteInfo.getServers();
for (int i = 0; i < serverList.length; i++) {
RouteServer server = serverList[i];
@@ -355,7 +312,6 @@ public class CustomRouteServiceWrapper {
}
- // 准备info信息
String serviceInfokey =
RouteUtil.getPrefixedKey(serverPort, RouteUtil.CUSTOMROUTE,
customRouteInfo.getServiceName().trim(), RouteUtil.ROUTE_PATH_INFO);
@@ -370,7 +326,6 @@ public class CustomRouteServiceWrapper {
- // 准备负载均衡信息
String serviceLBkey =
RouteUtil.getPrefixedKey(serverPort, RouteUtil.CUSTOMROUTE,
customRouteInfo.getServiceName(), RouteUtil.ROUTE_PATH_LOADBALANCE);
@@ -383,10 +338,8 @@ public class CustomRouteServiceWrapper {
throw new ExtendedInternalServerErrorException(
"fetch from jedis pool failed,null object!");
}
- // 保存info信息
jedis.hmset(serviceInfokey, serviceInfoMap);
- // 保存负载均衡信息
for (int i = 0; i < serverList.length; i++) {
Map<String, String> servermap = new HashMap<String, String>();
@@ -414,15 +367,6 @@ public class CustomRouteServiceWrapper {
- /**
- * @Title: deleteCustomRoute
- * @Description: TODO(删除单个服务信息)
- * @param: @param type
- * @param: @param serviceName
- * @param: @param delKey
- * @param: @return
- * @return: void
- */
public synchronized void deleteCustomRoute(String serviceName, String delKey, String serverPort) {
if (StringUtils.isBlank(serviceName)) {
@@ -438,7 +382,6 @@ public class CustomRouteServiceWrapper {
"fetch from jedis pool failed,null object!");
}
- // 获取info信息
String routekey =
RouteUtil
.getPrefixedKey(serverPort, RouteUtil.CUSTOMROUTE, serviceName, delKey);
@@ -452,7 +395,6 @@ public class CustomRouteServiceWrapper {
String[] paths = new String[infoSet.size()];
- // Set-->数组
infoSet.toArray(paths);
jedis.del(paths);
diff --git a/msb-core/apiroute/apiroute-service/src/main/java/org/openo/msb/wrapper/IuiRouteServiceWrapper.java b/msb-core/apiroute/apiroute-service/src/main/java/org/openo/msb/wrapper/IuiRouteServiceWrapper.java
index 1e34878..f70a126 100644
--- a/msb-core/apiroute/apiroute-service/src/main/java/org/openo/msb/wrapper/IuiRouteServiceWrapper.java
+++ b/msb-core/apiroute/apiroute-service/src/main/java/org/openo/msb/wrapper/IuiRouteServiceWrapper.java
@@ -46,13 +46,6 @@ public class IuiRouteServiceWrapper {
return instance;
}
-
- /**
- * @Title: getAllIuiRouteService
- * @Description: TODO(获取全部内容服务列表)
- * @param: @return
- * @return: IuiRouteInfo[]
- */
public IuiRouteInfo[] getAllIuiRouteInstances() {
@@ -65,7 +58,6 @@ public class IuiRouteServiceWrapper {
"fetch from jedis pool failed,null object!");
}
- // 获取全部服务列表
String routekey =
RouteUtil
.getPrefixedKey("", RouteUtil.IUIROUTE, "*", RouteUtil.ROUTE_PATH_INFO);
@@ -93,14 +85,6 @@ public class IuiRouteServiceWrapper {
}
-
- /**
- * @Title: getIuiRouteInstance
- * @Description: TODO(通过服务名获取单个内容服务对象信息)
- * @param: @param serviceName
- * @param: @return
- * @return: IuiRouteInfo
- */
public IuiRouteInfo getIuiRouteInstance(String serviceName) {
if (StringUtils.isBlank(serviceName)) {
@@ -145,7 +129,6 @@ public class IuiRouteServiceWrapper {
IuiRouteInfo iuiRouteInfo = null;
- // 获取info信息
String routekey =
RouteUtil.getPrefixedKey("", RouteUtil.IUIROUTE, serviceName,
RouteUtil.ROUTE_PATH_INFO);
@@ -160,7 +143,6 @@ public class IuiRouteServiceWrapper {
iuiRouteInfo.setUseOwnUpstream(infomap.get("useOwnUpstream"));
- // 获取负载均衡信息
String serviceLBkey =
RouteUtil.getPrefixedKey("", RouteUtil.IUIROUTE, serviceName,
RouteUtil.ROUTE_PATH_LOADBALANCE);
@@ -185,14 +167,6 @@ public class IuiRouteServiceWrapper {
return iuiRouteInfo;
}
- /**
- * @Title: updateIuiRouteInstance
- * @Description: TODO(更新单个服务信息)
- * @param: @param serviceName
- * @param: @param IuiRouteInfo
- * @param: @return
- * @return: IuiRouteInfo
- */
public synchronized IuiRouteInfo updateIuiRouteInstance(String serviceName,
IuiRouteInfo iuiRouteInfo) {
@@ -202,11 +176,9 @@ public class IuiRouteServiceWrapper {
try {
if (serviceName.equals(iuiRouteInfo.getServiceName())) {
- // 删除已存在负载均衡服务器信息
deleteIuiRoute(serviceName, RouteUtil.ROUTE_PATH_LOADBALANCE + "*");
} else {
- // 如果已修改服务名,先删除此服务全部已有信息
deleteIuiRoute(serviceName, "*");
}
saveIuiRouteInstance(iuiRouteInfo);
@@ -223,14 +195,6 @@ public class IuiRouteServiceWrapper {
}
- /**
- * @Title updateIuiRouteStatus
- * @Description TODO(更新单个服务状态)
- * @param serviceName
- * @param status
- * @return
- * @return RouteResult
- */
public synchronized IuiRouteInfo updateIuiRouteStatus(String serviceName, String status) {
@@ -246,7 +210,6 @@ public class IuiRouteServiceWrapper {
IuiRouteInfo new_iuiRouteInfo = getIuiRouteInstance(serviceName);
- // 准备info信息
String serviceInfokey =
RouteUtil.getPrefixedKey("", RouteUtil.IUIROUTE, serviceName,
RouteUtil.ROUTE_PATH_INFO);
@@ -261,7 +224,6 @@ public class IuiRouteServiceWrapper {
throw new ExtendedInternalServerErrorException(
"fetch from jedis pool failed,null object!");
}
- // 保存info信息
jedis.hmset(serviceInfokey, serviceInfoMap);
new_iuiRouteInfo.setStatus(status);
@@ -277,13 +239,6 @@ public class IuiRouteServiceWrapper {
return new_iuiRouteInfo;
}
- /**
- * @Title: saveIuiRouteInstance
- * @Description: TODO(存储单个服务信息)
- * @param: @param IuiRouteInfo
- * @param: @return
- * @return: IuiRouteInfo
- */
public synchronized IuiRouteInfo saveIuiRouteInstance(IuiRouteInfo iuiRouteInfo) {
if (StringUtils.isBlank(iuiRouteInfo.getServiceName())
@@ -324,7 +279,6 @@ public class IuiRouteServiceWrapper {
+ RouteUtil.show(RouteUtil.useOwnUpstreamRangeMatches) + ")");
}
- // 检查服务实例格式
RouteServer[] serverList = iuiRouteInfo.getServers();
for (int i = 0; i < serverList.length; i++) {
RouteServer server = serverList[i];
@@ -340,7 +294,6 @@ public class IuiRouteServiceWrapper {
}
- // 准备info信息
String serviceInfokey =
RouteUtil.getPrefixedKey("", RouteUtil.IUIROUTE, iuiRouteInfo.getServiceName().trim(),
RouteUtil.ROUTE_PATH_INFO);
@@ -353,7 +306,6 @@ public class IuiRouteServiceWrapper {
serviceInfoMap.put("useOwnUpstream", iuiRouteInfo.getUseOwnUpstream());
- // 准备负载均衡信息
String serviceLBkey =
RouteUtil.getPrefixedKey("", RouteUtil.IUIROUTE, iuiRouteInfo.getServiceName(),
RouteUtil.ROUTE_PATH_LOADBALANCE);
@@ -366,10 +318,8 @@ public class IuiRouteServiceWrapper {
throw new ExtendedInternalServerErrorException(
"fetch from jedis pool failed,null object!");
}
- // 保存info信息
jedis.hmset(serviceInfokey, serviceInfoMap);
- // 保存负载均衡信息
for (int i = 0; i < serverList.length; i++) {
Map<String, String> servermap = new HashMap<String, String>();
RouteServer server = serverList[i];
@@ -395,15 +345,6 @@ public class IuiRouteServiceWrapper {
- /**
- * @Title: deleteIuiRoute
- * @Description: TODO(删除单个服务信息)
- * @param: @param type
- * @param: @param serviceName
- * @param: @param delKey
- * @param: @return
- * @return: void
- */
public synchronized void deleteIuiRoute(String serviceName, String delKey) {
if (StringUtils.isBlank(serviceName)) {
@@ -418,7 +359,6 @@ public class IuiRouteServiceWrapper {
"fetch from jedis pool failed,null object!");
}
- // 获取info信息
String routekey = RouteUtil.getPrefixedKey("", RouteUtil.IUIROUTE, serviceName, delKey);
Set<String> infoSet = jedis.keys(routekey);
@@ -429,7 +369,6 @@ public class IuiRouteServiceWrapper {
String[] paths = new String[infoSet.size()];
- // Set-->数组
infoSet.toArray(paths);
jedis.del(paths);
diff --git a/msb-core/apiroute/apiroute-service/src/main/java/org/openo/msb/wrapper/MicroServiceWrapper.java b/msb-core/apiroute/apiroute-service/src/main/java/org/openo/msb/wrapper/MicroServiceWrapper.java
index bc803f4..2611605 100644
--- a/msb-core/apiroute/apiroute-service/src/main/java/org/openo/msb/wrapper/MicroServiceWrapper.java
+++ b/msb-core/apiroute/apiroute-service/src/main/java/org/openo/msb/wrapper/MicroServiceWrapper.java
@@ -256,7 +256,6 @@ public class MicroServiceWrapper {
public synchronized MicroServiceFullInfo saveMicroServiceInstance(
MicroServiceInfo microServiceInfo, boolean createOrUpdate,String requestIP,String serverPort) {
- // 保存数据格式判断
if (StringUtils.isBlank(microServiceInfo.getServiceName())
|| StringUtils.isBlank(microServiceInfo.getProtocol())
diff --git a/msb-core/apiroute/apiroute-service/src/main/java/org/openo/msb/wrapper/util/JedisUtil.java b/msb-core/apiroute/apiroute-service/src/main/java/org/openo/msb/wrapper/util/JedisUtil.java
index b675ab1..46d071e 100644
--- a/msb-core/apiroute/apiroute-service/src/main/java/org/openo/msb/wrapper/util/JedisUtil.java
+++ b/msb-core/apiroute/apiroute-service/src/main/java/org/openo/msb/wrapper/util/JedisUtil.java
@@ -80,7 +80,7 @@ public static void main(String[] args) {
}
- // 设置连接池基本信息
+
String strHost = bundle.getString("redis.host");
if(StringUtils.isNotEmpty(strHost)){
host = strHost;