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


Java ZooTrace.logQuorumPacket方法代码示例

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


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

示例1: readPacket

import org.apache.zookeeper.server.ZooTrace; //导入方法依赖的package包/类
/**
 * read a packet from the leader
 *
 * @param pp
 *                the packet to be instantiated
 * @throws IOException
 */
void readPacket(QuorumPacket pp) throws IOException {
    synchronized (leaderIs) {
        leaderIs.readRecord(pp, "packet");
    }
    long traceMask = ZooTrace.SERVER_PACKET_TRACE_MASK;
    if (pp.getType() == Leader.PING) {
        traceMask = ZooTrace.SERVER_PING_TRACE_MASK;
    }
    if (LOG.isTraceEnabled()) {
        ZooTrace.logQuorumPacket(LOG, traceMask, 'i', pp);
    }
}
 
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:20,代码来源:Learner.java

示例2: sendPackets

import org.apache.zookeeper.server.ZooTrace; //导入方法依赖的package包/类
/**
 * This method will use the thread to send packets added to the
 * queuedPackets list
 *
 * @throws InterruptedException
 */
private void sendPackets() throws InterruptedException {
    long traceMask = ZooTrace.SERVER_PACKET_TRACE_MASK;
    while (true) {
        try {
            QuorumPacket p;
            p = queuedPackets.poll();
            if (p == null) {
                bufferedOutput.flush();
                p = queuedPackets.take();
            }

            if (p == proposalOfDeath) {
                // Packet of death!
                break;
            }
            if (p.getType() == Leader.PING) {
                traceMask = ZooTrace.SERVER_PING_TRACE_MASK;
            }
            if (LOG.isTraceEnabled()) {
                ZooTrace.logQuorumPacket(LOG, traceMask, 'o', p);
            }
            oa.writeRecord(p, "packet");
        } catch (IOException e) {
            if (!sock.isClosed()) {
                LOG.warn("Unexpected exception at " + this, e);
                try {
                    // this will cause everything to shutdown on
                    // this learner handler and will help notify
                    // the learner/observer instantaneously
                    sock.close();
                } catch(IOException ie) {
                    LOG.warn("Error closing socket for handler " + this, ie);
                }
            }
            break;
        }
    }
}
 
开发者ID:gerritjvv,项目名称:bigstreams,代码行数:45,代码来源:LearnerHandler.java

示例3: sendPackets

import org.apache.zookeeper.server.ZooTrace; //导入方法依赖的package包/类
/**
 * This method will use the thread to send packets added to the
 * queuedPackets list
 *
 * @throws InterruptedException
 */
private void sendPackets() throws InterruptedException {
    long traceMask = ZooTrace.SERVER_PACKET_TRACE_MASK;
    while (true) {
        try {
            QuorumPacket p;
            p = queuedPackets.poll();
            if (p == null) {
                bufferedOutput.flush();
                p = queuedPackets.take();
            }

            if (p == proposalOfDeath) {
                // Packet of death!
                break;
            }
            if (p.getType() == Leader.PING) {
                traceMask = ZooTrace.SERVER_PING_TRACE_MASK;
            }
            if (p.getType() == Leader.PROPOSAL) {
                syncLimitCheck.updateProposal(p.getZxid(), System.nanoTime());
            }
            if (LOG.isTraceEnabled()) {
                ZooTrace.logQuorumPacket(LOG, traceMask, 'o', p);
            }
            oa.writeRecord(p, "packet");
        } catch (IOException e) {
            if (!sock.isClosed()) {
                LOG.warn("Unexpected exception at " + this, e);
                try {
                    // this will cause everything to shutdown on
                    // this learner handler and will help notify
                    // the learner/observer instantaneously
                    sock.close();
                } catch(IOException ie) {
                    LOG.warn("Error closing socket for handler " + this, ie);
                }
            }
            break;
        }
    }
}
 
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:48,代码来源:LearnerHandler.java


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