Java 类org.apache.zookeeper.MultiTransactionRecord 实例源码

项目:bigstreams    文件:PrepRequestProcessor.java   
/**
 * Grab current pending change records for each op in a multi-op.
 * 
 * This is used inside MultiOp error code path to rollback in the event
 * of a failed multi-op.
 *
 * @param multiRequest
 */
HashMap<String, ChangeRecord> getPendingChanges(MultiTransactionRecord multiRequest) {
    HashMap<String, ChangeRecord> pendingChangeRecords = new HashMap<String, ChangeRecord>();

    for(Op op: multiRequest) {
        String path = op.getPath();

        try {
            ChangeRecord cr = getRecordForPath(path);
            if (cr != null) {
                pendingChangeRecords.put(path, cr);
            }
        } catch (KeeperException.NoNodeException e) {
            // ignore this one
        }
    }

    return pendingChangeRecords;
}
项目:zookeeper-src-learning    文件:PrepRequestProcessor.java   
/**
 * Grab current pending change records for each op in a multi-op.
 * 
 * This is used inside MultiOp error code path to rollback in the event
 * of a failed multi-op.
 *
 * @param multiRequest
 */
HashMap<String, ChangeRecord> getPendingChanges(MultiTransactionRecord multiRequest) {
    HashMap<String, ChangeRecord> pendingChangeRecords = new HashMap<String, ChangeRecord>();

    for(Op op: multiRequest) {
        String path = op.getPath();

        try {
            ChangeRecord cr = getRecordForPath(path);
            if (cr != null) {
                pendingChangeRecords.put(path, cr);
            }
        } catch (KeeperException.NoNodeException e) {
            // ignore this one
        }
    }

    return pendingChangeRecords;
}
项目:ACaZoo    文件:PrepRequestProcessor.java   
/**
 * Grab current pending change records for each op in a multi-op.
 * 
 * This is used inside MultiOp error code path to rollback in the event
 * of a failed multi-op.
 *
 * @param multiRequest
 */
HashMap<String, ChangeRecord> getPendingChanges(MultiTransactionRecord multiRequest) {
    HashMap<String, ChangeRecord> pendingChangeRecords = new HashMap<String, ChangeRecord>();

    for(Op op: multiRequest) {
        String path = op.getPath();

        try {
            ChangeRecord cr = getRecordForPath(path);
            if (cr != null) {
                pendingChangeRecords.put(path, cr);
            }
        } catch (KeeperException.NoNodeException e) {
            // ignore this one
        }
    }

    return pendingChangeRecords;
}
项目:LoadBalanced_zk    文件:PrepRequestProcessor.java   
/**
 * Grab current pending change records for each op in a multi-op.
 * 
 * This is used inside MultiOp error code path to rollback in the event
 * of a failed multi-op.
 *
 * @param multiRequest
 */
HashMap<String, ChangeRecord> getPendingChanges(MultiTransactionRecord multiRequest) {
    HashMap<String, ChangeRecord> pendingChangeRecords = new HashMap<String, ChangeRecord>();

    for(Op op: multiRequest) {
        String path = op.getPath();

        try {
            ChangeRecord cr = getRecordForPath(path);
            if (cr != null) {
                pendingChangeRecords.put(path, cr);
            }
        } catch (KeeperException.NoNodeException e) {
            // ignore this one
        }
    }

    return pendingChangeRecords;
}
项目:LoadBalanced_zk    文件:PrepRequestProcessor.java   
/**
 * Grab current pending change records for each op in a multi-op.
 * 
 * This is used inside MultiOp error code path to rollback in the event
 * of a failed multi-op.
 *
 * @param multiRequest
 */
HashMap<String, ChangeRecord> getPendingChanges(MultiTransactionRecord multiRequest) {
    HashMap<String, ChangeRecord> pendingChangeRecords = new HashMap<String, ChangeRecord>();

    for(Op op: multiRequest) {
        String path = op.getPath();

        try {
            ChangeRecord cr = getRecordForPath(path);
            if (cr != null) {
                pendingChangeRecords.put(path, cr);
            }
        } catch (KeeperException.NoNodeException e) {
            // ignore this one
        }
    }

    return pendingChangeRecords;
}
项目:zookeeper-pkg    文件:PrepRequestProcessor.java   
/**
 * Grab current pending change records for each op in a multi-op.
 * 
 * This is used inside MultiOp error code path to rollback in the event
 * of a failed multi-op.
 *
 * @param multiRequest
 */
