parent
51a3cf9fe7
commit
9bcb901174
@ -158,7 +158,7 @@ public class Constants {
|
|||||||
|
|
||||||
public static final int NAMING_INSTANCE_ID_SEG_COUNT = 4;
|
public static final int NAMING_INSTANCE_ID_SEG_COUNT = 4;
|
||||||
|
|
||||||
public static final String NAMING_HTTP_HEADER_SPILIER = "\\|";
|
public static final String NAMING_HTTP_HEADER_SPLITTER = "\\|";
|
||||||
|
|
||||||
public static final String DEFAULT_CLUSTER_NAME = "DEFAULT";
|
public static final String DEFAULT_CLUSTER_NAME = "DEFAULT";
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ public class Http extends AbstractHealthChecker {
|
|||||||
return Collections.emptyMap();
|
return Collections.emptyMap();
|
||||||
}
|
}
|
||||||
final Map<String, String> headerMap = new HashMap<String, String>(16);
|
final Map<String, String> headerMap = new HashMap<String, String>(16);
|
||||||
for (final String s : headers.split(Constants.NAMING_HTTP_HEADER_SPILIER)) {
|
for (final String s : headers.split(Constants.NAMING_HTTP_HEADER_SPLITTER)) {
|
||||||
final String[] splits = s.split(":");
|
final String[] splits = s.split(":");
|
||||||
if (splits.length != 2) {
|
if (splits.length != 2) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -288,7 +288,7 @@ public class ClientWorker implements Closeable {
|
|||||||
* Check config info.
|
* Check config info.
|
||||||
*/
|
*/
|
||||||
public void checkConfigInfo() {
|
public void checkConfigInfo() {
|
||||||
// Dispatch taskes.
|
// Dispatch tasks.
|
||||||
int listenerSize = cacheMap.size();
|
int listenerSize = cacheMap.size();
|
||||||
// Round up the longingTaskCount.
|
// Round up the longingTaskCount.
|
||||||
int longingTaskCount = (int) Math.ceil(listenerSize / ParamUtil.getPerTaskConfigSize());
|
int longingTaskCount = (int) Math.ceil(listenerSize / ParamUtil.getPerTaskConfigSize());
|
||||||
@ -304,7 +304,7 @@ public class ClientWorker implements Closeable {
|
|||||||
/**
|
/**
|
||||||
* Fetch the dataId list from server.
|
* Fetch the dataId list from server.
|
||||||
*
|
*
|
||||||
* @param cacheDatas CacheDatas for config infomations.
|
* @param cacheDatas CacheDatas for config information.
|
||||||
* @param inInitializingCacheList initial cache lists.
|
* @param inInitializingCacheList initial cache lists.
|
||||||
* @return String include dataId and group (ps: it maybe null).
|
* @return String include dataId and group (ps: it maybe null).
|
||||||
* @throws Exception Exception.
|
* @throws Exception Exception.
|
||||||
@ -322,7 +322,7 @@ public class ClientWorker implements Closeable {
|
|||||||
sb.append(cacheData.getTenant()).append(LINE_SEPARATOR);
|
sb.append(cacheData.getTenant()).append(LINE_SEPARATOR);
|
||||||
}
|
}
|
||||||
if (cacheData.isInitializing()) {
|
if (cacheData.isInitializing()) {
|
||||||
// It updates when cacheData occours in cacheMap by first time.
|
// It updates when cacheData occurs in cacheMap by first time.
|
||||||
inInitializingCacheList
|
inInitializingCacheList
|
||||||
.add(GroupKey.getKeyTenant(cacheData.dataId, cacheData.group, cacheData.tenant));
|
.add(GroupKey.getKeyTenant(cacheData.dataId, cacheData.group, cacheData.tenant));
|
||||||
}
|
}
|
||||||
|
@ -118,7 +118,7 @@ public class Chooser<K, T> {
|
|||||||
public Ref(List<Pair<T>> itemsWithWeight) {
|
public Ref(List<Pair<T>> itemsWithWeight) {
|
||||||
this.itemsWithWeight = itemsWithWeight;
|
this.itemsWithWeight = itemsWithWeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Refresh.
|
* Refresh.
|
||||||
*/
|
*/
|
||||||
@ -167,7 +167,7 @@ public class Chooser<K, T> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
throw new IllegalStateException(
|
throw new IllegalStateException(
|
||||||
"Cumulative Weight caculate wrong , the sum of probabilities does not equals 1.");
|
"Cumulative Weight calculate wrong , the sum of probabilities does not equals 1.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -52,7 +52,7 @@ public interface CmdbReader {
|
|||||||
*
|
*
|
||||||
* @param labelName name of label
|
* @param labelName name of label
|
||||||
* @param labelValue value of label
|
* @param labelValue value of label
|
||||||
* @return list of entiy
|
* @return list of entity
|
||||||
*/
|
*/
|
||||||
List<Entity> queryEntitiesByLabel(String labelName, String labelValue);
|
List<Entity> queryEntitiesByLabel(String labelName, String labelValue);
|
||||||
}
|
}
|
||||||
|
@ -191,7 +191,7 @@ public final class CollectionUtils {
|
|||||||
*
|
*
|
||||||
* @param coll collection
|
* @param coll collection
|
||||||
* @param target target value
|
* @param target target value
|
||||||
* @param <T> Genreal Type
|
* @param <T> General Type
|
||||||
* @return true if contain, otherwise false
|
* @return true if contain, otherwise false
|
||||||
*/
|
*/
|
||||||
public static <T> boolean contains(Collection<T> coll, T target) {
|
public static <T> boolean contains(Collection<T> coll, T target) {
|
||||||
@ -236,7 +236,7 @@ public final class CollectionUtils {
|
|||||||
* @param defaultValue default value
|
* @param defaultValue default value
|
||||||
* @param <T> General Type
|
* @param <T> General Type
|
||||||
* @return the value to which the specified index , or {@code defaultValue} if this collection contains no value for
|
* @return the value to which the specified index , or {@code defaultValue} if this collection contains no value for
|
||||||
* the index.
|
* the index.
|
||||||
*/
|
*/
|
||||||
public static <T> T getOrDefault(Collection<T> coll, int index, T defaultValue) {
|
public static <T> T getOrDefault(Collection<T> coll, int index, T defaultValue) {
|
||||||
try {
|
try {
|
||||||
|
@ -61,7 +61,7 @@ public class CapacityManagementAspect {
|
|||||||
private PersistService persistService;
|
private PersistService persistService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Need to judge the size of content whether to exceed the limination.
|
* Need to judge the size of content whether to exceed the limitation.
|
||||||
*/
|
*/
|
||||||
@Around(SYNC_UPDATE_CONFIG_ALL)
|
@Around(SYNC_UPDATE_CONFIG_ALL)
|
||||||
public Object aroundSyncUpdateConfigAll(ProceedingJoinPoint pjp, HttpServletRequest request,
|
public Object aroundSyncUpdateConfigAll(ProceedingJoinPoint pjp, HttpServletRequest request,
|
||||||
@ -74,7 +74,7 @@ public class CapacityManagementAspect {
|
|||||||
String betaIps = request.getHeader("betaIps");
|
String betaIps = request.getHeader("betaIps");
|
||||||
if (StringUtils.isBlank(betaIps)) {
|
if (StringUtils.isBlank(betaIps)) {
|
||||||
if (StringUtils.isBlank(tag)) {
|
if (StringUtils.isBlank(tag)) {
|
||||||
// do capacity management limination check for writting or updating config_info table.
|
// do capacity management limitation check for writing or updating config_info table.
|
||||||
if (persistService.findConfigInfo(dataId, group, tenant) == null) {
|
if (persistService.findConfigInfo(dataId, group, tenant) == null) {
|
||||||
// Write operation.
|
// Write operation.
|
||||||
return do4Insert(pjp, request, response, group, tenant, content);
|
return do4Insert(pjp, request, response, group, tenant, content);
|
||||||
@ -87,7 +87,7 @@ public class CapacityManagementAspect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update operation: open the limination of capacity management and it will check the size of content.
|
* Update operation: open the limitation of capacity management and it will check the size of content.
|
||||||
*
|
*
|
||||||
* @throws Throwable Throws Exception when actually operate.
|
* @throws Throwable Throws Exception when actually operate.
|
||||||
*/
|
*/
|
||||||
@ -109,11 +109,10 @@ public class CapacityManagementAspect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write operation.
|
* Write operation. Step 1: count whether to open the limitation checking function for capacity management; Step 2:
|
||||||
* Step 1: count whether to open the limination checking funtion for capacity management;
|
* open limitation checking capacity management and check size of content and quota;
|
||||||
* Step 2: open limination checking capacity management and check size of content and quota;
|
|
||||||
*
|
*
|
||||||
* @throws Throwable Expcetion.
|
* @throws Throwable Exception.
|
||||||
*/
|
*/
|
||||||
private Object do4Insert(ProceedingJoinPoint pjp, HttpServletRequest request, HttpServletResponse response,
|
private Object do4Insert(ProceedingJoinPoint pjp, HttpServletRequest request, HttpServletResponse response,
|
||||||
String group, String tenant, String content) throws Throwable {
|
String group, String tenant, String content) throws Throwable {
|
||||||
@ -143,7 +142,8 @@ public class CapacityManagementAspect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The usage of capacity table for counting module will subtracte one whether open the limination check of capacity management.
|
* The usage of capacity table for counting module will subtracte one whether open the limitation check of capacity
|
||||||
|
* management.
|
||||||
*/
|
*/
|
||||||
@Around(DELETE_CONFIG)
|
@Around(DELETE_CONFIG)
|
||||||
public Object aroundDeleteConfig(ProceedingJoinPoint pjp, HttpServletRequest request, HttpServletResponse response,
|
public Object aroundDeleteConfig(ProceedingJoinPoint pjp, HttpServletRequest request, HttpServletResponse response,
|
||||||
@ -162,7 +162,7 @@ public class CapacityManagementAspect {
|
|||||||
/**
|
/**
|
||||||
* Delete Operation.
|
* Delete Operation.
|
||||||
*
|
*
|
||||||
* @throws Throwable Expcetion.
|
* @throws Throwable Exception.
|
||||||
*/
|
*/
|
||||||
private Object do4Delete(ProceedingJoinPoint pjp, HttpServletResponse response, String group, String tenant,
|
private Object do4Delete(ProceedingJoinPoint pjp, HttpServletResponse response, String group, String tenant,
|
||||||
ConfigInfo configInfo) throws Throwable {
|
ConfigInfo configInfo) throws Throwable {
|
||||||
@ -181,7 +181,7 @@ public class CapacityManagementAspect {
|
|||||||
correctUsage(group, tenant, hasTenant);
|
correctUsage(group, tenant, hasTenant);
|
||||||
return pjp.proceed();
|
return pjp.proceed();
|
||||||
}
|
}
|
||||||
|
|
||||||
// The same record can be deleted concurrently. This interface can be deleted asynchronously(submit MergeDataTask
|
// The same record can be deleted concurrently. This interface can be deleted asynchronously(submit MergeDataTask
|
||||||
// to MergeTaskProcessor for processing), It may lead to more than one decrease in usage.
|
// to MergeTaskProcessor for processing), It may lead to more than one decrease in usage.
|
||||||
// Therefore, it is necessary to modify the usage job regularly.
|
// Therefore, it is necessary to modify the usage job regularly.
|
||||||
@ -221,7 +221,7 @@ public class CapacityManagementAspect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Usage counting service: it will count whether the limination check funtion will be open.
|
* Usage counting service: it will count whether the limitation check function will be open.
|
||||||
*/
|
*/
|
||||||
private void insertOrUpdateUsage(String group, String tenant, CounterMode counterMode, boolean hasTenant) {
|
private void insertOrUpdateUsage(String group, String tenant, CounterMode counterMode, boolean hasTenant) {
|
||||||
try {
|
try {
|
||||||
@ -333,13 +333,13 @@ public class CapacityManagementAspect {
|
|||||||
if (capacity != null) {
|
if (capacity != null) {
|
||||||
Integer maxSize = getMaxSize(isAggr, capacity);
|
Integer maxSize = getMaxSize(isAggr, capacity);
|
||||||
if (maxSize == 0) {
|
if (maxSize == 0) {
|
||||||
// If there exists capacity info and maxSize = 0, then it uses maxSize limination default value to compare.
|
// If there exists capacity info and maxSize = 0, then it uses maxSize limitation default value to compare.
|
||||||
return isOverSize(group, tenant, currentSize, defaultMaxSize, hasTenant);
|
return isOverSize(group, tenant, currentSize, defaultMaxSize, hasTenant);
|
||||||
}
|
}
|
||||||
// If there exists capacity info, then maxSize!=0.
|
// If there exists capacity info, then maxSize!=0.
|
||||||
return isOverSize(group, tenant, currentSize, maxSize, hasTenant);
|
return isOverSize(group, tenant, currentSize, maxSize, hasTenant);
|
||||||
}
|
}
|
||||||
// If there no exists capacity info, then it uses maxSize limination default value to compare.
|
// If there no exists capacity info, then it uses maxSize limitation default value to compare.
|
||||||
return isOverSize(group, tenant, currentSize, defaultMaxSize, hasTenant);
|
return isOverSize(group, tenant, currentSize, defaultMaxSize, hasTenant);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -420,7 +420,7 @@ public class CapacityManagementAspect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* limit tyep.
|
* limit type.
|
||||||
*
|
*
|
||||||
* @author Nacos.
|
* @author Nacos.
|
||||||
*/
|
*/
|
||||||
|
@ -90,7 +90,7 @@ public class CapacityController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Modify group or capacity of tenant, and init record when capacity informations are still initial.
|
* Modify group or capacity of tenant, and init record when capacity information are still initial.
|
||||||
*/
|
*/
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public RestResult<Boolean> updateCapacity(HttpServletResponse response,
|
public RestResult<Boolean> updateCapacity(HttpServletResponse response,
|
||||||
|
@ -153,7 +153,7 @@ public class ConfigController {
|
|||||||
ParamUtils.checkParam(configAdvanceInfo);
|
ParamUtils.checkParam(configAdvanceInfo);
|
||||||
|
|
||||||
if (AggrWhitelist.isAggrDataId(dataId)) {
|
if (AggrWhitelist.isAggrDataId(dataId)) {
|
||||||
LOGGER.warn("[aggr-conflict] {} attemp to publish single data, {}, {}", RequestUtil.getRemoteIp(request),
|
LOGGER.warn("[aggr-conflict] {} attempt to publish single data, {}, {}", RequestUtil.getRemoteIp(request),
|
||||||
dataId, group);
|
dataId, group);
|
||||||
throw new NacosException(NacosException.NO_RIGHT, "dataId:" + dataId + " is aggr");
|
throw new NacosException(NacosException.NO_RIGHT, "dataId:" + dataId + " is aggr");
|
||||||
}
|
}
|
||||||
@ -185,7 +185,7 @@ public class ConfigController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get configure board infomation fail.
|
* Get configure board information fail.
|
||||||
*
|
*
|
||||||
* @throws ServletException ServletException.
|
* @throws ServletException ServletException.
|
||||||
* @throws IOException IOException.
|
* @throws IOException IOException.
|
||||||
@ -666,14 +666,14 @@ public class ConfigController {
|
|||||||
List<ConfigAllInfo> configInfoList4Clone = new ArrayList<>(queryedDataList.size());
|
List<ConfigAllInfo> configInfoList4Clone = new ArrayList<>(queryedDataList.size());
|
||||||
|
|
||||||
for (ConfigAllInfo ci : queryedDataList) {
|
for (ConfigAllInfo ci : queryedDataList) {
|
||||||
SameNamespaceCloneConfigBean prarmBean = configBeansMap.get(ci.getId());
|
SameNamespaceCloneConfigBean paramBean = configBeansMap.get(ci.getId());
|
||||||
ConfigAllInfo ci4save = new ConfigAllInfo();
|
ConfigAllInfo ci4save = new ConfigAllInfo();
|
||||||
ci4save.setTenant(namespace);
|
ci4save.setTenant(namespace);
|
||||||
ci4save.setType(ci.getType());
|
ci4save.setType(ci.getType());
|
||||||
ci4save.setGroup((prarmBean != null && StringUtils.isNotBlank(prarmBean.getGroup())) ? prarmBean.getGroup()
|
ci4save.setGroup((paramBean != null && StringUtils.isNotBlank(paramBean.getGroup())) ? paramBean.getGroup()
|
||||||
: ci.getGroup());
|
: ci.getGroup());
|
||||||
ci4save.setDataId(
|
ci4save.setDataId(
|
||||||
(prarmBean != null && StringUtils.isNotBlank(prarmBean.getDataId())) ? prarmBean.getDataId()
|
(paramBean != null && StringUtils.isNotBlank(paramBean.getDataId())) ? paramBean.getDataId()
|
||||||
: ci.getDataId());
|
: ci.getDataId());
|
||||||
ci4save.setContent(ci.getContent());
|
ci4save.setContent(ci.getContent());
|
||||||
if (StringUtils.isNotBlank(ci.getAppName())) {
|
if (StringUtils.isNotBlank(ci.getAppName())) {
|
||||||
|
@ -97,7 +97,7 @@ public class ConfigServletInner {
|
|||||||
}
|
}
|
||||||
int versionNum = Protocol.getVersionNumber(version);
|
int versionNum = Protocol.getVersionNumber(version);
|
||||||
|
|
||||||
// Befor 2.0.4 version, return value is put into header.
|
// Before 2.0.4 version, return value is put into header.
|
||||||
if (versionNum < START_LONG_POLLING_VERSION_NUM) {
|
if (versionNum < START_LONG_POLLING_VERSION_NUM) {
|
||||||
response.addHeader(Constants.PROBE_MODIFY_RESPONSE, oldResult);
|
response.addHeader(Constants.PROBE_MODIFY_RESPONSE, oldResult);
|
||||||
response.addHeader(Constants.PROBE_MODIFY_RESPONSE_NEW, newResult);
|
response.addHeader(Constants.PROBE_MODIFY_RESPONSE_NEW, newResult);
|
||||||
@ -137,14 +137,14 @@ public class ConfigServletInner {
|
|||||||
if (cacheItem.isBeta() && cacheItem.getIps4Beta().contains(clientIp)) {
|
if (cacheItem.isBeta() && cacheItem.getIps4Beta().contains(clientIp)) {
|
||||||
isBeta = true;
|
isBeta = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
final String configType =
|
final String configType =
|
||||||
(null != cacheItem.getType()) ? cacheItem.getType() : FileTypeEnum.TEXT.getFileType();
|
(null != cacheItem.getType()) ? cacheItem.getType() : FileTypeEnum.TEXT.getFileType();
|
||||||
response.setHeader("Config-Type", configType);
|
response.setHeader("Config-Type", configType);
|
||||||
FileTypeEnum fileTypeEnum = FileTypeEnum.getFileTypeEnumByFileExtensionOrFileType(configType);
|
FileTypeEnum fileTypeEnum = FileTypeEnum.getFileTypeEnumByFileExtensionOrFileType(configType);
|
||||||
String contentTypeHeader = fileTypeEnum.getContentType();
|
String contentTypeHeader = fileTypeEnum.getContentType();
|
||||||
response.setHeader(HttpHeaderConsts.CONTENT_TYPE, contentTypeHeader);
|
response.setHeader(HttpHeaderConsts.CONTENT_TYPE, contentTypeHeader);
|
||||||
|
|
||||||
File file = null;
|
File file = null;
|
||||||
ConfigInfoBase configInfoBase = null;
|
ConfigInfoBase configInfoBase = null;
|
||||||
PrintWriter out = null;
|
PrintWriter out = null;
|
||||||
@ -295,9 +295,10 @@ public class ConfigServletInner {
|
|||||||
private static void releaseConfigReadLock(String groupKey) {
|
private static void releaseConfigReadLock(String groupKey) {
|
||||||
ConfigCacheService.releaseReadLock(groupKey);
|
ConfigCacheService.releaseReadLock(groupKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Try to add read lock.
|
* Try to add read lock.
|
||||||
|
*
|
||||||
* @param groupKey groupKey string value.
|
* @param groupKey groupKey string value.
|
||||||
* @return 0 - No data and failed. Positive number - lock succeeded. Negative number - lock failed。
|
* @return 0 - No data and failed. Positive number - lock succeeded. Negative number - lock failed。
|
||||||
*/
|
*/
|
||||||
|
@ -26,7 +26,7 @@ import java.io.Serializable;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* ConfigInfoBase.
|
* ConfigInfoBase.
|
||||||
* And can't add field, to compatible with old interface(If adding a field, then it will occour compatibility problems).
|
* And can't add field, to compatible with old interface(If adding a field, then it will occur compatibility problems).
|
||||||
*
|
*
|
||||||
* @author Nacos
|
* @author Nacos
|
||||||
*/
|
*/
|
||||||
|
@ -18,7 +18,7 @@ package com.alibaba.nacos.config.server.model;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* ConfigInfoBaseEx.
|
* ConfigInfoBaseEx.
|
||||||
* And can't add field, to compatible with old interface(If adding a field, then it will occour compatibility problems).
|
* And can't add field, to compatible with old interface(If adding a field, then it will occur compatibility problems).
|
||||||
*
|
*
|
||||||
* @author Nacos
|
* @author Nacos
|
||||||
*/
|
*/
|
||||||
|
@ -42,8 +42,8 @@ public class ClientTrackService {
|
|||||||
/**
|
/**
|
||||||
* TrackClientMd5.
|
* TrackClientMd5.
|
||||||
*
|
*
|
||||||
* @param ip ip string value.
|
* @param ip ip string value.
|
||||||
* @param clientMd5Map clientMd5Map.
|
* @param clientMd5Map clientMd5Map.
|
||||||
* @param clientLastPollingTsMap clientLastPollingTsMap.
|
* @param clientLastPollingTsMap clientLastPollingTsMap.
|
||||||
*/
|
*/
|
||||||
public static void trackClientMd5(String ip, Map<String, String> clientMd5Map,
|
public static void trackClientMd5(String ip, Map<String, String> clientMd5Map,
|
||||||
@ -57,8 +57,8 @@ public class ClientTrackService {
|
|||||||
/**
|
/**
|
||||||
* Put the specified value(ip/groupKey/clientMd5) into clientRecords Map.
|
* Put the specified value(ip/groupKey/clientMd5) into clientRecords Map.
|
||||||
*
|
*
|
||||||
* @param ip ip string value.
|
* @param ip ip string value.
|
||||||
* @param groupKey groupKey string value.
|
* @param groupKey groupKey string value.
|
||||||
* @param clientMd5 clientMd5 string value.
|
* @param clientMd5 clientMd5 string value.
|
||||||
*/
|
*/
|
||||||
public static void trackClientMd5(String ip, String groupKey, String clientMd5) {
|
public static void trackClientMd5(String ip, String groupKey, String clientMd5) {
|
||||||
@ -76,11 +76,11 @@ public class ClientTrackService {
|
|||||||
public static int subscribeClientCount() {
|
public static int subscribeClientCount() {
|
||||||
return clientRecords.size();
|
return clientRecords.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all of subsciber count.
|
* Get all of subscriber count.
|
||||||
*
|
*
|
||||||
* @return all of subsciber count.
|
* @return all of subscriber count.
|
||||||
*/
|
*/
|
||||||
public static long subscriberCount() {
|
public static long subscriberCount() {
|
||||||
long count = 0;
|
long count = 0;
|
||||||
@ -92,7 +92,6 @@ public class ClientTrackService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Groupkey -> SubscriberStatus.
|
* Groupkey -> SubscriberStatus.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public static Map<String, SubscriberStatus> listSubStatus(String ip) {
|
public static Map<String, SubscriberStatus> listSubStatus(String ip) {
|
||||||
Map<String, SubscriberStatus> status = new HashMap<String, SubscriberStatus>(100);
|
Map<String, SubscriberStatus> status = new HashMap<String, SubscriberStatus>(100);
|
||||||
@ -134,9 +133,8 @@ public class ClientTrackService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specify subscriber's ip and look up whether data is lastest.
|
* Specify subscriber's ip and look up whether data is latest.
|
||||||
* groupKey -> isUptodate.
|
* groupKey -> isUptodate.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public static Map<String, Boolean> isClientUptodate(String ip) {
|
public static Map<String, Boolean> isClientUptodate(String ip) {
|
||||||
Map<String, Boolean> result = new HashMap<String, Boolean>(100);
|
Map<String, Boolean> result = new HashMap<String, Boolean>(100);
|
||||||
@ -150,7 +148,7 @@ public class ClientTrackService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specify groupKey and look up whether subsciber and data is lastest.
|
* Specify groupKey and look up whether subscriber and data is latest.
|
||||||
* IP -> isUptodate.
|
* IP -> isUptodate.
|
||||||
*/
|
*/
|
||||||
public static Map<String, Boolean> listSubscriberByGroup(String groupKey) {
|
public static Map<String, Boolean> listSubscriberByGroup(String groupKey) {
|
||||||
|
@ -231,8 +231,8 @@ public class ConfigCacheService {
|
|||||||
try {
|
try {
|
||||||
final String md5 = MD5Utils.md5Hex(content, Constants.ENCODE);
|
final String md5 = MD5Utils.md5Hex(content, Constants.ENCODE);
|
||||||
if (!PropertyUtil.isDirectRead()) {
|
if (!PropertyUtil.isDirectRead()) {
|
||||||
String loacalMd5 = DiskUtil.getLocalConfigMd5(dataId, group, tenant);
|
String localMd5 = DiskUtil.getLocalConfigMd5(dataId, group, tenant);
|
||||||
if (md5.equals(loacalMd5)) {
|
if (md5.equals(localMd5)) {
|
||||||
DUMP_LOG.warn("[dump-ignore] ignore to save cache file. groupKey={}, md5={}, lastModifiedOld={}, "
|
DUMP_LOG.warn("[dump-ignore] ignore to save cache file. groupKey={}, md5={}, lastModifiedOld={}, "
|
||||||
+ "lastModifiedNew={}", groupKey, md5, ConfigCacheService.getLastModifiedTs(groupKey),
|
+ "lastModifiedNew={}", groupKey, md5, ConfigCacheService.getLastModifiedTs(groupKey),
|
||||||
lastModifiedTs);
|
lastModifiedTs);
|
||||||
|
@ -129,26 +129,26 @@ public class ConfigSubService {
|
|||||||
*/
|
*/
|
||||||
public SampleResult mergeSampleResult(SampleResult sampleCollectResult, List<SampleResult> sampleResults) {
|
public SampleResult mergeSampleResult(SampleResult sampleCollectResult, List<SampleResult> sampleResults) {
|
||||||
SampleResult mergeResult = new SampleResult();
|
SampleResult mergeResult = new SampleResult();
|
||||||
Map<String, String> lisentersGroupkeyStatus = null;
|
Map<String, String> listenersGroupkeyStatus = null;
|
||||||
if (sampleCollectResult.getLisentersGroupkeyStatus() == null || sampleCollectResult.getLisentersGroupkeyStatus()
|
if (sampleCollectResult.getLisentersGroupkeyStatus() == null || sampleCollectResult.getLisentersGroupkeyStatus()
|
||||||
.isEmpty()) {
|
.isEmpty()) {
|
||||||
lisentersGroupkeyStatus = new HashMap<String, String>(10);
|
listenersGroupkeyStatus = new HashMap<String, String>(10);
|
||||||
} else {
|
} else {
|
||||||
lisentersGroupkeyStatus = sampleCollectResult.getLisentersGroupkeyStatus();
|
listenersGroupkeyStatus = sampleCollectResult.getLisentersGroupkeyStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (SampleResult sampleResult : sampleResults) {
|
for (SampleResult sampleResult : sampleResults) {
|
||||||
Map<String, String> lisentersGroupkeyStatusTmp = sampleResult.getLisentersGroupkeyStatus();
|
Map<String, String> listenersGroupkeyStatusTmp = sampleResult.getLisentersGroupkeyStatus();
|
||||||
for (Map.Entry<String, String> entry : lisentersGroupkeyStatusTmp.entrySet()) {
|
for (Map.Entry<String, String> entry : listenersGroupkeyStatusTmp.entrySet()) {
|
||||||
lisentersGroupkeyStatus.put(entry.getKey(), entry.getValue());
|
listenersGroupkeyStatus.put(entry.getKey(), entry.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mergeResult.setLisentersGroupkeyStatus(lisentersGroupkeyStatus);
|
mergeResult.setLisentersGroupkeyStatus(listenersGroupkeyStatus);
|
||||||
return mergeResult;
|
return mergeResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Query subsrciber's task from every nacos server nodes.
|
* Query subscriber's task from every nacos server nodes.
|
||||||
*
|
*
|
||||||
* @author Nacos
|
* @author Nacos
|
||||||
*/
|
*/
|
||||||
@ -177,8 +177,7 @@ public class ConfigSubService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String urlAll = getUrl(ip, url) + "?" + paramUrl;
|
String urlAll = getUrl(ip, url) + "?" + paramUrl;
|
||||||
RestResult<String> result = NotifyService
|
RestResult<String> result = NotifyService.invokeURL(urlAll, null, Constants.ENCODE);
|
||||||
.invokeURL(urlAll, null, Constants.ENCODE);
|
|
||||||
|
|
||||||
// Http code 200
|
// Http code 200
|
||||||
if (result.ok()) {
|
if (result.ok()) {
|
||||||
|
@ -126,7 +126,7 @@ public class ApiController extends InstanceController {
|
|||||||
* Get service ips.
|
* Get service ips.
|
||||||
*
|
*
|
||||||
* @param request http request
|
* @param request http request
|
||||||
* @return service detail infomation
|
* @return service detail information
|
||||||
* @throws Exception exception
|
* @throws Exception exception
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/srvIPXT")
|
@RequestMapping("/srvIPXT")
|
||||||
|
@ -116,7 +116,7 @@ public class CatalogController {
|
|||||||
|
|
||||||
Service service = serviceManager.getService(namespaceId, serviceName);
|
Service service = serviceManager.getService(namespaceId, serviceName);
|
||||||
if (service == null) {
|
if (service == null) {
|
||||||
throw new NacosException(NacosException.NOT_FOUND, "serivce " + serviceName + " is not found!");
|
throw new NacosException(NacosException.NOT_FOUND, "service " + serviceName + " is not found!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!service.getClusterMap().containsKey(clusterName)) {
|
if (!service.getClusterMap().containsKey(clusterName)) {
|
||||||
|
@ -93,7 +93,7 @@ public class UtilsAndCommons {
|
|||||||
|
|
||||||
public static final String SELF_SERVICE_CLUSTER_ENV = "naming_self_service_cluster_ips";
|
public static final String SELF_SERVICE_CLUSTER_ENV = "naming_self_service_cluster_ips";
|
||||||
|
|
||||||
public static final String CACHE_KEY_SPLITER = "@@@@";
|
public static final String CACHE_KEY_SPLITTER = "@@@@";
|
||||||
|
|
||||||
public static final int MAX_PUBLISH_WAIT_TIME_MILLIS = 5000;
|
public static final int MAX_PUBLISH_WAIT_TIME_MILLIS = 5000;
|
||||||
|
|
||||||
|
@ -362,7 +362,7 @@ public class PushService implements ApplicationContextAware, ApplicationListener
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String getPushCacheKey(String serviceName, String clientIP, String agent) {
|
public static String getPushCacheKey(String serviceName, String clientIP, String agent) {
|
||||||
return serviceName + UtilsAndCommons.CACHE_KEY_SPLITER + agent;
|
return serviceName + UtilsAndCommons.CACHE_KEY_SPLITTER + agent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -366,7 +366,7 @@ public class ConfigAPI_CITCase {
|
|||||||
Listener ml = new Listener() {
|
Listener ml = new Listener() {
|
||||||
@Override
|
@Override
|
||||||
public void receiveConfigInfo(String configInfo) {
|
public void receiveConfigInfo(String configInfo) {
|
||||||
System.out.println("recieve23:" + configInfo);
|
System.out.println("receive23:" + configInfo);
|
||||||
count.incrementAndGet();
|
count.incrementAndGet();
|
||||||
Assert.assertEquals(content, configInfo);
|
Assert.assertEquals(content, configInfo);
|
||||||
}
|
}
|
||||||
@ -582,7 +582,7 @@ public class ConfigAPI_CITCase {
|
|||||||
iconfig.removeListener(dataId, group, new AbstractListener() {
|
iconfig.removeListener(dataId, group, new AbstractListener() {
|
||||||
@Override
|
@Override
|
||||||
public void receiveConfigInfo(String configInfo) {
|
public void receiveConfigInfo(String configInfo) {
|
||||||
System.out.println("remove recieve:" + configInfo);
|
System.out.println("remove receive:" + configInfo);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -633,7 +633,7 @@ public class ConfigAPI_CITCase {
|
|||||||
Listener ml1 = new AbstractListener() {
|
Listener ml1 = new AbstractListener() {
|
||||||
@Override
|
@Override
|
||||||
public void receiveConfigInfo(String configInfo) {
|
public void receiveConfigInfo(String configInfo) {
|
||||||
//System.out.println("ml1 remove listener recieve:" + configInfo);
|
//System.out.println("ml1 remove listener receive:" + configInfo);
|
||||||
count.incrementAndGet();
|
count.incrementAndGet();
|
||||||
Assert.assertEquals(contentRemove, configInfo);
|
Assert.assertEquals(contentRemove, configInfo);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user