当前位置: 首页>>代码示例>>Java>>正文


Java Constants.NULL属性代码示例

本文整理汇总了Java中com.taobao.diamond.common.Constants.NULL属性的典型用法代码示例。如果您正苦于以下问题:Java Constants.NULL属性的具体用法?Java Constants.NULL怎么用?Java Constants.NULL使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.taobao.diamond.common.Constants的用法示例。


在下文中一共展示了Constants.NULL属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: configureHttpMethod

private void configureHttpMethod(boolean skipContentCache, CacheData cacheData, long onceTimeOut,
        HttpMethod httpMethod) {
    if (skipContentCache && null != cacheData) {
        if (null != cacheData.getLastModifiedHeader() && Constants.NULL != cacheData.getLastModifiedHeader()) {
            httpMethod.addRequestHeader(Constants.IF_MODIFIED_SINCE, cacheData.getLastModifiedHeader());
        }
        if (null != cacheData.getMd5() && Constants.NULL != cacheData.getMd5()) {
            httpMethod.addRequestHeader(Constants.CONTENT_MD5, cacheData.getMd5());
        }
    }

    httpMethod.addRequestHeader(Constants.ACCEPT_ENCODING, "gzip,deflate");

    // 设置HttpMethod的参数
    HttpMethodParams params = new HttpMethodParams();
    params.setSoTimeout((int) onceTimeOut);
    // ///////////////////////
    httpMethod.setParams(params);
    httpClient.getHostConfiguration().setHost(diamondConfigure.getDomainNameList().get(this.domainNamePos.get()),
        diamondConfigure.getPort());
}
 
开发者ID:lysu,项目名称:diamond,代码行数:21,代码来源:DefaultDiamondSubscriber.java

示例2: getProbeUpdateString

/**
 * 获取探测更新的DataID的请求字符串
 * 
 * @param localModifySet
 * @return
 */
private String getProbeUpdateString() {
    // 获取check的DataID:Group:MD5串
    StringBuilder probeModifyBuilder = new StringBuilder();
    for (Entry<String, ConcurrentHashMap<String, CacheData>> cacheDatasEntry : this.cache.entrySet()) {
        String dataId = cacheDatasEntry.getKey();
        ConcurrentHashMap<String, CacheData> cacheDatas = cacheDatasEntry.getValue();
        if (null == cacheDatas) {
            continue;
        }
        for (Entry<String, CacheData> cacheDataEntry : cacheDatas.entrySet()) {
            final CacheData data = cacheDataEntry.getValue();
            // 非使用本地配置,才去diamond server检查
            if (!data.isUseLocalConfigInfo()) {
                probeModifyBuilder.append(dataId).append(WORD_SEPARATOR);

                if (null != cacheDataEntry.getValue().getGroup()
                        && Constants.NULL != cacheDataEntry.getValue().getGroup()) {
                    probeModifyBuilder.append(cacheDataEntry.getValue().getGroup()).append(WORD_SEPARATOR);
                }
                else {
                    probeModifyBuilder.append(WORD_SEPARATOR);
                }

                if (null != cacheDataEntry.getValue().getMd5()
                        && Constants.NULL != cacheDataEntry.getValue().getMd5()) {
                    probeModifyBuilder.append(cacheDataEntry.getValue().getMd5()).append(LINE_SEPARATOR);
                }
                else {
                    probeModifyBuilder.append(LINE_SEPARATOR);
                }
            }
        }
    }
    String probeModifyString = probeModifyBuilder.toString();
    return probeModifyString;
}
 
开发者ID:lysu,项目名称:diamond,代码行数:42,代码来源:DefaultDiamondSubscriber.java

示例3: configureHttpMethod