HashMap<String, ChangeRecord> getPendingChanges(MultiTransactionRecord multiRequest) {
    HashMap<String, ChangeRecord> pendingChangeRecords = new HashMap<String, ChangeRecord>();

    for(Op op: multiRequest) {
        String path = op.getPath();

        try {
            ChangeRecord cr = getRecordForPath(path);
            if (cr != null) {
                pendingChangeRecords.put(path, cr);
            }
        } catch (KeeperException.NoNodeException e) {
            // ignore this one
        }
    }

    return pendingChangeRecords;
}
项目:fuck_zookeeper    文件:PrepRequestProcessor.java   
/**
 * Grab current pending change records for each op in a multi-op.
 * 
 * This is used inside MultiOp error code path to rollback in the event
 * of a failed multi-op.
 *
 * @param multiRequest
 * @return a map that contains previously existed records that probably need to be
 *         rolled back in any failure.
 */
HashMap<String, ChangeRecord> getPendingChanges(MultiTransactionRecord multiRequest) {
    HashMap<String, ChangeRecord> pendingChangeRecords = new HashMap<String, ChangeRecord>();

    for (Op op : multiRequest) {
        String path = op.getPath();
        ChangeRecord cr = getOutstandingChange(path);
        // only previously existing records need to be rolled back.
        if (cr != null) {
            pendingChangeRecords.put(path, cr);
        }

        /*
         * ZOOKEEPER-1624 - We need to store for parent's ChangeRecord
         * of the parent node of a request. So that if this is a
         * sequential node creation request, rollbackPendingChanges()
         * can restore previous parent's ChangeRecord correctly.
         *
         * Otherwise, sequential node name generation will be incorrect
         * for a subsequent request.
         */
        int lastSlash = path.lastIndexOf('/');
        if (lastSlash == -1 || path.indexOf('\0') != -1) {
            continue;
        }
        String parentPath = path.substring(0, lastSlash);
        ChangeRecord parentCr = getOutstandingChange(parentPath);
        if (parentCr != null) {
            pendingChangeRecords.put(parentPath, parentCr);
        }
    }

    return pendingChangeRecords;
}
项目:fuck_zookeeper    文件:PrepRequestProcessorTest.java   
private void process(List<Op> ops) throws Exception {
    pLatch = new CountDownLatch(1);
    processor = new PrepRequestProcessor(zks, new MyRequestProcessor());

    Record record = new MultiTransactionRecord(ops);
    Request req = createRequest(record, OpCode.multi);

    processor.pRequest(req);
    Assert.assertTrue("request hasn't been processed in chain", pLatch.await(5, TimeUnit.SECONDS));
}
项目:https-github.com-apache-zookeeper    文件:PrepRequestProcessor.java   
/**
 * Grab current pending change records for each op in a multi-op.
 *
 * This is used inside MultiOp error code path to rollback in the event
 * of a failed multi-op.
 *
 * @param multiRequest
 * @return a map that contains previously existed records that probably need to be
 *         rolled back in any failure.
 */
