use of com.bonree.brfs.duplication.storagename.StorageNameManager in project BRFS by zhangnianli.
the class Test method main.
public static void main(String[] args) throws Exception {
RetryPolicy retryPolicy = new ExponentialBackoffRetry(1000, 3);
CuratorFramework client = CuratorFrameworkFactory.newClient(zk_address, retryPolicy);
client.start();
client.blockUntilConnected();
StorageNameManager snm = new DefaultStorageNameManager(client.usingNamespace("test"));
snm.start();
ZookeeperFileCoordinator coordinator = new ZookeeperFileCoordinator(client.usingNamespace("test"), null);
coordinator.start();
Thread.sleep(3000);
FileNode node = new FileNode();
node.setName("file_node_1");
node.setStorageName("sn_1");
node.setServiceId("me");
node.setDuplicates(new int[] { 1, 2, 3 });
System.out.println("publish---" + coordinator.publish(node));
synchronized (client) {
client.wait();
}
}
Aggregations