public class QuorumCnxManager extends Object
Modifier and Type | Class and Description |
---|---|
static class |
QuorumCnxManager.InitialMessage |
class |
QuorumCnxManager.Listener
Thread to listen on some ports
|
static class |
QuorumCnxManager.Message |
Modifier and Type | Field and Description |
---|---|
QuorumCnxManager.Listener |
listener |
static int |
maxBuffer |
static long |
PROTOCOL_VERSION_V1 |
static long |
PROTOCOL_VERSION_V2 |
BlockingQueue<QuorumCnxManager.Message> |
recvQueue |
Constructor and Description |
---|
QuorumCnxManager(QuorumPeer self,
long mySid,
Map<Long,QuorumPeer.QuorumServer> view,
QuorumAuthServer authServer,
QuorumAuthLearner authLearner,
int socketTimeout,
boolean listenOnAllIPs,
int quorumCnxnThreadsSize,
boolean quorumSaslAuthEnabled) |
Modifier and Type | Method and Description |
---|---|
void |
addToRecvQueue(QuorumCnxManager.Message msg)
Inserts an element in the
recvQueue . |
void |
connectAll()
Try to establish a connection with each server if one
doesn't exist.
|
boolean |
connectedToPeer(long peerSid) |
long |
getConnectionThreadCount()
Return number of connection processing threads.
|
long |
getThreadCount()
Return number of worker threads
|
void |
halt()
Flag that it is time to wrap up all activities and interrupt the listener.
|
void |
initiateConnection(MultipleAddresses electionAddr,
Long sid)
First we create the socket, perform SSL handshake and authentication if needed.
|
boolean |
initiateConnectionAsync(MultipleAddresses electionAddr,
Long sid)
Server will initiate the connection request to its peer server
asynchronously via separate connection thread.
|
boolean |
isReconfigEnabled() |
QuorumCnxManager.Message |
pollRecvQueue(long timeout,
TimeUnit unit)
Retrieves and removes a message at the head of this queue,
waiting up to the specified wait time if necessary for an element to
become available.
|
void |
receiveConnection(Socket sock)
If this server receives a connection request, then it gives up on the new
connection if it wins.
|
void |
receiveConnectionAsync(Socket sock)
Server receives a connection request and handles it asynchronously via
separate thread.
|
void |
softHalt()
A soft halt simply finishes workers.
|
void |
testInitiateConnection(long sid)
Invokes initiateConnection for testing purposes
|
void |
toSend(Long sid,
ByteBuffer b)
Processes invoke this message to queue a message to send.
|
public static final long PROTOCOL_VERSION_V1
public static final long PROTOCOL_VERSION_V2
public static final int maxBuffer
public final BlockingQueue<QuorumCnxManager.Message> recvQueue
public final QuorumCnxManager.Listener listener
public QuorumCnxManager(QuorumPeer self, long mySid, Map<Long,QuorumPeer.QuorumServer> view, QuorumAuthServer authServer, QuorumAuthLearner authLearner, int socketTimeout, boolean listenOnAllIPs, int quorumCnxnThreadsSize, boolean quorumSaslAuthEnabled)
public void testInitiateConnection(long sid)
sid
- public void initiateConnection(MultipleAddresses electionAddr, Long sid)
public boolean initiateConnectionAsync(MultipleAddresses electionAddr, Long sid)
public void receiveConnection(Socket sock)
public void receiveConnectionAsync(Socket sock)
public void toSend(Long sid, ByteBuffer b)
public void connectAll()
public void halt()
public void softHalt()
public long getThreadCount()
public long getConnectionThreadCount()
public void addToRecvQueue(QuorumCnxManager.Message msg)
recvQueue
. If the Queue is full, this
methods removes an element from the head of the Queue and then inserts the
element at the tail of the queue.msg
- Reference to the message to be inserted in the queuepublic QuorumCnxManager.Message pollRecvQueue(long timeout, TimeUnit unit) throws InterruptedException
BlockingQueue.poll(long, java.util.concurrent.TimeUnit)
InterruptedException
public boolean connectedToPeer(long peerSid)
public boolean isReconfigEnabled()
Copyright © 2008–2021 The Apache Software Foundation. All rights reserved.