Package java.util.concurrent

Examples of java.util.concurrent.Semaphore.drainPermits()


                        }
                    }
                );

                connectionString.set(secondConnectionString);
                semaphore.drainPermits();
                semaphore.acquire();

                server.stop()// create situation where the current zookeeper gets a sys-disconnected

                Stat        stat = RetryLoop.callWithRetry
View Full Code Here


        public void waitForEvent(long timeout) {
            Thread thread = Thread.currentThread();
            Semaphore semaphore = _semaphores.get(thread);
            if (semaphore == null) {
                semaphore = new Semaphore(1, true);
                semaphore.drainPermits();
                _semaphores.putIfAbsent(thread, semaphore);
            }
            semaphore = _semaphores.get(thread);
            try {
                semaphore.tryAcquire(timeout, TimeUnit.MILLISECONDS);
View Full Code Here

    public void resetPermits() {
        for (Entry<Integer, Semaphore> e : m_permits.entrySet()) {
            int type = e.getKey();
            Semaphore permits = e.getValue();

            permits.drainPermits();
            permits.release(m_initialPermits.get(type));
        }
    }

    /**
 
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.