#757 domain to service
This commit is contained in:
parent
d340f4bfa8
commit
e24e836dab
@ -272,8 +272,8 @@ public class ServiceController {
|
||||
return result;
|
||||
}
|
||||
|
||||
@RequestMapping("/searchDom")
|
||||
public JSONObject searchDom(HttpServletRequest request) {
|
||||
@RequestMapping("/names")
|
||||
public JSONObject searchService(HttpServletRequest request) {
|
||||
|
||||
JSONObject result = new JSONObject();
|
||||
String namespaceId = WebUtils.optional(request, CommonParams.NAMESPACE_ID,
|
||||
@ -301,7 +301,7 @@ public class ServiceController {
|
||||
@RequestMapping("/serviceStatus")
|
||||
public String serviceStatus(HttpServletRequest request) {
|
||||
//format: dom1@@checksum@@@dom2@@checksum
|
||||
String domsStatusString = WebUtils.required(request, "domsStatus");
|
||||
String statuses = WebUtils.required(request, "statuses");
|
||||
String serverIP = WebUtils.optional(request, "clientIP", "");
|
||||
|
||||
if (!serverListManager.contains(serverIP)) {
|
||||
@ -309,7 +309,7 @@ public class ServiceController {
|
||||
}
|
||||
|
||||
try {
|
||||
ServiceManager.ServiceChecksum checksums = JSON.parseObject(domsStatusString, ServiceManager.ServiceChecksum.class);
|
||||
ServiceManager.ServiceChecksum checksums = JSON.parseObject(statuses, ServiceManager.ServiceChecksum.class);
|
||||
if (checksums == null) {
|
||||
Loggers.SRV_LOG.warn("[DOMAIN-STATUS] receive malformed data: null");
|
||||
return "fail";
|
||||
@ -338,7 +338,7 @@ public class ServiceController {
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Loggers.SRV_LOG.warn("[DOMAIN-STATUS] receive malformed data: " + domsStatusString, e);
|
||||
Loggers.SRV_LOG.warn("[DOMAIN-STATUS] receive malformed data: " + statuses, e);
|
||||
}
|
||||
|
||||
return "ok";
|
||||
|
@ -59,7 +59,7 @@ public class ServiceManager implements DataListener<Service> {
|
||||
|
||||
private LinkedBlockingDeque<ServiceKey> toBeUpdatedServicesQueue = new LinkedBlockingDeque<>(1024 * 1024);
|
||||
|
||||
private Synchronizer synchronizer = new DomainStatusSynchronizer();
|
||||
private Synchronizer synchronizer = new ServiceStatusSynchronizer();
|
||||
|
||||
private final Lock lock = new ReentrantLock();
|
||||
|
||||
|
@ -27,7 +27,7 @@ import java.util.Map;
|
||||
/**
|
||||
* @author nacos
|
||||
*/
|
||||
public class DomainStatusSynchronizer implements Synchronizer {
|
||||
public class ServiceStatusSynchronizer implements Synchronizer {
|
||||
@Override
|
||||
public void send(final String serverIP, Message msg) {
|
||||
if(serverIP == null) {
|
||||
@ -36,7 +36,7 @@ public class DomainStatusSynchronizer implements Synchronizer {
|
||||
|
||||
Map<String,String> params = new HashMap<String, String>(10);
|
||||
|
||||
params.put("domsStatus", msg.getData());
|
||||
params.put("statuses", msg.getData());
|
||||
params.put("clientIP", NetUtils.localServer());
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user