Source code analysis of leader election-Messenger

Two threads are constructed in Messenger, one is WorkerSender and the other is WorkerReceiver. These two threads are used to send and receive messages respectively. I will not analyze it for now.

Messenger(QuorumCnxManager manager) { 
	this.ws = new WorkerSender(manager); 
	Thread t = new Thread(this.ws, "WorkerSender[myid=" + self.getId() + "]"); 
	t.setDaemon(true); 
	t.start(); 
	this.wr = new WorkerReceiver(manager); 
	t = new Thread(this.wr, "WorkerReceiver[myid=" + self.getId() + "]"); 
	t.setDaemon(true); 
	t.start(); 
}

 

Guess you like

Origin blog.csdn.net/Leon_Jinhai_Sun/article/details/112971852