public class LearnerHandler extends ZooKeeperThread
Thread.State, Thread.UncaughtExceptionHandler
Modifier and Type | Field and Description |
---|---|
protected Date |
established |
static String |
FORCE_SNAP_SYNC
For testing purpose, force learnerMaster to use snapshot to sync with followers
|
protected long |
lastZxid |
protected MessageTracker |
messageTracker |
protected AtomicLong |
packetsReceived |
protected AtomicLong |
packetsSent |
protected AtomicLong |
requestsReceived |
protected long |
sid
ZooKeeper server identifier of this learner
|
protected Socket |
sock |
protected int |
version |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
Modifier and Type | Method and Description |
---|---|
Date |
getEstablished() |
long |
getLastZxid() |
Map<String,Object> |
getLearnerHandlerInfo() |
QuorumPeer.LearnerType |
getLearnerType() |
Queue<QuorumPacket> |
getQueuedPackets()
For testing, return packet queue
|
Socket |
getSocket() |
static String |
packetToString(QuorumPacket p) |
void |
ping()
ping calls from the learnerMaster to the peers
|
protected long |
queueCommittedProposals(Iterator<Leader.Proposal> itr,
long peerLastZxid,
Long maxZxid,
Long lastCommittedZxid)
Queue committed proposals into packet queue.
|
void |
resetObserverConnectionStats() |
void |
run()
This thread will receive packets from the peer and process them and
also listen to new connections from new peers.
|
protected void |
setBufferedOutput(BufferedOutputStream bufferedOutput) |
void |
setFirstPacket(boolean value)
For testing, we need to reset this value
|
protected void |
setOutputArchive(BinaryOutputArchive oa) |
protected boolean |
shouldSendMarkerPacketForLogging()
Tests need not send marker packets as they are only needed to
log quorum packet delays
|
void |
shutdown() |
protected void |
startSendingPackets()
Start thread that will forward any packet in the queue to the follower
|
boolean |
synced() |
long |
tickOfNextAckDeadline() |
String |
toString() |
handleException
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, yield
protected final Socket sock
protected long sid
protected int version
protected final AtomicLong packetsReceived
protected final AtomicLong packetsSent
protected final AtomicLong requestsReceived
protected volatile long lastZxid
protected final Date established
protected final MessageTracker messageTracker
public static final String FORCE_SNAP_SYNC
public Socket getSocket()
public long getLastZxid()
public Date getEstablished()
protected void setOutputArchive(BinaryOutputArchive oa)
protected void setBufferedOutput(BufferedOutputStream bufferedOutput)
public QuorumPeer.LearnerType getLearnerType()
public static String packetToString(QuorumPacket p)
public void run()
protected void startSendingPackets()
protected boolean shouldSendMarkerPacketForLogging()
protected long queueCommittedProposals(Iterator<Leader.Proposal> itr, long peerLastZxid, Long maxZxid, Long lastCommittedZxid)
itr
- iterator point to the proposalspeerLastZxid
- last zxid seen by the followermaxZxid
- max zxid of the proposal to queue, null if no limitlastCommittedZxid
- when sending diff, we need to send lastCommittedZxid
on the leader to follow Zab 1.0 protocol.public void shutdown()
public long tickOfNextAckDeadline()
public void ping()
public boolean synced()
public void resetObserverConnectionStats()
public Queue<QuorumPacket> getQueuedPackets()
public void setFirstPacket(boolean value)
Copyright © 2008–2020 The Apache Software Foundation. All rights reserved.