Skip to content

Commit

Permalink
alibaba#757 Remove DOM
Browse files Browse the repository at this point in the history
  • Loading branch information
nkorange committed Mar 15, 2019
1 parent 2762266 commit 7bf60c1
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 28 deletions.
10 changes: 5 additions & 5 deletions naming/src/main/java/com/alibaba/nacos/naming/core/Cluster.java
Original file line number Diff line number Diff line change
Expand Up @@ -276,31 +276,31 @@ public void update(Cluster cluster) {

if (!getHealthChecker().equals(cluster.getHealthChecker())) {
Loggers.SRV_LOG.info("[CLUSTER-UPDATE] {}:{}:, healthChecker: {} -> {}",
cluster.getService().getName(), cluster.getName(), getHealthChecker().toString(), cluster.getHealthChecker().toString());
getService().getName(), getName(), getHealthChecker().toString(), cluster.getHealthChecker().toString());
setHealthChecker(cluster.getHealthChecker());
}

if (defCkport != cluster.getDefCkport()) {
Loggers.SRV_LOG.info("[CLUSTER-UPDATE] {}:{}, defCkport: {} -> {}",
cluster.getService().getName(), cluster.getName(), defCkport, cluster.getDefCkport());
getService().getName(), getName(), defCkport, cluster.getDefCkport());
defCkport = cluster.getDefCkport();
}

if (defIPPort != cluster.getDefIPPort()) {
Loggers.SRV_LOG.info("[CLUSTER-UPDATE] {}:{}, defIPPort: {} -> {}",
cluster.getService().getName(), cluster.getName(), defIPPort, cluster.getDefIPPort());
getService().getName(), getName(), defIPPort, cluster.getDefIPPort());
defIPPort = cluster.getDefIPPort();
}

if (!StringUtils.equals(sitegroup, cluster.getSitegroup())) {
Loggers.SRV_LOG.info("[CLUSTER-UPDATE] {}:{}, sitegroup: {} -> {}",
cluster.getService().getName(), cluster.getName(), sitegroup, cluster.getSitegroup());
getService().getName(), getName(), sitegroup, cluster.getSitegroup());
sitegroup = cluster.getSitegroup();
}

if (isUseIPPort4Check() != cluster.isUseIPPort4Check()) {
Loggers.SRV_LOG.info("[CLUSTER-UPDATE] {}:{}, useIPPort4Check: {} -> {}",
cluster.getService().getName(), cluster.getName(), isUseIPPort4Check(), cluster.isUseIPPort4Check());
getService().getName(), getName(), isUseIPPort4Check(), cluster.isUseIPPort4Check());
setUseIPPort4Check(cluster.isUseIPPort4Check());
}

