首页  

aerospike使用异步接口     所属分类 aerospike 浏览量 72
final EventLoops eventLoops = new NioEventLoops(new EventPolicy(),3);
ClientPolicy cp = new ClientPolicy();
cp.eventLoops = eventLoops;
cp.maxConnsPerNode = maxConnsPerNode;
Host host = new Host("127.0.0.1", 3000);		
IAerospikeClient client = new AerospikeClient(cp, host);

cp.eventLoops = eventLoops;
指定 eventLoops
		
client.get(AsClientUtil.nextEventLoop(), new RecordListenerImpl(), new QueryPolicy(), k);


private static class RecordListenerImpl implements RecordListener {
    public void onSuccess(Key key, Record record) {
        System.out.println("onSuccess,key=" + key + ",record=" + record);
    }
    public void onFailure(AerospikeException exception) {
        System.out.println("onFailure," + exception);
    }
}


完整代码 https://gitee.com/dyyx/asdemo/blob/master/src/main/java/demo/SyncAndAsyncTest.java

上一篇     下一篇
美术英语词汇

素描入门

投资大师的投资心理学

Java函数式与非函数式写法性能对比

马拉松注意事项

Collectors groupingBy 用法及性能