private Map<String, ChangeRecord> getPendingChanges(MultiTransactionRecord multiRequest) {
    Map<String, ChangeRecord> pendingChangeRecords = new HashMap<String, ChangeRecord>();

    for (Op op : multiRequest) {
        String path = op.getPath();
        ChangeRecord cr = getOutstandingChange(path);
        // only previously existing records need to be rolled back.
        if (cr != null) {
            pendingChangeRecords.put(path, cr);
        }

        /*
         * ZOOKEEPER-1624 - We need to store for parent's ChangeRecord
         * of the parent node of a request. So that if this is a
         * sequential node creation request, rollbackPendingChanges()
         * can restore previous parent's ChangeRecord correctly.
         *
         * Otherwise, sequential node name generation will be incorrect
         * for a subsequent request.
         */
        int lastSlash = path.lastIndexOf('/');
        if (lastSlash == -1 || path.indexOf('\0') != -1) {
            continue;
        }
        String parentPath = path.substring(0, lastSlash);
        ChangeRecord parentCr = getOutstandingChange(parentPath);
        if (parentCr != null) {
            pendingChangeRecords.put(parentPath, parentCr);
        }
    }

    return pendingChangeRecords;
}
项目:https-github.com-apache-zookeeper    文件:PrepRequestProcessorTest.java   
private void process(List<Op> ops) throws Exception {
    pLatch = new CountDownLatch(1);
    processor = new PrepRequestProcessor(zks, new MyRequestProcessor());

    Record record = new MultiTransactionRecord(ops);
    Request req = createRequest(record, OpCode.multi);

    processor.pRequest(req);
    Assert.assertTrue("request hasn't been processed in chain", pLatch.await(5, TimeUnit.SECONDS));
}
项目:ZooKeeper    文件:PrepRequestProcessor.java   
/**
 * Grab current pending change records for each op in a multi-op.
 * 
 * This is used inside MultiOp error code path to rollback in the event
 * of a failed multi-op.
 *
 * @param multiRequest
 * @return a map that contains previously existed records that probably need to be
 *         rolled back in any failure.
 */
HashMap<String, ChangeRecord> getPendingChanges(MultiTransactionRecord multiRequest) {
    HashMap<String, ChangeRecord> pendingChangeRecords = new HashMap<String, ChangeRecord>();

    for (Op op : multiRequest) {
        String path = op.getPath();
        ChangeRecord cr = getOutstandingChange(path);
        // only previously existing records need to be rolled back.
        if (cr != null) {
            pendingChangeRecords.put(path, cr);
        }

        /*
         * ZOOKEEPER-1624 - We need to store for parent's ChangeRecord
         * of the parent node of a request. So that if this is a
         * sequential node creation request, rollbackPendingChanges()
         * can restore previous parent's ChangeRecord correctly.
         *
         * Otherwise, sequential node name generation will be incorrect
         * for a subsequent request.
         */
        int lastSlash = path.lastIndexOf('/');
        if (lastSlash == -1 || path.indexOf('\0') != -1) {
            continue;
        }
        String parentPath = path.substring(0, lastSlash);
        ChangeRecord parentCr = getOutstandingChange(parentPath);
        if (parentCr != null) {
            pendingChangeRecords.put(parentPath, parentCr);
        }
    }

    return pendingChangeRecords;
}
项目:ZooKeeper    文件:PrepRequestProcessorTest.java   
private void process(List<Op> ops) throws Exception {
    pLatch = new CountDownLatch(1);
    processor = new PrepRequestProcessor(zks, new MyRequestProcessor());

    Record record = new MultiTransactionRecord(ops);
    Request req = createRequest(record, OpCode.multi);

    processor.pRequest(req);
    Assert.assertTrue("request hasn't been processed in chain", pLatch.await(5, TimeUnit.SECONDS));
}
项目:StreamProcessingInfrastructure    文件:PrepRequestProcessor.java   
/**
 * Grab current pending change records for each op in a multi-op.
 * 
 * This is used inside MultiOp error code path to rollback in the event
 * of a failed multi-op.
 *
 * @param multiRequest
 * @return a map that contains previously existed records that probably need to be
 *         rolled back in any failure.
 */
