 class WorkerSender implements Runnable {
            // 是否终止
            volatile boolean stop;
            // 服务器之间的连接
            QuorumCnxManager manager;

            // 构造器
            WorkerSender(QuorumCnxManager manager){
                // 初始化属性
                this.stop = false;
                this.manager = manager;
            }

            public void run() {
                while (!stop) { // 不终止
                    try {
                        // 从sendqueue中取出ToSend消息
                        ToSend m = sendqueue.poll(3000, TimeUnit.MILLISECONDS);
                        // 若为空，则跳过
                        if(m == null) continue;
                        // 不为空，则进行处理
                        process(m);
                    } catch (InterruptedException e) {
                        break;
                    }
                }
                LOG.info("WorkerSender is down");
            }

            /**
             * Called by run() once there is a new message to send.
             *
             * @param m     message to send
             */
            void process(ToSend m) {
                // 构建消息
                ByteBuffer requestBuffer = buildMsg(m.state.ordinal(), 
                                                        m.leader,
                                                        m.zxid, 
                                                        m.electionEpoch, 
                                                        m.peerEpoch);
                // 发送消息
                manager.toSend(m.sid, requestBuffer);
            }
        }