Package org.apache.zookeeper

Examples of org.apache.zookeeper.KeeperException$SessionMovedException


   * @return object. it needs to be cast to the callee's expected
   *         return type.
   */
  protected Object retryOperation(ZooKeeperOperation operation) throws KeeperException,
      InterruptedException {
    KeeperException exception = null;
    for (int i = 0; i < retryCount; i++) {
      try {
        return operation.execute();
      } catch (KeeperException.SessionExpiredException e) {
        LOG.warn("Session expired for: " + zookeeper + " so reconnecting due to: " + e, e);
View Full Code Here


        this.reportsNode = prefix + '/' + this.reportsNode;
        this.assignmentsNode = prefix + '/' + this.assignmentsNode + '/' + name;
    }
   
    private void rmnod(String path) throws InterruptedException, KeeperException {
        KeeperException lastException = null;
        for(int i = 0; i < maxTries; i++) {
            try {
                zk.delete(path, -1);
                lastException = null;
                break;
View Full Code Here

            if (request.hdr != null && request.hdr.getType() == OpCode.error) {
                throw KeeperException.create(KeeperException.Code.get((
                        (ErrorTxn) request.txn).getErr()));
            }

            KeeperException ke = request.getException();
            if (ke != null) {
                throw ke;
            }

            if (LOG.isDebugEnabled()) {
View Full Code Here

     * @return object. it needs to be cast to the callee's expected
     * return type.
     */
    protected Object retryOperation(ZooKeeperOperation operation)
        throws KeeperException, InterruptedException {
        KeeperException exception = null;
        for (int i = 0; i < retryCount; i++) {
            try {
                return operation.execute();
            } catch (KeeperException.SessionExpiredException e) {
                LOG.warn("Session expired for: " + zookeeper + " so reconnecting due to: " + e, e);
View Full Code Here

                   throw e;
                }
                List<Txn> txns = new ArrayList<Txn>();
                //Each op in a multi-op must have the same zxid!
                long zxid = zks.getNextZxid();
                KeeperException ke = null;

                //Store off current pending change records in case we need to rollback
                HashMap<String, ChangeRecord> pendingChanges = getPendingChanges(multiRequest);

                int index = 0;
View Full Code Here

            if (request.hdr != null && request.hdr.getType() == OpCode.error) {
                throw KeeperException.create(KeeperException.Code.get((
                        (ErrorTxn) request.txn).getErr()));
            }

            KeeperException ke = request.getException();
            if (ke != null && request.type != OpCode.multi) {
                throw ke;
            }

            if (LOG.isDebugEnabled()) {
View Full Code Here

        if (as == null) {
            as = new HashSet<Assigned>();
            assignments.put(mostIdle, as);
        }
        as.add(a);
        KeeperException lastException = null;
        for(int i = 0; i < maxTries; i++) {
            try {
                zk.create(assignmentsNode + '/' + mostIdle + '/' + name, instanceSpec.getBytes(), Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL);
                return mostIdle;
            } catch(NodeExistsException e) {
View Full Code Here

        }
        Assigned assigned = instanceToAssignment.get(name);
        if (assigned == null) {
            throw new NoAssignmentException();
        }
        KeeperException lastException = null;
        for(int i = 0; i < maxTries; i++) {
            try {
                zk.setData(assignmentsNode + '/' + assigned.container + '/' + name, ("update " + params).getBytes(), -1);
                break;
            } catch (ConnectionLossException e) {
View Full Code Here

            throw lastException;
        }
    }
   
    private void doDelete(String path) throws InterruptedException, KeeperException {
        KeeperException lastException = null;
        for(int i = 0; i < maxTries; i++) {
            try {
                zk.delete(path, -1);
                return;
            } catch(NoNodeException e) {
View Full Code Here

    synchronized boolean isAlive(String name) {
        return instanceToAssignment.get(name) != null;
    }
   
    public void resetStatus(String name) throws InterruptedException, KeeperException {
        KeeperException lastException = null;
        for(int i = 0; i < maxTries; i++) {
            try {
                zk.delete(reportsNode + '/' + name, -1);
                lastException = null;
                break;
View Full Code Here

TOP

Related Classes of org.apache.zookeeper.KeeperException$SessionMovedException

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.