org.apache.zookeeper.server.quorum
Class LearnerHandler

java.lang.Object
  extended by java.lang.Thread
      extended by org.apache.zookeeper.server.quorum.LearnerHandler
All Implemented Interfaces:
java.lang.Runnable

public class LearnerHandler
extends java.lang.Thread

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.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
protected  long sid
          ZooKeeper server identifier of this learner
protected  java.net.Socket sock
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Method Summary
 QuorumPeer.LearnerType getLearnerType()
           
 java.net.Socket getSocket()
           
static java.lang.String packetToString(QuorumPacket p)
           
 void ping()
          ping calls from the leader to the peers
 void run()
          This thread will receive packets from the peer and process them and also listen to new connections from new peers.
 void shutdown()
           
 boolean synced()
           
 long tickOfLastAck()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

sock

protected final java.net.Socket sock

sid

protected long sid
ZooKeeper server identifier of this learner

Method Detail

getSocket

public java.net.Socket getSocket()

toString

public java.lang.String toString()
Overrides:
toString in class java.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:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

shutdown

public void shutdown()

tickOfLastAck

public long tickOfLastAck()

ping

public void ping()
ping calls from the leader to the peers


synced

public boolean synced()


Copyright © 2010 The Apache Software Foundation