private void configureHttpMethod(boolean skipContentCache,
		CacheData cacheData, long onceTimeOut, HttpMethod httpMethod) {
	if (skipContentCache && null != cacheData) {
		if (null != cacheData.getLastModifiedHeader()
				&& Constants.NULL != cacheData.getLastModifiedHeader()) {
			httpMethod.addRequestHeader(Constants.IF_MODIFIED_SINCE,
					cacheData.getLastModifiedHeader());
		}
		if (null != cacheData.getMd5()
				&& Constants.NULL != cacheData.getMd5()) {
			httpMethod.addRequestHeader(Constants.CONTENT_MD5,
					cacheData.getMd5());
		}
	}
	// ����appName�Ϳͻ��˰汾
	if (null != this.appName) {
		httpMethod.addRequestHeader(Constants.APPNAME, this.appName);
	}
	httpMethod.addRequestHeader(Constants.CLIENT_VERSION_HEADER,
			Constants.CLIENT_VERSION);

	httpMethod.addRequestHeader(Constants.ACCEPT_ENCODING, "gzip,deflate");

	// ����HttpMethod�IJ���
	HttpMethodParams params = new HttpMethodParams();
	params.setSoTimeout((int) onceTimeOut);
	// ///////////////////////
	httpMethod.setParams(params);
	httpClient.getHostConfiguration().setHost(
			diamondConfigure.getDomainNameList().get(
					this.domainNamePos.get()), diamondConfigure.getPort());
}
 
开发者ID:weijiahao001,项目名称:tb_diamond,代码行数:32,代码来源:DefaultDiamondSubscriber.java

示例4: getSuccess

/**
 * 回馈的结果为RP_OK,则整个流程为:<br>
 * 1.获取配置信息,如果配置信息为空或者抛出异常,则抛出运行时异常<br>
 * 2.检测配置信息是否符合回馈结果中的MD5码,不符合,则再次获取配置信息,并记录日志<br>
 * 3.符合,则存储LastModified信息和MD5码,调整查询的间隔时间,将获取的配置信息发送给客户的监听器<br>
 */
private String getSuccess(String dataId, String group, CacheData cacheData, HttpMethod httpMethod) {
    String configInfo = Constants.NULL;
    configInfo = getContent(httpMethod);
    if (null == configInfo) {
        throw new RuntimeException("RP_OK获取了错误的配置信息");
    }

    Header md5Header = httpMethod.getResponseHeader(Constants.CONTENT_MD5);
    if (null == md5Header) {
        throw new RuntimeException("RP_OK返回的结果中没有MD5码, " + configInfo);
    }
    String md5 = md5Header.getValue();
    if (!checkContent(configInfo, md5)) {
        throw new RuntimeException("配置信息的MD5码校验出错,DataID为:[" + dataId + "]配置信息为:[" + configInfo + "]MD5为:[" + md5
                + "]");
    }

    Header lastModifiedHeader = httpMethod.getResponseHeader(Constants.LAST_MODIFIED);
    if (null == lastModifiedHeader) {
        throw new RuntimeException("RP_OK返回的结果中没有lastModifiedHeader");
    }
    String lastModified = lastModifiedHeader.getValue();

    cacheData.setMd5(md5);
    cacheData.setLastModifiedHeader(lastModified);

    changeSpacingInterval(httpMethod);

    // 设置到本地cache
    String key = makeCacheKey(dataId, group);
    contentCache.put(key, configInfo);

    // 记录接收到的数据
    StringBuilder buf = new StringBuilder();
    buf.append("dataId=").append(dataId);
    buf.append(" ,group=").append(group);
    buf.append(" ,content=").append(configInfo);
    dataLog.info(buf.toString());

    return configInfo;
}
 
开发者ID:lysu,项目名称:diamond,代码行数:47,代码来源:DefaultDiamondSubscriber.java

示例5: getSuccess

/**
 * �����Ľ��ΪRP_OK������������Ϊ��<br>
 * 1.��ȡ������Ϣ�����������ϢΪ�ջ����׳��쳣�����׳�����ʱ�쳣<br>
 * 2.���������Ϣ�Ƿ���ϻ�������е�MD5�룬�����ϣ����ٴλ�ȡ������Ϣ������¼��־<br>
 * 3.���ϣ���洢LastModified��Ϣ��MD5�룬������ѯ�ļ��ʱ�䣬����ȡ��������Ϣ���͸��ͻ��ļ�����<br>
 */
