本文整理汇总了Java中org.apache.zookeeper.server.ZooTrace.SERVER_PACKET_TRACE_MASK属性的典型用法代码示例。如果您正苦于以下问题:Java ZooTrace.SERVER_PACKET_TRACE_MASK属性的具体用法?Java ZooTrace.SERVER_PACKET_TRACE_MASK怎么用?Java ZooTrace.SERVER_PACKET_TRACE_MASK使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.zookeeper.server.ZooTrace
的用法示例。
在下文中一共展示了ZooTrace.SERVER_PACKET_TRACE_MASK属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getMask
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;
}
示例2: readPacket
/**
* 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);
}
}
示例3: sendPackets
/**
* 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;
}
}
}
示例4: sendPackets
/**
* 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;
}
}
}