接着上一篇,将分析测试程序中的访问接口部分。
2调用ZooKeeper访问接口
初始化和启动分析完了,操作接口调用代码如下:
String path = ZKPaths.makePath(PATH, name);
byte[] bytes =args[1].getBytes();
try
{
client.setData().forPath(path,bytes);
}...
分类:
其他好文 时间:
2015-01-05 00:38:17
阅读次数:
212
上一篇文章这里已经列出了Curator的一个使用的例子,这篇文章将详细分析其初始化和启动部分。
测试程序分析
1 初始化和启动
(1) newClient方法返回CuratorFramework接口对象:
public
staticCuratorFramework newClient(String connectString, int sessionTimeou...
分类:
其他好文 时间:
2015-01-05 00:37:59
阅读次数:
334
相信很多人都知道这个函数,也都用过,但可能很多人跟我过去一样,认为它是赋初值函数,而不知它赋初值是八位八位进行的,知道了这句话那你之后的就都懂了。
首先它是在头文件string.h中,这说明了什么呢,他操作的是字符类型,而字符类型有几位呢,那就是八位,所以它就是按八位来赋初值的。之所以我们平时可以用
int array[100];
memset(array,0,sizrof(array));...
分类:
其他好文 时间:
2015-01-05 00:36:41
阅读次数:
144
输入多个字符串,分别提取出里面的数字,排序输出所有的数字。
#include
#include
#include
#include
#include
using namespace std;
vectorvec;
int main(int argc, char *argv[])
{
int n;
string s;
while(cin>>n)
{...
分类:
编程语言 时间:
2015-01-05 00:36:07
阅读次数:
206
输入一个字符串,输出出现次数最少,或者说出现频率最小的字符。
#include
#include
#include
#include
#include
using namespace std;
int main(int argc, char *argv[])
{
string s;
cin>>s;
mapm;
for(string::size_type i=0...
分类:
其他好文 时间:
2015-01-05 00:34:23
阅读次数:
174
#include
#include
using namespace std;
//逆序
string revs(string s){
int j = s.length()-1;
int i=0;
char t;
while(i<j){
t = s[i];
s[i++]=s[j];
s[j--]=t;
}
return s;
}
//个位乘积
int chen(...
分类:
其他好文 时间:
2015-01-05 00:33:40
阅读次数:
255
Given a digit string, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the telephon...
分类:
其他好文 时间:
2015-01-05 00:30:36
阅读次数:
186
1 '', 'lbi'=>'', 'dat'=>'') 50 * @return string 全部可写返回空串,否则返回以逗号分隔的文件类型组成的消息串 51 */ 52 function file_types_exists($file_types) 53 { 54 ...
分类:
Web程序 时间:
2015-01-05 00:28:04
阅读次数:
325
string[] arrStr = { ".com", "www.baidu.com", "www.qq.com", "www.bing.cn", "www.avc.net","www.vvv.cn","www.bbb.net" }; //定义查询规则var addressG = from gg i...
分类:
其他好文 时间:
2015-01-05 00:26:21
阅读次数:
123
//表示清空 txtStreamWriter sw = new StreamWriter("D:\\1.txt"); string w = ""; sw.Write(w); sw.Close();//表示向txt写入文本StreamW...