Examples of ConcurrentCircleArray


Examples of com.taobao.common.stable.ConcurrentCircleArray

    /**
     * @param args
     */
    public static void main(String[] args) {
        final ConcurrentCircleArray cca = new ConcurrentCircleArray(200);
        Thread t1 = new Thread(){
            public void run() {
                for (int i = 0; i < 10000; i ++) {
                    cca.add(10);
                    try {
                        Thread.sleep(10);
                    } catch (InterruptedException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }
                }
               
            }
        };
        t1.start();
        Thread t2 = new Thread(){
            public void run() {
                for (int i = 0; i < 10000; i ++) {
                    System.out.println("avg1="+cca.getQpsAndAvg()[0]);
                    System.out.println("qps1="+cca.getQpsAndAvg()[1]);
                    System.out.println("avg2="+cca.getArrayAvg());
                    try {
                        Thread.sleep(10);
                    } catch (InterruptedException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.