<NME> ConcurrentClientMain.java
<BEF> package com.github.wenweihu86.raft.example.client;

import com.baidu.brpc.client.BrpcProxy;
import com.baidu.brpc.client.RpcClient;
import com.github.wenweihu86.raft.example.server.service.ExampleProto;
import com.github.wenweihu86.raft.example.server.service.ExampleService;
import com.googlecode.protobuf.format.JsonFormat;

import java.util.UUID;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;

/**
 * Created by wenweihu86 on 2017/5/14.
 */
    public static void main(String[] args) {
        // parse args
        String ipPorts = args[0];
        final ExampleService exampleService = new ExampleServiceProxy(ipPorts);

        long startTime = System.currentTimeMillis();
        // set
        ExecutorService writeThreadPool = Executors.newFixedThreadPool(3);
        Future<?>[] future = new Future[3];
        for (int i = 0; i < 3; i++) {
            future[i] = writeThreadPool.submit(new SetTask(exampleService, i));
        }


        ExecutorService readThreadPool = Executors.newFixedThreadPool(3);
        ExecutorService writeThreadPool = Executors.newFixedThreadPool(3);
        Future<?>[] future = new Future[3];
        for (int i = 0; i < 3; i++) {
            future[i] = writeThreadPool.submit(new SetTask(exampleService, readThreadPool));
        }
    }

    public static class SetTask implements Runnable {
        private ExampleService exampleService;
        ExecutorService readThreadPool;

        public SetTask(ExampleService exampleService, ExecutorService readThreadPool) {
            this.exampleService = exampleService;
            this.readThreadPool = readThreadPool;
        startTime = System.currentTimeMillis();
        ExecutorService readThreadPool = Executors.newFixedThreadPool(3);
        for (int i = 0; i < 3; i++) {
            future[i] = readThreadPool.submit(new GetTask(exampleService, i));
        }

                ExampleProto.SetRequest setRequest = ExampleProto.SetRequest.newBuilder()
                        .setKey(key).setValue(value).build();

                long startTime = System.currentTimeMillis();
                ExampleProto.SetResponse setResponse = exampleService.set(setRequest);
                try {
                    if (setResponse != null) {
                        System.out.printf("set request, key=%s, value=%s, response=%s, elapseMS=%d\n",
                                key, value, jsonFormat.printToString(setResponse), System.currentTimeMillis() - startTime);
                        readThreadPool.submit(new GetTask(exampleService, key));
                    } else {
                        System.out.printf("set request failed, key=%s value=%s\n", key, value);
                    }
                } catch (Exception ex) {
                    ex.printStackTrace();
                }
            }
        }
    }

    public static class GetTask implements Runnable {
        private ExampleService exampleService;
        private String key;

        public GetTask(ExampleService exampleService, String key) {
            this.exampleService = exampleService;
            this.key = key;
        }

        @Override
        public void run() {
            ExampleProto.GetRequest getRequest = ExampleProto.GetRequest.newBuilder()
                    .setKey(key).build();
            long startTime = System.currentTimeMillis();
            ExampleProto.GetResponse getResponse = exampleService.get(getRequest);
            try {
                if (getResponse != null) {
                    System.out.printf("get request, key=%s, response=%s, elapseMS=%d\n",
                            key, jsonFormat.printToString(getResponse), System.currentTimeMillis() - startTime);
                } else {
                    System.out.printf("get request failed, key=%s\n", key);
                }
            } catch (Exception ex) {
                ex.printStackTrace();
            }
        }
    }

}

<MSG> add raft admin

<DFF> @@ -17,13 +17,13 @@ public class ConcurrentClientMain {
     public static void main(String[] args) {
         // parse args
         String ipPorts = args[0];
-        final ExampleService exampleService = new ExampleServiceProxy(ipPorts);
 
         long startTime = System.currentTimeMillis();
         // set
         ExecutorService writeThreadPool = Executors.newFixedThreadPool(3);
         Future<?>[] future = new Future[3];
         for (int i = 0; i < 3; i++) {
+            ExampleService exampleService = new ExampleServiceProxy(ipPorts);
             future[i] = writeThreadPool.submit(new SetTask(exampleService, i));
         }
 
@@ -46,6 +46,7 @@ public class ConcurrentClientMain {
         startTime = System.currentTimeMillis();
         ExecutorService readThreadPool = Executors.newFixedThreadPool(3);
         for (int i = 0; i < 3; i++) {
+            ExampleService exampleService = new ExampleServiceProxy(ipPorts);
             future[i] = readThreadPool.submit(new GetTask(exampleService, i));
         }
 

add raft admin