本文整理汇总了Java中com.aerospike.client.AerospikeClient.queryNode方法的典型用法代码示例。如果您正苦于以下问题:Java AerospikeClient.queryNode方法的具体用法?Java AerospikeClient.queryNode怎么用?Java AerospikeClient.queryNode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.aerospike.client.AerospikeClient
的用法示例。
在下文中一共展示了AerospikeClient.queryNode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: run
import com.aerospike.client.AerospikeClient; //导入方法依赖的package包/类
public void run() {
try {
AerospikeClient client =
AerospikeClientSingleton.getInstance(new ClientPolicy(),
host, port);
log.info(String.format("queryNode %s:%d %s:%s:%s[%d:%d]",
host, port, namespace, setName,
numrangeBin, numrangeBegin,
numrangeEnd));
Statement stmt = new Statement();
stmt.setNamespace(namespace);
stmt.setSetName(setName);
stmt.setFilters(Filter.range(numrangeBin,
numrangeBegin,
numrangeEnd));
if (binNames != null)
stmt.setBinNames(binNames);
QueryPolicy queryPolicy = new QueryPolicy();
RecordSet rs = client.queryNode(queryPolicy,
stmt,
client.getNode(node));
isRunning = true;
try {
log.info("query starting");
while (rs.next()) {
Key key = rs.getKey();
Record record = rs.getRecord();
queue.put(new KeyRecPair(new AerospikeKey(key),
new AerospikeRecord(record)));
}
}
finally {
rs.close();
isFinished = true;
log.info("query finished");
}
}
catch (Exception ex) {
isError = true;
return;
}
}