Expand Down
10 changes: 5 additions & 5 deletions naming/src/main/java/com/alibaba/nacos/naming/core/Service.java
Original file line number Diff line number Diff line change
Expand Up @@ -390,27 +390,27 @@ public void setNamespaceId(String namespaceId) {
public void update(Service vDom) {

if (!StringUtils.equals(token, vDom.getToken())) {
Loggers.SRV_LOG.info("[DOM-UPDATE] service: {}, token: {} -> {}", getName(), token, vDom.getToken());
Loggers.SRV_LOG.info("[SERVICE-UPDATE] service: {}, token: {} -> {}", getName(), token, vDom.getToken());
token = vDom.getToken();
}

if (!ListUtils.isEqualList(owners, vDom.getOwners())) {
Loggers.SRV_LOG.info("[DOM-UPDATE] service: {}, owners: {} -> {}", getName(), owners, vDom.getOwners());
Loggers.SRV_LOG.info("[SERVICE-UPDATE] service: {}, owners: {} -> {}", getName(), owners, vDom.getOwners());
owners = vDom.getOwners();
}

if (getProtectThreshold() != vDom.getProtectThreshold()) {
Loggers.SRV_LOG.info("[DOM-UPDATE] service: {}, protectThreshold: {} -> {}", getName(), getProtectThreshold(), vDom.getProtectThreshold());
Loggers.SRV_LOG.info("[SERVICE-UPDATE] service: {}, protectThreshold: {} -> {}", getName(), getProtectThreshold(), vDom.getProtectThreshold());
setProtectThreshold(vDom.getProtectThreshold());
}

if (resetWeight != vDom.getResetWeight().booleanValue()) {
Loggers.SRV_LOG.info("[DOM-UPDATE] service: {}, resetWeight: {} -> {}", getName(), resetWeight, vDom.getResetWeight());
Loggers.SRV_LOG.info("[SERVICE-UPDATE] service: {}, resetWeight: {} -> {}", getName(), resetWeight, vDom.getResetWeight());
resetWeight = vDom.getResetWeight();
}

if (enabled != vDom.getEnabled().booleanValue()) {
Loggers.SRV_LOG.info("[DOM-UPDATE] service: {}, enabled: {} -> {}", getName(), enabled, vDom.getEnabled());
Loggers.SRV_LOG.info("[SERVICE-UPDATE] service: {}, enabled: {} -> {}", getName(), enabled, vDom.getEnabled());
enabled = vDom.getEnabled();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ public class ServiceManager implements RecordListener<Service> {
@PostConstruct
public void init() {

UtilsAndCommons.DOMAIN_SYNCHRONIZATION_EXECUTOR.schedule(new ServiceReporter(), 60000, TimeUnit.MILLISECONDS);
UtilsAndCommons.SERVICE_SYNCHRONIZATION_EXECUTOR.schedule(new ServiceReporter(), 60000, TimeUnit.MILLISECONDS);

UtilsAndCommons.DOMAIN_UPDATE_EXECUTOR.submit(new UpdatedServiceProcessor());
UtilsAndCommons.SERVICE_UPDATE_EXECUTOR.submit(new UpdatedServiceProcessor());

try {
Loggers.SRV_LOG.info("listen for service meta change");
Expand Down Expand Up @@ -699,7 +699,7 @@ public void run() {
} catch (Exception e) {
Loggers.SRV_LOG.error("[DOMAIN-STATUS] Exception while sending service status", e);
} finally {
UtilsAndCommons.DOMAIN_SYNCHRONIZATION_EXECUTOR.schedule(this, switchDomain.getServiceStatusSynchronizationPeriodMillis(), TimeUnit.MILLISECONDS);
UtilsAndCommons.SERVICE_SYNCHRONIZATION_EXECUTOR.schedule(this, switchDomain.getServiceStatusSynchronizationPeriodMillis(), TimeUnit.MILLISECONDS);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,35 +24,28 @@ public class SwitchEntry {

public static final String BATCH = "batch";
public static final String DISTRO_THRESHOLD = "distroThreshold";
public static final String ENABLE_ALL_DOM_NAME_CACHE = "enableAllDomNameCache";
public static final String INCREMENTAL_LIST = "incrementalList";
public static final String HEALTH_CHECK_WHITLE_LIST = "healthCheckWhiteList";
public static final String CLIENT_BEAT_INTERVAL = "clientBeatInterval";
public static final String PUSH_VERSION = "pushVersion";
public static final String CLIENT_JAVA = "java";
public static final String CLIENT_C = "c";
public static final String CLIENT_GO = "go";
public static final String CLIENT_PYTHON = "python";
public static final String CLIENT_TENGINE = "python";
public static final String TRAFFIC_SCHEDULING_VERSION = "trafficSchedulingVersion";
public static final String PUSH_CACHE_MILLIS = "pushCacheMillis";
public static final String DEFAULT_CACHE_MILLIS = "defaultCacheMillis";
public static final String MASTERS = "masters";
public static final String DISTRO = "distro";
public static final String CHECK = "check";
public static final String PUSH_ENABLED = "pushEnabled";
public static final String DEFAULT_HEALTH_CHECK_MODE = "defaultHealthCheckMode";
public static final String SERVICE_STATUS_SYNC_PERIOD = "serviceStatusSynchronizationPeriodMillis";
public static final String SERVER_STATUS_SYNC_PERIOD = "serverStatusSynchronizationPeriodMillis";
public static final String HEALTH_CHECK_TIMES = "healthCheckTimes";
public static final String DISABLE_ADD_IP = "disableAddIP";
public static final String ENABLE_CACHE = "enableCache";
public static final String SEND_BEAT_ONLY = "sendBeatOnly";
public static final String LIMITED_URL_MAP = "limitedUrlMap";
public static final String ENABLE_STANDALONE = "enableStandalone";
public static final int MIN_PUSH_CACHE_TIME_MIILIS = 10000;
public static final int MIN_CACHE_TIME_MIILIS = 1000;
public static final int MIN_DOM_SYNC_TIME_MIILIS = 5000;
public static final int MIN_SERVICE_SYNC_TIME_MIILIS = 5000;
public static final int MIN_SERVER_SYNC_TIME_MIILIS = 15000;

public static final String ACTION_ADD = "add";
Expand All @@ -65,7 +58,6 @@ public class SwitchEntry {

public static final String PARAM_JSON = "json";

public static final String READ_ENABLED = "readEnabled";
public static final String OVERRIDDEN_SERVER_STATUS = "overriddenServerStatus";
public static final String SERVER_MODE = "serverMode";
}
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public void update(String entry, String value, boolean debug) throws Exception {
if (entry.equals(SwitchEntry.SERVICE_STATUS_SYNC_PERIOD)) {
Long millis = Long.parseLong(value);

if (millis < SwitchEntry.MIN_DOM_SYNC_TIME_MIILIS) {
if (millis < SwitchEntry.MIN_SERVICE_SYNC_TIME_MIILIS) {
throw new IllegalArgumentException("serviceStatusSynchronizationPeriodMillis is too small(<5000)");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import com.alibaba.fastjson.parser.ParserConfig;
import com.alibaba.fastjson.serializer.SerializeConfig;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.alibaba.nacos.api.common.Constants;
import com.alibaba.nacos.api.naming.pojo.AbstractHealthChecker;
import com.alibaba.nacos.naming.exception.NacosException;
import com.alibaba.nacos.naming.healthcheck.JsonAdapter;
Expand Down Expand Up @@ -118,9 +117,9 @@ public class UtilsAndCommons {

public static final String DATA_BASE_DIR = NACOS_HOME + File.separator + "data" + File.separator + "naming";

public static final ScheduledExecutorService DOMAIN_SYNCHRONIZATION_EXECUTOR;
public static final ScheduledExecutorService SERVICE_SYNCHRONIZATION_EXECUTOR;

public static final ScheduledExecutorService DOMAIN_UPDATE_EXECUTOR;
public static final ScheduledExecutorService SERVICE_UPDATE_EXECUTOR;

public static final ScheduledExecutorService INIT_CONFIG_EXECUTOR;

Expand All @@ -146,7 +145,7 @@ public class UtilsAndCommons {
JSON.DEFAULT_GENERATE_FEATURE |= SerializerFeature.WriteMapNullValue.getMask();
JSON.DEFAULT_GENERATE_FEATURE |= SerializerFeature.WriteNullNumberAsZero.getMask();

DOMAIN_SYNCHRONIZATION_EXECUTOR
SERVICE_SYNCHRONIZATION_EXECUTOR
= new ScheduledThreadPoolExecutor(1, new ThreadFactory() {
@Override
public Thread newThread(Runnable r) {
Expand All @@ -157,7 +156,7 @@ public Thread newThread(Runnable r) {
}
});

DOMAIN_UPDATE_EXECUTOR
SERVICE_UPDATE_EXECUTOR
= new ScheduledThreadPoolExecutor(1, new ThreadFactory() {
@Override
public Thread newThread(Runnable r) {
Expand Down

0 comments on commit 7bf60c1

Please sign in to comment.