HashMap<String, ChangeRecord> getPendingChanges(MultiTransactionRecord multiRequest) {
    HashMap<String, ChangeRecord> pendingChangeRecords = new HashMap<String, ChangeRecord>();

    for (Op op : multiRequest) {
        String path = op.getPath();
        ChangeRecord cr = getOutstandingChange(path);
        // only previously existing records need to be rolled back.
        if (cr != null) {
            pendingChangeRecords.put(path, cr);
        }

        /*
         * ZOOKEEPER-1624 - We need to store for parent's ChangeRecord
         * of the parent node of a request. So that if this is a
         * sequential node creation request, rollbackPendingChanges()
         * can restore previous parent's ChangeRecord correctly.
         *
         * Otherwise, sequential node name generation will be incorrect
         * for a subsequent request.
         */
        int lastSlash = path.lastIndexOf('/');
        if (lastSlash == -1 || path.indexOf('\0') != -1) {
            continue;
        }
        String parentPath = path.substring(0, lastSlash);
        ChangeRecord parentCr = getOutstandingChange(parentPath);
        if (parentCr != null) {
            pendingChangeRecords.put(parentPath, parentCr);
        }
    }

    return pendingChangeRecords;
}
项目:StreamProcessingInfrastructure    文件:PrepRequestProcessorTest.java   
private void process(List<Op> ops) throws Exception {
    pLatch = new CountDownLatch(1);
    processor = new PrepRequestProcessor(zks, new MyRequestProcessor());

    Record record = new MultiTransactionRecord(ops);
    Request req = createRequest(record, OpCode.multi);

    processor.pRequest(req);
    Assert.assertTrue("request hasn't been processed in chain", pLatch.await(5, TimeUnit.SECONDS));
}
项目:zookeeper    文件:PrepRequestProcessor.java   
/**
 * Grab current pending change records for each op in a multi-op.
 * 
 * This is used inside MultiOp error code path to rollback in the event
 * of a failed multi-op.
 *
 * @param multiRequest
 * @return a map that contains previously existed records that probably need to be
 *         rolled back in any failure.
 */
HashMap<String, ChangeRecord> getPendingChanges(MultiTransactionRecord multiRequest) {
    HashMap<String, ChangeRecord> pendingChangeRecords = new HashMap<String, ChangeRecord>();

    for (Op op : multiRequest) {
        String path = op.getPath();
        ChangeRecord cr = getOutstandingChange(path);
        // only previously existing records need to be rolled back.
        if (cr != null) {
            pendingChangeRecords.put(path, cr);
        }

        /*
         * ZOOKEEPER-1624 - We need to store for parent's ChangeRecord
         * of the parent node of a request. So that if this is a
         * sequential node creation request, rollbackPendingChanges()
         * can restore previous parent's ChangeRecord correctly.
         *
         * Otherwise, sequential node name generation will be incorrect
         * for a subsequent request.
         */
        int lastSlash = path.lastIndexOf('/');
        if (lastSlash == -1 || path.indexOf('\0') != -1) {
            continue;
        }
        String parentPath = path.substring(0, lastSlash);
        ChangeRecord parentCr = getOutstandingChange(parentPath);
        if (parentCr != null) {
            pendingChangeRecords.put(parentPath, parentCr);
        }
    }

    return pendingChangeRecords;
}
项目:zookeeper    文件:PrepRequestProcessorTest.java   
private void process(List<Op> ops) throws Exception {
    pLatch = new CountDownLatch(1);
    processor = new PrepRequestProcessor(zks, new MyRequestProcessor());

    Record record = new MultiTransactionRecord(ops);
    Request req = createRequest(record, OpCode.multi);

    processor.pRequest(req);
    Assert.assertTrue("request hasn't been processed in chain", pLatch.await(5, TimeUnit.SECONDS));
}
项目:SecureKeeper    文件:PrepRequestProcessor.java   
/**
 * Grab current pending change records for each op in a multi-op.
 *
 * This is used inside MultiOp error code path to rollback in the event
 * of a failed multi-op.
 *
 * @param multiRequest
 * @return a map that contains previously existed records that probably need to be
 *         rolled back in any failure.
 */
private Map<String, ChangeRecord> getPendingChanges(MultiTransactionRecord multiRequest) {
    HashMap<String, ChangeRecord> pendingChangeRecords = new HashMap<String, ChangeRecord>();

    for (Op op : multiRequest) {
        String path = op.getPath();
        ChangeRecord cr = getOutstandingChange(path);
        // only previously existing records need to be rolled back.
        if (cr != null) {
            pendingChangeRecords.put(path, cr);
        }

        /*
         * ZOOKEEPER-1624 - We need to store for parent's ChangeRecord
         * of the parent node of a request. So that if this is a
         * sequential node creation request, rollbackPendingChanges()
         * can restore previous parent's ChangeRecord correctly.
         *
         * Otherwise, sequential node name generation will be incorrect
         * for a subsequent request.
         */
        int lastSlash = path.lastIndexOf('/');
        if (lastSlash == -1 || path.indexOf('\0') != -1) {
            continue;
        }
        String parentPath = path.substring(0, lastSlash);
        ChangeRecord parentCr = getOutstandingChange(parentPath);
        if (parentCr != null) {
            pendingChangeRecords.put(parentPath, parentCr);
        }
    }

    return pendingChangeRecords;
}
项目:SecureKeeper    文件:PrepRequestProcessorTest.java   
private void process(List<Op> ops) throws Exception {
    pLatch = new CountDownLatch(1);
    processor = new PrepRequestProcessor(zks, new MyRequestProcessor());

    Record record = new MultiTransactionRecord(ops);
    Request req = createRequest(record, OpCode.multi);

    processor.pRequest(req);
    Assert.assertTrue("request hasn't been processed in chain", pLatch.await(5, TimeUnit.SECONDS));
}
项目:SecureKeeper    文件:PrepRequestProcessor.java   
/**
 * Grab current pending change records for each op in a multi-op.
 *
 * This is used inside MultiOp error code path to rollback in the event
 * of a failed multi-op.
 *
 * @param multiRequest
 * @return a map that contains previously existed records that probably need to be
 *         rolled back in any failure.
 */
