Package org.apache.zookeeper

Examples of org.apache.zookeeper.CreateMode


                ChangeRecord parentRecord = getRecordForPath(parentPath);

                checkACL(zks, parentRecord.acl, ZooDefs.Perms.CREATE,
                        request.authInfo);
                int parentCVersion = parentRecord.stat.getCversion();
                CreateMode createMode = CreateMode.fromFlag(createRequest.getFlags());
                if (createMode.isSequential()) {
                    path = path + String.format("%010d", parentCVersion);
                }
                try {
                    if (getRecordForPath(path) != null) {
                        throw new KeeperException.NodeExistsException();
                    }
                } catch (KeeperException.NoNodeException e) {
                    // ignore this one
                }
                boolean ephemeralParent = parentRecord.stat.getEphemeralOwner() != 0;
                if (ephemeralParent) {
                    throw new KeeperException.NoChildrenForEphemeralsException();
                }
                txn = new CreateTxn(path, createRequest.getData(),
                        createRequest.getAcl(),
                        createMode.isEphemeral());
                StatPersisted s = new StatPersisted();
                if (createMode.isEphemeral()) {
                    s.setEphemeralOwner(request.sessionId);
                }
                parentRecord = parentRecord.duplicate(txnHeader.getZxid());
                parentRecord.childCount++;
                parentRecord.stat
View Full Code Here


                ChangeRecord parentRecord = getRecordForPath(parentPath);

                checkACL(zks, parentRecord.acl, ZooDefs.Perms.CREATE,
                        request.authInfo);
                int parentCVersion = parentRecord.stat.getCversion();
                CreateMode createMode =
                    CreateMode.fromFlag(createRequest.getFlags());
                if (createMode.isSequential()) {
                    path = path + String.format("%010d", parentCVersion);
                }
                try {
                    PathUtils.validatePath(path);
                } catch(IllegalArgumentException ie) {
                    LOG.warn("Invalid path " + path + " with session " +
                            Long.toHexString(request.sessionId));
                    throw new KeeperException.BadArgumentsException();
                }
                try {
                    if (getRecordForPath(path) != null) {
                        throw new KeeperException.NodeExistsException();
                    }
                } catch (KeeperException.NoNodeException e) {
                    // ignore this one
                }
                boolean ephemeralParent = parentRecord.stat.getEphemeralOwner() != 0;
                if (ephemeralParent) {
                    throw new KeeperException.NoChildrenForEphemeralsException();
                }
                txn = new CreateTxn(path, createRequest.getData(),
                        createRequest.getAcl(),
                        createMode.isEphemeral());
                StatPersisted s = new StatPersisted();
                if (createMode.isEphemeral()) {
                    s.setEphemeralOwner(request.sessionId);
                }
                parentRecord = parentRecord.duplicate(txnHeader.getZxid());
                parentRecord.childCount++;
                parentRecord.stat
View Full Code Here

  /**
   * sync create
   */
  public RetCode create(String path, T record, List<String> pathCreated, int options)
  {
    CreateMode mode = AccessOption.getMode(options);
    if (mode == null)
    {
      LOG.error("Invalid create mode. options: " + options);
      return RetCode.ERROR;
    }
View Full Code Here

                     List<String> pathsCreated,
                     Stat setstat,
                     int expectVersion,
                     int options)
  {
    CreateMode mode = AccessOption.getMode(options);
    if (mode == null)
    {
      LOG.error("Invalid set mode. options: " + options);
      return false;
    }
View Full Code Here

                  DataUpdater<T> updater,
                  List<String> createPaths,
                  Stat stat,
                  int options)
  {
    CreateMode mode = AccessOption.getMode(options);
    if (mode == null)
    {
      LOG.error("Invalid update mode. options: " + options);
      return null;
    }
View Full Code Here

      throw new IllegalArgumentException("paths, records, needCreate, and pathsCreated should be of same size");
    }

    CreateCallbackHandler[] cbList = new CreateCallbackHandler[paths.size()];

    CreateMode mode = AccessOption.getMode(options);
    if (mode == null)
    {
      LOG.error("Invalid async set mode. options: " + options);
      return cbList;
    }
View Full Code Here

  @Override
  public boolean[] createChildren(List<String> paths, List<T> records, int options)
  {
    boolean[] success = new boolean[paths.size()];

    CreateMode mode = AccessOption.getMode(options);
    if (mode == null)
    {
      LOG.error("Invalid async create mode. options: " + options);
      return success;
    }
View Full Code Here

      throw new IllegalArgumentException("paths, records, and pathsCreated should be of same size");
    }

    boolean[] success = new boolean[paths.size()];

    CreateMode mode = AccessOption.getMode(options);
    if (mode == null)
    {
      LOG.error("Invalid async set mode. options: " + options);
      return success;
    }
View Full Code Here

    List<Stat> setStats =
        new ArrayList<Stat>(Collections.<Stat> nCopies(paths.size(), null));
    List<T> updateData = new ArrayList<T>(Collections.<T> nCopies(paths.size(), null));

    CreateMode mode = AccessOption.getMode(options);
    if (mode == null)
    {
      LOG.error("Invalid update mode. options: " + options);
      return updateData;
    }
View Full Code Here

          };
          client.updateDataSerialized(path, updater);
        }
        else
        {
          CreateMode mode = (persistent) ? CreateMode.PERSISTENT : CreateMode.EPHEMERAL;
          if (record.getDeltaList().size() > 0)
          {
            ZNRecord value = new ZNRecord(record.getId());
            value.merge(record);
            client.create(path, value, mode);
View Full Code Here

TOP

Related Classes of org.apache.zookeeper.CreateMode

Copyright © 2018 www.massapicom. 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.