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


Java ZooTrace类代码示例

本文整理汇总了Java中org.apache.zookeeper.server.ZooTrace的典型用法代码示例。如果您正苦于以下问题:Java ZooTrace类的具体用法?Java ZooTrace怎么用?Java ZooTrace使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: deserializeSnapshot

import org.apache.zookeeper.server.ZooTrace; //导入依赖的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: validateSession

import org.apache.zookeeper.server.ZooTrace; //导入依赖的package包/类
/**
 * validate a session for a client
 *
 * @param clientId
 *                the client to be revalidated
 * @param timeout
 *                the timeout for which the session is valid
 * @return
 * @throws IOException
 */
void validateSession(ServerCnxn cnxn, long clientId, int timeout)
        throws IOException {
    LOG.info("Revalidating client: 0x" + Long.toHexString(clientId));
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    DataOutputStream dos = new DataOutputStream(baos);
    dos.writeLong(clientId);
    dos.writeInt(timeout);
    dos.close();
    QuorumPacket qp = new QuorumPacket(Leader.REVALIDATE, -1, baos
            .toByteArray(), null);
    pendingRevalidations.put(clientId, cnxn);
    if (LOG.isTraceEnabled()) {
        ZooTrace.logTraceMessage(LOG,
                                 ZooTrace.SESSION_TRACE_MASK,
                                 "To validate session 0x"
                                 + Long.toHexString(clientId));
    }
    writePacket(qp, true);
}
 
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:30,代码来源:Learner.java

示例3: revalidate

import org.apache.zookeeper.server.ZooTrace; //导入依赖的package包/类
protected void revalidate(QuorumPacket qp) throws IOException {
    ByteArrayInputStream bis = new ByteArrayInputStream(qp
            .getData());
    DataInputStream dis = new DataInputStream(bis);
    long sessionId = dis.readLong();
    boolean valid = dis.readBoolean();
    ServerCnxn cnxn = pendingRevalidations
    .remove(sessionId);
    if (cnxn == null) {
        LOG.warn("Missing session 0x"
                + Long.toHexString(sessionId)
                + " for validation");
    } else {
        zk.finishSessionInit(cnxn, valid);
    }
    if (LOG.isTraceEnabled()) {
        ZooTrace.logTraceMessage(LOG,
                ZooTrace.SESSION_TRACE_MASK,
                "Session 0x" + Long.toHexString(sessionId)
                + " is valid: " + valid);
    }
}
 
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:23,代码来源:Learner.java

示例4: deserializeSnapshot

import org.apache.zookeeper.server.ZooTrace; //导入依赖的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

示例5: getMask

import org.apache.zookeeper.server.ZooTrace; //导入依赖的package包/类
private static long getMask(String mask) {
    long retv = 0;
    if (mask.equalsIgnoreCase("CLIENT_REQUEST_TRACE_MASK")) {
        retv = ZooTrace.CLIENT_REQUEST_TRACE_MASK;
    } else if (mask.equalsIgnoreCase("CLIENT_DATA_PACKET_TRACE_MASK")) {
        retv = ZooTrace.CLIENT_DATA_PACKET_TRACE_MASK;
    } else if (mask.equalsIgnoreCase("CLIENT_PING_TRACE_MASK")) {
        retv = ZooTrace.CLIENT_PING_TRACE_MASK;
    } else if (mask.equalsIgnoreCase("SERVER_PACKET_TRACE_MASK")) {
        retv = ZooTrace.SERVER_PACKET_TRACE_MASK;
    } else if (mask.equalsIgnoreCase("SESSION_TRACE_MASK")) {
        retv = ZooTrace.SESSION_TRACE_MASK;
    } else if (mask.equalsIgnoreCase("EVENT_DELIVERY_TRACE_MASK")) {
        retv = ZooTrace.EVENT_DELIVERY_TRACE_MASK;
    } else if (mask.equalsIgnoreCase("SERVER_PING_TRACE_MASK")) {
        retv = ZooTrace.SERVER_PING_TRACE_MASK;
    } else if (mask.equalsIgnoreCase("WARNING_TRACE_MASK")) {
        retv = ZooTrace.WARNING_TRACE_MASK;
    }
    return retv;
}
 
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:22,代码来源:ServerAdminClient.java

示例6: revalidate

import org.apache.zookeeper.server.ZooTrace; //导入依赖的package包/类
protected void revalidate(QuorumPacket qp) throws IOException {
    ByteArrayInputStream bis = new ByteArrayInputStream(qp
            .getData());
    DataInputStream dis = new DataInputStream(bis);
    long sessionId = dis.readLong();
    boolean valid = dis.readBoolean();
    ServerCnxn cnxn = pendingRevalidations.remove(sessionId);
    if (cnxn == null) {
        LOG.warn("Missing session 0x"
                + Long.toHexString(sessionId)
                + " for validation");
    } else {
        zk.finishSessionInit(cnxn, valid);
    }
    if (LOG.isTraceEnabled()) {
        ZooTrace.logTraceMessage(LOG,
                ZooTrace.SESSION_TRACE_MASK,
                "Session 0x" + Long.toHexString(sessionId)
                + " is valid: " + valid);
    }
}
 
开发者ID:didichuxing2,项目名称:https-github.com-apache-zookeeper,代码行数:22,代码来源:Learner.java

示例7: run

import org.apache.zookeeper.server.ZooTrace; //导入依赖的package包/类
@Override
public CommandResponse run(ZooKeeperServer zkServer, Map<String, String> kwargs) {
    CommandResponse response = initializeResponse();
    long traceMask;
    if (!kwargs.containsKey("traceMask")) {
        response.put("error", "setTraceMask requires long traceMask argument");
        return response;
    }
    try {
        traceMask = Long.parseLong(kwargs.get("traceMask"));
    } catch (NumberFormatException e) {
        response.put("error", "setTraceMask requires long traceMask argument, got "
                              + kwargs.get("traceMask"));
        return response;
    }

    ZooTrace.setTextTraceLevel(traceMask);
    response.put("tracemask", traceMask);
    return response;
}
 
开发者ID:didichuxing2,项目名称:https-github.com-apache-zookeeper,代码行数:21,代码来源:Commands.java

示例8: deserializeSnapshot

import org.apache.zookeeper.server.ZooTrace; //导入依赖的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


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