private String getSuccess(String dataId, String group, CacheData cacheData,
		HttpMethod httpMethod) {
	String configInfo = Constants.NULL;
	configInfo = getContent(httpMethod);
	if (null == configInfo) {
		throw new RuntimeException("RP_OK��ȡ�˴����������Ϣ");
	}

	Header md5Header = httpMethod.getResponseHeader(Constants.CONTENT_MD5);
	if (null == md5Header) {
		throw new RuntimeException("RP_OK���صĽ����û��MD5��, " + configInfo);
	}
	String md5 = md5Header.getValue();
	if (!checkContent(configInfo, md5)) {
		throw new RuntimeException("������Ϣ��MD5��У�����,DataIDΪ:[" + dataId
				+ "]������ϢΪ:[" + configInfo + "]MD5Ϊ:[" + md5 + "]");
	}

	Header lastModifiedHeader = httpMethod
			.getResponseHeader(Constants.LAST_MODIFIED);
	if (null == lastModifiedHeader) {
		throw new RuntimeException("RP_OK���صĽ����û��lastModifiedHeader");
	}
	String lastModified = lastModifiedHeader.getValue();

	cacheData.setMd5(md5);
	cacheData.setLastModifiedHeader(lastModified);

	changeSpacingInterval(httpMethod);

	// ���õ�����cache
	String key = makeCacheKey(dataId, group);
	contentCache.put(key, configInfo);

	// ��¼���յ�������
	StringBuilder buf = new StringBuilder();
	buf.append("dataId=").append(dataId);
	buf.append(" ,group=").append(group);
	buf.append(" ,content=").append(configInfo);
	dataLog.info(buf.toString());

	return configInfo;
}
 
开发者ID:weijiahao001,项目名称:tb_diamond,代码行数:49,代码来源:DefaultDiamondSubscriber.java

示例6: getProbeUpdateString

/**
 * ��ȡ̽����µ�DataID�������ַ���
 * 
 * @param localModifySet
 * @return
 */
private String getProbeUpdateString() {
	// ��ȡcheck��DataID:Group:MD5��
	StringBuilder probeModifyBuilder = new StringBuilder();
	for (Entry<String, ConcurrentHashMap<String, CacheData>> cacheDatasEntry : this.cache
			.entrySet()) {
		String dataId = cacheDatasEntry.getKey();
		ConcurrentHashMap<String, CacheData> cacheDatas = cacheDatasEntry
				.getValue();
		if (null == cacheDatas) {
			continue;
		}
		for (Entry<String, CacheData> cacheDataEntry : cacheDatas
				.entrySet()) {
			final CacheData data = cacheDataEntry.getValue();
			// ��ʹ�ñ������ã���ȥdiamond server���
			if (!data.isUseLocalConfigInfo()) {
				probeModifyBuilder.append(dataId).append(WORD_SEPARATOR);

				if (null != cacheDataEntry.getValue().getGroup()
						&& Constants.NULL != cacheDataEntry.getValue()
								.getGroup()) {
					probeModifyBuilder.append(
							cacheDataEntry.getValue().getGroup()).append(
							WORD_SEPARATOR);
				} else {
					probeModifyBuilder.append(WORD_SEPARATOR);
				}

				if (null != cacheDataEntry.getValue().getMd5()
						&& Constants.NULL != cacheDataEntry.getValue()
								.getMd5()) {
					probeModifyBuilder.append(
							cacheDataEntry.getValue().getMd5()).append(
							LINE_SEPARATOR);
				} else {
					probeModifyBuilder.append(LINE_SEPARATOR);
				}
			}
		}
	}
	String probeModifyString = probeModifyBuilder.toString();
	return probeModifyString;
}
 
开发者ID:weijiahao001,项目名称:tb_diamond,代码行数:49,代码来源:DefaultDiamondSubscriber.java


注:本文中的com.taobao.diamond.common.Constants.NULL属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。