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


Java InputArchive.readLong方法代码示例

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


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

示例1: deserializeSnapshot

import org.apache.jute.InputArchive; //导入方法依赖的package包/类
/**
 * deseriluize from an inputarchive
 * @param oldTree the tree to be created
 * @param ia the input archive to be read from
 * @param sessions the sessions to be created
 * @throws IOException 
 */
private void deserializeSnapshot(DataTreeV1 oldTree, InputArchive ia,
        Map<Long, Integer> sessions) throws IOException {
    int count = ia.readInt("count");
    while (count > 0) {
        long id = ia.readLong("id");
        int to = ia.readInt("timeout");
        sessions.put(id, to);
        if (LOG.isTraceEnabled()) {
            ZooTrace.logTraceMessage(LOG, ZooTrace.SESSION_TRACE_MASK,
                    "loadData --- session in archive: " + id
                    + " with timeout: " + to);
        }
        count--;
    }
    oldTree.deserialize(ia, "tree");
}
 
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:24,代码来源:UpgradeSnapShotV1.java

示例2: deserialize

import org.apache.jute.InputArchive; //导入方法依赖的package包/类
public synchronized void deserialize(InputArchive ia) throws IOException {
    clear();
    int i = ia.readInt("map");
    while (i > 0) {
        Long val = ia.readLong("long");
        if (aclIndex < val) {
            aclIndex = val;
        }
        List<ACL> aclList = new ArrayList<ACL>();
        Index j = ia.startVector("acls");
        while (!j.done()) {
            ACL acl = new ACL();
            acl.deserialize(ia, "acl");
            aclList.add(acl);
            j.incr();
        }
        longKeyMap.put(val, aclList);
        aclKeyMap.put(aclList, val);
        referenceCounter.put(val, new AtomicLongWithEquals(0));
        i--;
    }
}
 
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:23,代码来源:ReferenceCountedACLCache.java

示例3: deserializeSnapshot

import org.apache.jute.InputArchive; //导入方法依赖的package包/类
public static void deserializeSnapshot(DataTree dt,InputArchive ia,
        Map<Long, Integer> sessions) throws IOException {
    int count = ia.readInt("count");
    while (count > 0) {
        long id = ia.readLong("id");
        int to = ia.readInt("timeout");
        sessions.put(id, to);
        if (LOG.isTraceEnabled()) {
            ZooTrace.logTraceMessage(LOG, ZooTrace.SESSION_TRACE_MASK,
                    "loadData --- session in archive: " + id
                    + " with timeout: " + to);
        }
        count--;
    }
    dt.deserialize(ia, "tree");
}
 
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:17,代码来源:SerializeUtils.java

示例4: getCheckSum

import org.apache.jute.InputArchive; //导入方法依赖的package包/类
/** return if checksum matches for a snapshot **/
private boolean getCheckSum(FileSnap snap, File snapFile) throws IOException {
    DataTree dt = new DataTree();
    Map<Long, Integer> sessions = new ConcurrentHashMap<Long, Integer>();
    InputStream snapIS = new BufferedInputStream(new FileInputStream(
            snapFile));
    CheckedInputStream crcIn = new CheckedInputStream(snapIS, new Adler32());
    InputArchive ia = BinaryInputArchive.getArchive(crcIn);
    try {
        snap.deserialize(dt, sessions, ia);
    } catch (IOException ie) {
        // we failed on the most recent snapshot
        // must be incomplete
        // try reading the next one
        // after corrupting
        snapIS.close();
        crcIn.close();
        throw ie;
    }

    long checksum = crcIn.getChecksum().getValue();
    long val = ia.readLong("val");
    snapIS.close();
    crcIn.close();
    return (val != checksum);
}
 
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:27,代码来源:CRCTest.java

示例5: deserializeSnapshot

import org.apache.jute.InputArchive; //导入方法依赖的package包/类
public static void deserializeSnapshot(DataTree dt,InputArchive ia,
        Map<Long, Integer> sessions) throws IOException {
    // 读取session个数
    int count = ia.readInt("count");
    while (count > 0) {
        // session id
        long id = ia.readLong("id");
        // session超时时间
        int to = ia.readInt("timeout");
        // 解析session集合
        sessions.put(id, to);
        if (LOG.isTraceEnabled()) {
            ZooTrace.logTraceMessage(LOG, ZooTrace.SESSION_TRACE_MASK,
                    "loadData --- session in archive: " + id
                    + " with timeout: " + to);
        }
        count--;
    }
    // 反序列化tree
    dt.deserialize(ia, "tree");
}
 
