当前位置: 首页>>代码示例>>Java>>正文


Java Op.getPath方法代码示例

本文整理汇总了Java中org.apache.zookeeper.Op.getPath方法的典型用法代码示例。如果您正苦于以下问题:Java Op.getPath方法的具体用法?Java Op.getPath怎么用?Java Op.getPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.zookeeper.Op的用法示例。


在下文中一共展示了Op.getPath方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getPendingChanges

import org.apache.zookeeper.Op; //导入方法依赖的package包/类
/**
 * 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;
}
 
开发者ID:gerritjvv,项目名称:bigstreams,代码行数:27,代码来源:PrepRequestProcessor.java

示例2: getPendingChanges

import org.apache.zookeeper.Op; //导入方法依赖的package包/类
/**
 * 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;
}
 
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:44,代码来源:PrepRequestProcessor.java

示例3: getPendingChanges

import org.apache.zookeeper.Op; //导入方法依赖的package包/类
/**
 * 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;
}
 
开发者ID:didichuxing2,项目名称:https-github.com-apache-zookeeper,代码行数:44,代码来源:PrepRequestProcessor.java

示例4: getPendingChanges

import org.apache.zookeeper.Op; //导入方法依赖的package包/类
/**
 * 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;
}
 
开发者ID:sereca,项目名称:SecureKeeper,代码行数:44,代码来源:PrepRequestProcessor.java


注:本文中的org.apache.zookeeper.Op.getPath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。