Modifier and Type | Field and Description |
---|---|
protected BufferedOutputStream |
bufferedOutput |
protected InputArchive |
leaderIs |
protected OutputArchive |
leaderOs |
protected int |
leaderProtocolVersion
the protocol version of the leader
|
protected static org.slf4j.Logger |
LOG |
protected Socket |
sock |
Constructor and Description |
---|
Learner() |
Modifier and Type | Method and Description |
---|---|
protected void |
connectToLeader(InetSocketAddress addr,
String hostname)
Establish a connection with the Leader found by findLeader.
|
protected QuorumPeer.QuorumServer |
findLeader()
Returns the address of the node we think is the leader.
|
int |
getPendingRevalidationsCount() |
Socket |
getSocket()
Socket getter
|
protected long |
nanoTime()
Overridable helper method to return the System.nanoTime().
|
protected void |
ping(QuorumPacket qp) |
protected long |
registerWithLeader(int pktType)
Once connected to the leader, perform the handshake protocol to
establish a following / observing connection.
|
protected void |
revalidate(QuorumPacket qp) |
void |
shutdown()
Shutdown the Peer
|
protected void |
sockConnect(Socket sock,
InetSocketAddress addr,
int timeout)
Overridable helper method to simply call sock.connect().
|
protected void |
syncWithLeader(long newLeaderZxid)
Finally, synchronize our history with the Leader.
|
protected BufferedOutputStream bufferedOutput
protected Socket sock
protected InputArchive leaderIs
protected OutputArchive leaderOs
protected int leaderProtocolVersion
protected static final org.slf4j.Logger LOG
public Socket getSocket()
public int getPendingRevalidationsCount()
protected QuorumPeer.QuorumServer findLeader()
protected long nanoTime()
protected void sockConnect(Socket sock, InetSocketAddress addr, int timeout) throws IOException
IOException
protected void connectToLeader(InetSocketAddress addr, String hostname) throws IOException, InterruptedException, X509Exception
addr
- - the address of the Leader to connect to.IOException
- - if the socket connection fails on the 5th attempt
ConnectException
InterruptedException
X509Exception
protected long registerWithLeader(int pktType) throws IOException
pktType
- IOException
protected void syncWithLeader(long newLeaderZxid) throws Exception
newLeaderZxid
- IOException
InterruptedException
Exception
protected void revalidate(QuorumPacket qp) throws IOException
IOException
protected void ping(QuorumPacket qp) throws IOException
IOException
public void shutdown()
Copyright © 2008–2019 The Apache Software Foundation. All rights reserved.