Package org.apache.zookeeper

Examples of org.apache.zookeeper.ZooKeeper.create()


      }
    }

    while (true) {
      try {
        zk.create(aclZnode, null, ZooDefs.Ids.CREATOR_ALL_ACL, CreateMode.PERSISTENT);
        break;
      } catch (KeeperException e) {
        switch (e.code()) {
          case CONNECTIONLOSS:
          case SESSIONEXPIRED:
View Full Code Here


    @Test
    public void testInvalidSnapshot() throws Exception {
        ZooKeeper zk = createClient();
        try {
            for (int i = 0; i < 2000; i++) {
                zk.create("/invalidsnap-" + i, new byte[0],
                        Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
            }
        } finally {
            zk.close();
        }
View Full Code Here

        final ZooKeeper zk3 =
            createClient(qu.getPeer(3).peer.getClientPort(), watcher3);
        LOG.info("zk3 has session id 0x" + Long.toHexString(zk3.getSessionId()));

        zk3.create("/mybar", null, ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL_SEQUENTIAL);

        qu.restart(index);
        final ZooKeeper zk1 =
            createClient(qu.getPeer(index).peer.getClientPort(), watcher1);
        LOG.info("zk1 has session id 0x" + Long.toHexString(zk1.getSessionId()));
View Full Code Here

            if((i % 1000) == 0){
                Thread.sleep(1000);
            }

            if(i%50 == 0) {
                zk2.create("/newbaz", null, ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL_SEQUENTIAL, new AsyncCallback.StringCallback() {
                    @Override
                    public void processResult(int rc, String path, Object ctx, String name) {
                        counter++;
                        if (rc != 0) {
                            errors++;
View Full Code Here

            @Override
            public void run() {                               
                int inSyncCounter = 0;
                while(inSyncCounter < 400) {   
                    if(runNow.get()) {
                        zk3.create("/mytestfoo", null, ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL_SEQUENTIAL, new AsyncCallback.StringCallback() {

                            @Override
                            public void processResult(int rc, String path, Object ctx, String name) {
                                counter++;
                                if (rc != 0) {
View Full Code Here

                qu.restart(index);
                LOG.info("Setting up server: " + index);
            }
       
            if(i>=1000 &&  i%2== 0) {
                zk3.create("/newbaz", null, ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL_SEQUENTIAL, new AsyncCallback.StringCallback() {

                    @Override
                    public void processResult(int rc, String path, Object ctx, String name) {
                        counter++;
                        if (rc != 0) {
View Full Code Here

        "testMasterAddressManagerFromZK",
        null);

    // I set this acl after the attempted creation of the cluster home node.
    zk.setACL("/", ZooDefs.Ids.CREATOR_ALL_ACL, -1);
    zk.create(aclZnode, null, ZooDefs.Ids.CREATOR_ALL_ACL, CreateMode.PERSISTENT);
    zk.close();

    ZKUtil.createAndFailSilent(zk2, aclZnode);
}
 
View Full Code Here

                    String path = Util.getZooKeeperPath(name);
                    String fullPath = path + '/' + endpointKey;
                    LOG.info("Creating ZooKeeper node: " + fullPath);

                    ensurePath(path, zk);
                    zk.create(fullPath, getData(endpoint), Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL);
                }

                endpoints.add(endpoint);
            } catch (Exception ex) {
                LOG.log(Level.SEVERE, "Exception while processing the addition of a ServicePublication.", ex);
View Full Code Here

        EasyMock.expect(zkd.getZookeeper()).andReturn(zk).anyTimes();

       
        String path = "/osgi/service_registry/myClass/google.de#80##test";
        EasyMock.expect(
                        zk.create(EasyMock.eq(path),
                                  (byte[])EasyMock.anyObject(), EasyMock.eq(Ids.OPEN_ACL_UNSAFE), EasyMock
                                      .eq(CreateMode.EPHEMERAL))).andReturn("").once();
       
        zk.delete(EasyMock.eq("/osgi/service_registry/myClass/google.de#80##test"), EasyMock.eq(-1));
        EasyMock.expectLastCall().once();
View Full Code Here

        EasyMock.expect(zkd.getZookeeper()).andReturn(zk).anyTimes();

       
        String path = "/osgi/service_registry/myClass/google.de#80##test";
        EasyMock.expect(
                        zk.create(EasyMock.eq(path),
                                  (byte[])EasyMock.anyObject(), EasyMock.eq(Ids.OPEN_ACL_UNSAFE), EasyMock
                                      .eq(CreateMode.EPHEMERAL))).andReturn("").once();
       
        zk.delete(EasyMock.eq("/osgi/service_registry/myClass/google.de#80##test"), EasyMock.eq(-1));
        EasyMock.expectLastCall().once();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.