NorbertCS 模式的集群的 Java API
norbert是一个方便做CS模式的集群的JAVA API,norbert封装了zookeeper和netty,使用了协议栈缓存,基于SCALA开发
示例代码:
public class NorbertClient {
public static void main(String[] args) {
ClusterClient cc = new ZooKeeperClusterClient("norbert", "localhost:2181", 30000); (1)
cc.awaiteConnectionUninterruptibly(); (2)
cc.getNodes(); (3)
cc.addListener(new MyClusterListener()); (4)
cc.markNodeAvailable(1); (5).
cluster.shutdown(6)
}
}
评论