Examples of availablePermits()


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

         // Release the semaphore to allow the threads to start work
         semaphore.release(count);

         // Sleep to ensure the threads get all the semaphore tickets
         while (semaphore.availablePermits() != 0) TestingUtil.sleepThread(100);

         // Reacquire the semaphore tickets; when we have them all
         // we know the threads are done
         for (int i = 0; i < count; i++)
         {
View Full Code Here

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

                                try
                                {
                                    if ( isFirst.compareAndSet(true, false) )
                                    {
                                        semaphore.release(THREAD_QTY - 1);
                                        while ( semaphore.availablePermits() > 0 )
                                        {
                                            Thread.sleep(100);
                                        }
                                    }
                                    else
View Full Code Here

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

                                try
                                {
                                    if ( isFirst.compareAndSet(true, false) )
                                    {
                                        semaphore.release(THREAD_QTY - 1);
                                        while ( semaphore.availablePermits() > 0 )
                                        {
                                            Thread.sleep(100);
                                        }
                                    }
                                    else
View Full Code Here

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

    public Set<AggregateNumericMetric> run() {
        log.info("Starting metrics data aggregation");
        Stopwatch stopwatch = Stopwatch.createStarted();
        Semaphore permits = new Semaphore(batchSize * parallelism);

        log.debug("Allocating " + permits.availablePermits() + " permits");

        int num1Hour = 0;
        int num6Hour = 0;
        int num24Hour = 0;
        try {
View Full Code Here

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

            public void run() {
                async.run();
            }
        });
        // drain checkpoint permits
        checkpoint.acquireUninterruptibly(checkpoint.availablePermits());
        // block NodeStore.retrieve()
        retrieve.acquireUninterruptibly();
        t.start();

        // wait until async update called checkpoint
View Full Code Here

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

         // Release the semaphore to allow the threads to start work
         semaphore.release(count);

         // Sleep to ensure the threads get all the semaphore tickets
         while (semaphore.availablePermits() != 0) TestingUtil.sleepThread(100);

         // Reacquire the semaphore tickets; when we have them all
         // we know the threads are done
         for (int i = 0; i < count; i++)
         {
View Full Code Here

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

                            try
                            {
                                if ( isFirst.compareAndSet(true, false) )
                                {
                                    semaphore.release(THREAD_QTY - 1);
                                    while ( semaphore.availablePermits() > 0 )
                                    {
                                        Thread.sleep(100);
                                    }
                                }
                                else
View Full Code Here

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

            catch ( Exception ignore )
            {
                // ignore
            }

            Assert.assertTrue(semaphore.availablePermits() == 0);
            Assert.assertFalse(selector.hasLeadership());

            selector.requeue();
            Assert.assertTrue(timing.multiple(4).acquireSemaphore(semaphore));
        }
View Full Code Here

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

            catch ( Exception ignore )
            {
                // ignore
            }

            Assert.assertTrue(semaphore.availablePermits() == 0);
            Assert.assertFalse(selector.hasLeadership());

            selector.requeue();
            Assert.assertTrue(timing.multiple(4).acquireSemaphore(semaphore));
        }
View Full Code Here

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

                                try
                                {
                                    if ( isFirst.compareAndSet(true, false) )
                                    {
                                        semaphore.release(THREAD_QTY - 1);
                                        while ( semaphore.availablePermits() > 0 )
                                        {
                                            Thread.sleep(100);
                                        }
                                    }
                                    else
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.