public class LearnerHandler extends ZooKeeperThread
Thread.State, Thread.UncaughtExceptionHandler| Modifier and Type | Field and Description | 
|---|---|
static String | 
FORCE_SNAP_SYNC
For testing purpose, force leader to use snapshot to sync with followers 
 | 
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 | 
|---|---|
QuorumPeer.LearnerType | 
getLearnerType()  | 
Queue<QuorumPacket> | 
getQueuedPackets()
For testing, return packet queue 
 | 
Socket | 
getSocket()  | 
static String | 
packetToString(QuorumPacket p)  | 
void | 
ping()
ping calls from the leader to the peers 
 | 
protected long | 
queueCommittedProposals(Iterator<Leader.Proposal> itr,
                       long peerLastZxid,
                       Long maxZxid,
                       Long lastCommittedZxid)
Queue committed proposals into packet queue. 
 | 
void | 
run()
This thread will receive packets from the peer and process them and
 also listen to new connections from new peers. 
 | 
void | 
setFirstPacket(boolean value)
For testing, we need to reset this value 
 | 
void | 
shutdown()  | 
protected void | 
startSendingPackets()
Start thread that will forward any packet in the queue to the follower 
 | 
boolean | 
synced()  | 
boolean | 
syncFollower(long peerLastZxid,
            ZKDatabase db,
            Leader leader)
Determine if we need to sync with follower using DIFF/TRUNC/SNAP
 and setup follower to receive packets from commit processor 
 | 
long | 
tickOfNextAckDeadline()  | 
String | 
toString()  | 
handleExceptionactiveCount, 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, yieldprotected final Socket sock
protected long sid
protected int version
public static final String FORCE_SNAP_SYNC
public Socket getSocket()
public QuorumPeer.LearnerType getLearnerType()
public static String packetToString(QuorumPacket p)
public void run()
protected void startSendingPackets()
public boolean syncFollower(long peerLastZxid,
                            ZKDatabase db,
                            Leader leader)
peerLastZxid - db - leader - 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 Queue<QuorumPacket> getQueuedPackets()
public void setFirstPacket(boolean value)
Copyright © 2008–2021 The Apache Software Foundation. All rights reserved.