#502 Fix PMD
This commit is contained in:
parent
cc1f6647b0
commit
38e84cfb62
@ -173,7 +173,6 @@ public class RaftCore {
|
||||
parameters.put("key", key);
|
||||
|
||||
raftProxy.proxyPostLarge(getLeader().ip, API_PUB, params.toJSONString(), parameters);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -818,6 +817,7 @@ public class RaftCore {
|
||||
|
||||
if (listenerList == null) {
|
||||
listenerList = new CopyOnWriteArrayList<>();
|
||||
listeners.put(key, listenerList);
|
||||
}
|
||||
|
||||
Loggers.RAFT.info("add listener: {}", key);
|
||||
|
@ -42,7 +42,7 @@ public class RaftProxy {
|
||||
}
|
||||
}
|
||||
|
||||
public static void proxyPostLarge(String server, String api, String content, Map<String, String> headers) throws Exception {
|
||||
public void proxyPostLarge(String server, String api, String content, Map<String, String> headers) throws Exception {
|
||||
// do proxy
|
||||
if (!server.contains(UtilsAndCommons.CLUSTER_CONF_IP_SPLITER)) {
|
||||
server = server + UtilsAndCommons.CLUSTER_CONF_IP_SPLITER + RunningConfig.getServerPort();
|
||||
|
@ -174,7 +174,6 @@ public class ServiceManager implements DataListener {
|
||||
consistencyService.listen(UtilsAndCommons.getDomStoreKey(dom), dom);
|
||||
Loggers.SRV_LOG.info("[NEW-DOM-RAFT] {}", dom.toJSON());
|
||||
}
|
||||
|
||||
wakeUp(UtilsAndCommons.assembleFullServiceName(dom.getNamespaceId(), dom.getName()));
|
||||
|
||||
} catch (Throwable e) {
|
||||
@ -376,7 +375,6 @@ public class ServiceManager implements DataListener {
|
||||
public void registerInstance(String namespaceId, String serviceName, IpAddress instance) throws Exception {
|
||||
|
||||
VirtualClusterDomain service = getService(namespaceId, serviceName);
|
||||
|
||||
boolean serviceUpdated = false;
|
||||
if (service == null) {
|
||||
service = new VirtualClusterDomain();
|
||||
@ -411,9 +409,16 @@ public class ServiceManager implements DataListener {
|
||||
}
|
||||
|
||||
if (serviceUpdated) {
|
||||
Lock lock = addLockIfAbsent(UtilsAndCommons.assembleFullServiceName(namespaceId, serviceName));
|
||||
Condition condition = addCondtion(UtilsAndCommons.assembleFullServiceName(namespaceId, serviceName));
|
||||
addOrReplaceService(service);
|
||||
try {
|
||||
lock.lock();
|
||||
condition.await(5000, TimeUnit.MILLISECONDS);
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
addInstance(namespaceId, serviceName, instance);
|
||||
}
|
||||
|
||||
|
@ -105,21 +105,6 @@ public class HealthCheckTask implements Runnable {
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
// @JSONField(serialize = false)
|
||||
// public SwitchDomain getSwitchDomain() {
|
||||
// return SpringContext.getAppContext().getBean(SwitchDomain.class);
|
||||
// }
|
||||
//
|
||||
// @JSONField(serialize = false)
|
||||
// public DistroMapper getDistroMapper() {
|
||||
// return SpringContext.getAppContext().getBean(DistroMapper.class);
|
||||
// }
|
||||
//
|
||||
// @JSONField(serialize = false)
|
||||
// public HealthCheckProcessor getHealthCheckProcessor() {
|
||||
// return SpringContext.getAppContext().getBean(HealthCheckProcessorDelegate.class);
|
||||
// }
|
||||
|
||||
public Cluster getCluster() {
|
||||
return cluster;
|
||||
|
@ -55,7 +55,7 @@ public class RegisterInstance_ITCase {
|
||||
public void init() throws Exception {
|
||||
if (naming == null) {
|
||||
TimeUnit.SECONDS.sleep(10);
|
||||
naming = NamingFactory.createNamingService("127.0.0.1" + ":" + 8848);
|
||||
naming = NamingFactory.createNamingService("127.0.0.1" + ":" + port);
|
||||
}
|
||||
}
|
||||
|
||||
@ -92,16 +92,14 @@ public class RegisterInstance_ITCase {
|
||||
@Test
|
||||
public void regDomTest() throws Exception {
|
||||
String serviceName = randomDomainName();
|
||||
|
||||
naming.registerInstance(serviceName, TEST_IP_4_DOM_1, TEST_PORT);
|
||||
|
||||
System.out.println(serviceName);
|
||||
naming.registerInstance(serviceName, TEST_IP_4_DOM_1, TEST_PORT);
|
||||
|
||||
TimeUnit.SECONDS.sleep(3);
|
||||
|
||||
List<Instance> instances = naming.getAllInstances(serviceName);
|
||||
|
||||
Assert.assertEquals(instances.size(), 1);
|
||||
Assert.assertEquals(1, instances.size());
|
||||
Assert.assertTrue(instances.get(0).getInstanceId().contains(serviceName));
|
||||
//Assert.assertEquals(instances.get(0).getService().getName(), serviceName);
|
||||
Assert.assertEquals(instances.get(0).getIp(), TEST_IP_4_DOM_1);
|
||||
|
Loading…
Reference in New Issue
Block a user