private Map<String, ChangeRecord> getPendingChanges(MultiTransactionRecord multiRequest) {
    HashMap<String, ChangeRecord> pendingChangeRecords = new HashMap<String, ChangeRecord>();

    for (Op op : multiRequest) {
        String path = op.getPath();
        ChangeRecord cr = getOutstandingChange(path);
        // only previously existing records need to be rolled back.
        if (cr != null) {
            pendingChangeRecords.put(path, cr);
        }

        /*
         * ZOOKEEPER-1624 - We need to store for parent's ChangeRecord
         * of the parent node of a request. So that if this is a
         * sequential node creation request, rollbackPendingChanges()
         * can restore previous parent's ChangeRecord correctly.
         *
         * Otherwise, sequential node name generation will be incorrect
         * for a subsequent request.
         */
        int lastSlash = path.lastIndexOf('/');
        if (lastSlash == -1 || path.indexOf('\0') != -1) {
            continue;
        }
        String parentPath = path.substring(0, lastSlash);
        ChangeRecord parentCr = getOutstandingChange(parentPath);
        if (parentCr != null) {
            pendingChangeRecords.put(parentPath, parentCr);
        }
    }

    return pendingChangeRecords;
}
项目:SecureKeeper    文件:PrepRequestProcessorTest.java   
private void process(List<Op> ops) throws Exception {
    pLatch = new CountDownLatch(1);
    processor = new PrepRequestProcessor(zks, new MyRequestProcessor());

    Record record = new MultiTransactionRecord(ops);
    Request req = createRequest(record, OpCode.multi);

    processor.pRequest(req);
    Assert.assertTrue("request hasn't been processed in chain", pLatch.await(5, TimeUnit.SECONDS));
}
项目:StreamBench    文件:PrepRequestProcessor.java   
/**
 * Grab current pending change records for each op in a multi-op.
 * 
 * This is used inside MultiOp error code path to rollback in the event
 * of a failed multi-op.
 *
 * @param multiRequest
 */
HashMap<String, ChangeRecord> getPendingChanges(MultiTransactionRecord multiRequest) {
    HashMap<String, ChangeRecord> pendingChangeRecords = new HashMap<String, ChangeRecord>();

    for(Op op: multiRequest) {
        String path = op.getPath();

        try {
            ChangeRecord cr = getRecordForPath(path);
            if (cr != null) {
                pendingChangeRecords.put(path, cr);
            }
            /*
             * ZOOKEEPER-1624 - We need to store for parent's ChangeRecord
             * of the parent node of a request. So that if this is a
             * sequential node creation request, rollbackPendingChanges()
             * can restore previous parent's ChangeRecord correctly.
             *
             * Otherwise, sequential node name generation will be incorrect
             * for a subsequent request.
             */
            int lastSlash = path.lastIndexOf('/');
            if (lastSlash == -1 || path.indexOf('\0') != -1) {
                continue;
            }
            String parentPath = path.substring(0, lastSlash);
            ChangeRecord parentCr = getRecordForPath(parentPath);
            if (parentCr != null) {
                pendingChangeRecords.put(parentPath, parentCr);
            }
        } catch (KeeperException.NoNodeException e) {
            // ignore this one
        }
    }

    return pendingChangeRecords;
}