Java 类org.apache.zookeeper.server.ZooTrace 实例源码

项目:fuck_zookeeper    文件:UpgradeSnapShotV1.java   
/**
 * 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");
}
项目:fuck_zookeeper    文件:Learner.java   
/**
 * 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);
}
项目:fuck_zookeeper    文件:Learner.java   
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);
    }
}
项目:fuck_zookeeper    文件:SerializeUtils.java   
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");
}
项目:fuck_zookeeper    文件:ServerAdminClient.java   
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;
}
项目:https-github.com-apache-zookeeper    文件:Learner.java   
/**
 * 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);
}
项目:https-github.com-apache-zookeeper    文件:Learner.java   
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);
    }
}
项目:https-github.com-apache-zookeeper    文件:Commands.java   
@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;
}
项目:https-github.com-apache-zookeeper    文件:SerializeUtils.java   
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");
}
项目:ZooKeeper    文件:UpgradeSnapShotV1.java   
/**
 * 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");
}
项目:ZooKeeper    文件:Learner.java   
/**
 * 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);
}
项目:ZooKeeper    文件:Learner.java   
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);
    }
}
项目:ZooKeeper    文件:SerializeUtils.java   
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");
}
项目:ZooKeeper    文件:ServerAdminClient.java   
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;
}
项目:StreamProcessingInfrastructure    文件:UpgradeSnapShotV1.java   
/**
 * 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");
}
项目:StreamProcessingInfrastructure    文件:Learner.java   
/**
 * 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);
}
项目:StreamProcessingInfrastructure    文件:Learner.java   
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);
    }
}
项目:StreamProcessingInfrastructure    文件:SerializeUtils.java   
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");
}
项目:StreamProcessingInfrastructure    文件:ServerAdminClient.java   
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;
}
项目:bigstreams    文件:UpgradeSnapShotV1.java   
/**
 * 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");
}
项目:bigstreams    文件:Learner.java   
/**
 * 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);
}
项目:bigstreams    文件:Learner.java   
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);
    }
}
项目:bigstreams    文件:SerializeUtils.java   
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");
}
项目:bigstreams    文件:ServerAdminClient.java   
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;
}
项目:bigstreams    文件:UpgradeSnapShotV1.java   
/**
 * 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");
}
项目:bigstreams    文件:Learner.java   
/**
 * 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);
}
项目:bigstreams    文件:Learner.java   
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);
    }
}
项目:bigstreams    文件:SerializeUtils.java   
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");
}
项目:bigstreams    文件:ServerAdminClient.java   
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;
}
项目:zookeeper-src-learning    文件:UpgradeSnapShotV1.java   
/**
 * 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");
}
项目:zookeeper-src-learning    文件:Learner.java   
/**
 * 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);
}
项目:zookeeper-src-learning    文件:Learner.java   
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);
    }
}
项目:zookeeper-src-learning    文件:SerializeUtils.java   
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");
}
项目:zookeeper-src-learning    文件:ServerAdminClient.java   
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;
}
项目:zookeeper    文件:UpgradeSnapShotV1.java   
/**
 * 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");
}
项目:zookeeper    文件:Learner.java   
/**
 * 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);
}
项目:zookeeper    文件:Learner.java   
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);
    }
}
项目:zookeeper    文件:SerializeUtils.java   
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");
}
项目:zookeeper    文件:ServerAdminClient.java   
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;
}
项目:SecureKeeper    文件:Learner.java   
/**
 * 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);
}