Package org.apache.kafka.common.utils

Examples of org.apache.kafka.common.utils.SystemTime.sleep()


        final SystemTime time = new SystemTime();
        final AtomicBoolean done = new AtomicBoolean(false);
        final Object lock = new Object();
        Thread t1 = new Thread() {
            public void run() {
                time.sleep(1);
                int counter = 0;
                long start = time.nanoseconds();
                for (int i = 0; i < iters; i++) {
                    synchronized (lock) {
                        counter++;
View Full Code Here


        Thread t2 = new Thread() {
            public void run() {
                int counter = 0;
                while (!done.get()) {
                    time.sleep(1);
                    synchronized (lock) {
                        counter += 1;
                    }
                }
                System.out.println("Counter: " + counter);
View Full Code Here

        System.out.println("Testing locks");
        done.set(false);
        final ReentrantLock lock2 = new ReentrantLock();
        Thread t3 = new Thread() {
            public void run() {
                time.sleep(1);
                int counter = 0;
                long start = time.nanoseconds();
                for (int i = 0; i < iters; i++) {
                    lock2.lock();
                    counter++;
View Full Code Here

        Thread t4 = new Thread() {
            public void run() {
                int counter = 0;
                while (!done.get()) {
                    time.sleep(1);
                    lock2.lock();
                    counter++;
                    lock2.unlock();
                }
                System.out.println("Counter: " + counter);
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.