Fix #150
This commit is contained in:
parent
077c4cdb6f
commit
25f219623c
@ -670,6 +670,10 @@ public class DomainsManager {
|
|||||||
lock.unlock();
|
lock.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// clean up lock resources since they are no longer in need:
|
||||||
|
dom2LockMap.remove(dom.getName());
|
||||||
|
dom2ContionMap.remove(dom.getName());
|
||||||
|
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
Loggers.SRV_LOG.error("VIPSRV-DOM", "error while processing dom update", e);
|
Loggers.SRV_LOG.error("VIPSRV-DOM", "error while processing dom update", e);
|
||||||
}
|
}
|
||||||
|
@ -29,9 +29,7 @@ import org.apache.commons.lang3.StringUtils;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.*;
|
||||||
import java.util.concurrent.ScheduledThreadPoolExecutor;
|
|
||||||
import java.util.concurrent.ThreadFactory;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author nacos
|
* @author nacos
|
||||||
@ -117,6 +115,8 @@ public class UtilsAndCommons {
|
|||||||
|
|
||||||
public static final ScheduledExecutorService INIT_CONFIG_EXECUTOR;
|
public static final ScheduledExecutorService INIT_CONFIG_EXECUTOR;
|
||||||
|
|
||||||
|
public static final Executor RAFT_PUBLISH_EXECUTOR;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
// custom serializer and deserializer for fast-json
|
// custom serializer and deserializer for fast-json
|
||||||
SerializeConfig.getGlobalInstance()
|
SerializeConfig.getGlobalInstance()
|
||||||
@ -181,6 +181,17 @@ public class UtilsAndCommons {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
RAFT_PUBLISH_EXECUTOR
|
||||||
|
= Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors(), new ThreadFactory() {
|
||||||
|
@Override
|
||||||
|
public Thread newThread(Runnable r) {
|
||||||
|
Thread t = new Thread(r);
|
||||||
|
t.setName("nacos.naming.raft.publisher");
|
||||||
|
t.setDaemon(true);
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getAllExceptionMsg(Throwable e) {
|
public static String getAllExceptionMsg(Throwable e) {
|
||||||
|
@ -553,11 +553,20 @@ public class ApiCommands {
|
|||||||
|
|
||||||
if (virtualClusterDomain == null) {
|
if (virtualClusterDomain == null) {
|
||||||
|
|
||||||
regDom(request);
|
|
||||||
|
|
||||||
Lock lock = domainsManager.addLock(dom);
|
Lock lock = domainsManager.addLock(dom);
|
||||||
Condition condition = domainsManager.addCondtion(dom);
|
Condition condition = domainsManager.addCondtion(dom);
|
||||||
|
|
||||||
|
UtilsAndCommons.RAFT_PUBLISH_EXECUTOR.execute(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
try {
|
||||||
|
regDom(request);
|
||||||
|
} catch (Exception e) {
|
||||||
|
Loggers.SRV_LOG.error("REG-SERIVCE", "register service failed, service:" + dom, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
lock.lock();
|
lock.lock();
|
||||||
condition.await(5000, TimeUnit.MILLISECONDS);
|
condition.await(5000, TimeUnit.MILLISECONDS);
|
||||||
|
Loading…
Reference in New Issue
Block a user