Search in sources :

Example 1 with DefaultStorageNameManager

use of com.bonree.brfs.duplication.storagename.DefaultStorageNameManager 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();
    }
}
Also used : CuratorFramework(org.apache.curator.framework.CuratorFramework) ExponentialBackoffRetry(org.apache.curator.retry.ExponentialBackoffRetry) StorageNameManager(com.bonree.brfs.duplication.storagename.StorageNameManager) DefaultStorageNameManager(com.bonree.brfs.duplication.storagename.DefaultStorageNameManager) DefaultStorageNameManager(com.bonree.brfs.duplication.storagename.DefaultStorageNameManager) RetryPolicy(org.apache.curator.RetryPolicy) ZookeeperFileCoordinator(com.bonree.brfs.duplication.coordinator.zk.ZookeeperFileCoordinator)

Aggregations

ZookeeperFileCoordinator (com.bonree.brfs.duplication.coordinator.zk.ZookeeperFileCoordinator)1 DefaultStorageNameManager (com.bonree.brfs.duplication.storagename.DefaultStorageNameManager)1 StorageNameManager (com.bonree.brfs.duplication.storagename.StorageNameManager)1 RetryPolicy (org.apache.curator.RetryPolicy)1 CuratorFramework (org.apache.curator.framework.CuratorFramework)1 ExponentialBackoffRetry (org.apache.curator.retry.ExponentialBackoffRetry)1