开发者ID:txazo,项目名称:zookeeper,代码行数:22,代码来源:SerializeUtils.java

示例6: deserializeList

import org.apache.jute.InputArchive; //导入方法依赖的package包/类
private void deserializeList(Map<Long, List<ACL>> longKeyMap,
        InputArchive ia) throws IOException {
    // longKey数量
    int i = ia.readInt("map");
    while (i > 0) {
        Long val = ia.readLong("long");
        if (aclIndex < val) {
            aclIndex = val;
        }
        List<ACL> aclList = new ArrayList<ACL>();
        // acl列表数量
        Index j = ia.startVector("acls");
        while (!j.done()) {
            ACL acl = new ACL();
            // 反序列化acl
            acl.deserialize(ia, "acl");
            aclList.add(acl);
            j.incr();
        }
        longKeyMap.put(val, aclList);
        aclKeyMap.put(aclList, val);
        i--;
    }
}
 
开发者ID:txazo,项目名称:zookeeper,代码行数:25,代码来源:DataTree.java

示例7: deserialize

import org.apache.jute.InputArchive; //导入方法依赖的package包/类
synchronized public void deserialize(InputArchive archive, String tag)
        throws IOException {
    archive.startRecord("node");
    data = archive.readBuffer("data");
    acl = archive.readLong("acl");
    stat = new StatPersisted();
    stat.deserialize(archive, "statpersisted");
    archive.endRecord("node");
}
 
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:10,代码来源:DataNode.java

示例8: deserialize

import org.apache.jute.InputArchive; //导入方法依赖的package包/类
/**
 * deserialize a data tree from the most recent snapshot
 * @return the zxid of the snapshot
 */
public long deserialize(DataTree dt, Map<Long, Integer> sessions)
        throws IOException {
    // we run through 100 snapshots (not all of them)
    // if we cannot get it running within 100 snapshots
    // we should  give up
    List<File> snapList = findNValidSnapshots(100);
    if (snapList.size() == 0) {
        return -1L;
    }
    File snap = null;
    boolean foundValid = false;
    for (int i = 0, snapListSize = snapList.size(); i < snapListSize; i++) {
        snap = snapList.get(i);
        LOG.info("Reading snapshot " + snap);
        try (InputStream snapIS = new BufferedInputStream(new FileInputStream(snap));
             CheckedInputStream crcIn = new CheckedInputStream(snapIS, new Adler32())) {
            InputArchive ia = BinaryInputArchive.getArchive(crcIn);
            deserialize(dt, sessions, ia);
            long checkSum = crcIn.getChecksum().getValue();
            long val = ia.readLong("val");
            if (val != checkSum) {
                throw new IOException("CRC corruption in snapshot :  " + snap);
            }
            foundValid = true;
            break;
        } catch (IOException e) {
            LOG.warn("problem reading snap file " + snap, e);
        }
    }
    if (!foundValid) {
        throw new IOException("Not able to find valid snapshots in " + snapDir);
    }
    dt.lastProcessedZxid = Util.getZxidFromName(snap.getName(), "snapshot");
    return dt.lastProcessedZxid;
}
 
开发者ID:didichuxing2,项目名称:https-github.com-apache-zookeeper,代码行数:40,代码来源:FileSnap.java

示例9: deserialize

import org.apache.jute.InputArchive; //导入方法依赖的package包/类
synchronized public void deserialize(InputArchive archive, String tag)
        throws IOException {
    archive.startRecord("node");
    // 节点数据
    data = archive.readBuffer("data");
    // 节点acl
    acl = archive.readLong("acl");
    stat = new StatPersisted();
    // 反序列化节点stat
    stat.deserialize(archive, "statpersisted");
    archive.endRecord("node");
}
 
开发者ID:txazo,项目名称:zookeeper,代码行数:13,代码来源:DataNode.java


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