Class LearnerHandler
- java.lang.Object
-
- java.lang.Thread
-
- org.apache.zookeeper.server.ZooKeeperThread
-
- org.apache.zookeeper.server.quorum.LearnerHandler
-
- All Implemented Interfaces:
java.lang.Runnable
public class LearnerHandler extends ZooKeeperThread
There will be an instance of this class created by the Leader for each learner. All communication with a learner is handled by this class.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description QuorumPeer.LearnerTypegetLearnerType()java.net.SocketgetSocket()static java.lang.StringpacketToString(QuorumPacket p)voidping()ping calls from the leader to the peersvoidrun()This thread will receive packets from the peer and process them and also listen to new connections from new peers.voidshutdown()booleansynced()longtickOfNextAckDeadline()java.lang.StringtoString()-
Methods inherited from class org.apache.zookeeper.server.ZooKeeperThread
handleException
-
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, yield
-
-
-
-
Method Detail
-
getSocket
public java.net.Socket getSocket()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Thread
-
getLearnerType
public QuorumPeer.LearnerType getLearnerType()
-
packetToString
public static java.lang.String packetToString(QuorumPacket p)
-
run
public void run()
This thread will receive packets from the peer and process them and also listen to new connections from new peers.- Specified by:
runin interfacejava.lang.Runnable- Overrides:
runin classjava.lang.Thread
-
shutdown
public void shutdown()
-
tickOfNextAckDeadline
public long tickOfNextAckDeadline()
-
ping
public void ping()
ping calls from the leader to the peers
-
synced
public boolean synced()
-
-