Package org.jgroups.blocks.atomic

Examples of org.jgroups.blocks.atomic.Counter.incrementAndGet()


                                        "[4] Create counter [5] Delete counter\n" +
                                        "[6] Print counters [7] Get counter\n" +
                                        "[8] Increment 1M times [9] Dump pending requests [x] Exit\n");
                switch(key) {
                    case '1':
                        long val=counter.incrementAndGet();
                        System.out.println("counter: " + val);
                        break;
                    case '2':
                        val=counter.decrementAndGet();
                        System.out.println("counter: " + val);
View Full Code Here


                        System.out.println("");
                        int print=NUM / 10;
                        long retval=0;
                        long start=System.currentTimeMillis();
                        for(int i=0; i < NUM; i++) {
                            retval=counter.incrementAndGet();
                            if(i > 0 && i % print == 0)
                                System.out.println("-- count=" + retval);
                        }
                        long diff=System.currentTimeMillis() - start;
                        System.out.println("\n" + NUM + " incrs took " + diff + " ms; " + (NUM / (diff / 1000.0)) + " ops /sec\n");
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.