Modifier and Type | Field and Description |
---|---|
protected BufferedOutputStream |
bufferedOutput |
static boolean |
closeSocketAsync |
protected MultipleAddresses |
leaderAddr |
protected InputArchive |
leaderIs |
protected OutputArchive |
leaderOs |
protected int |
leaderProtocolVersion
the protocol version of the leader
|
static String |
LEARNER_ASYNC_SENDING |
static String |
LEARNER_CLOSE_SOCKET_ASYNC |
protected static org.slf4j.Logger |
LOG |
protected MessageTracker |
messageTracker |
protected Socket |
sock |
protected AtomicBoolean |
sockBeingClosed |
Constructor and Description |
---|
Learner() |
Modifier and Type | Method and Description |
---|---|
protected void |
connectToLeader(MultipleAddresses multiAddr,
String hostname)
Establish a connection with the LearnerMaster found by findLearnerMaster.
|
protected Socket |
createSocket()
Creating a simple or and SSL socket.
|
protected QuorumPeer.QuorumServer |
findLeader()
Returns the address of the node we think is the leader.
|
protected static boolean |
getAsyncSending() |
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 or learner master, perform the handshake
protocol to establish a following / observing connection.
|
protected void |
revalidate(QuorumPacket qp) |
protected static void |
setAsyncSending(boolean newMode) |
void |
shutdown()
Shutdown the Peer
|
protected void |
sockConnect(Socket sock,
InetSocketAddress addr,
int timeout)
Overridable helper method to simply call sock.connect().
|
protected void |
startSendingThread()
Start thread that will forward any packet in the queue to the leader
|
protected void |
syncWithLeader(long newLeaderZxid)
Finally, synchronize our history with the Leader (if Follower)
or the LearnerMaster (if Observer).
|
protected BufferedOutputStream bufferedOutput
protected Socket sock
protected MultipleAddresses leaderAddr
protected AtomicBoolean sockBeingClosed
protected InputArchive leaderIs
protected OutputArchive leaderOs
protected int leaderProtocolVersion
protected final MessageTracker messageTracker
protected static final org.slf4j.Logger LOG
public static final String LEARNER_ASYNC_SENDING
public static final String LEARNER_CLOSE_SOCKET_ASYNC
public static final boolean closeSocketAsync
public Socket getSocket()
public int getPendingRevalidationsCount()
protected static void setAsyncSending(boolean newMode)
protected static boolean getAsyncSending()
protected void startSendingThread()
protected QuorumPeer.QuorumServer findLeader()
protected long nanoTime()
protected void sockConnect(Socket sock, InetSocketAddress addr, int timeout) throws IOException
IOException
protected void connectToLeader(MultipleAddresses multiAddr, String hostname) throws IOException
multiAddr
- - the address of the Peer to connect to.IOException
- - if the socket connection fails on the 5th attempt
if there is an authentication failure while connecting to leaderprotected Socket createSocket() throws X509Exception, IOException
X509Exception
IOException
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–2021 The Apache Software Foundation. All rights reserved.