Zookeeper Watcher source code harvest

QuorumPeer's run method will setupRequestProcessor (assembly processor), setupRequestProcessor is rewritten, according to the stand-alone or cluster, assembled into three different 责任链, the following figure is the stand-alone mode

When the server receives the client request, it will submit the request through NIOServerCnxn submitRequest. After submitting the request and entering 责任链模式
Insert picture description here
one of the processors of the responsibility chain, the request will be placed in the queue first. The processor itself is a thread, and its own run method is from Get the data in the queue and call the next chain of responsibility to achieve asynchronous.
Insert picture description here

Published 563 original articles · praised 4345 · 2.93 million views

Guess you like

Origin blog.csdn.net/dataiyangu/article/details/105610596