zookeeper processor

Chain of Responsibility
为了实现各种服务器的代码结构的高度统一,不同角色的server对应不同的processor chain

1
2
3
interface RequestProcessor {
void processRequest(Request request) throws RequestProcessorException;
}

LeaderZooKeeperServer.java
Leader
Leader

FollowerZooKeeperServer.java
Follower
Follower

ZooKeeperServer.java

1
2
3
4
5
6
7
func processPacket() {
submitRequest()
}
func submitRequest(req) {
firstProcessor.processRequest(req)
}

Share Comments