Package java.util.concurrent

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


                          sem.hasQueuedThreads() ? "true" : "false"));
            }
            if (badness[0] != null)
                throw new Error(badness[0]);
            if (sem.availablePermits() != 0)
              throw new Error(String.valueOf(sem.availablePermits()));
            if (sem.hasQueuedThreads())
              throw new Error(String.valueOf(sem.hasQueuedThreads()));
            if (sem.getQueueLength() != 0)
              throw new Error(String.valueOf(sem.getQueueLength()));
            if (sem.isFair() != fair)
View Full Code Here


        Ball black = new Ball(world, 200, 130, 3, 8, Color.black, barrier);
        black.start();
        balls.add(black);
        nap((int) (5000 * Math.random()));
        while(true) {
            while (barrier.availablePermits() < 4) {
                nap((int) (1000 * Math.random()));
            }
            nap((int) (1000 * Math.random()));
            try {
                barrier.acquire(4);
View Full Code Here

              session.publish(msg);
              done = true;
            }
          }
        }
        if ((!credit) && (currentWindowSemaphore.availablePermits() == 0))
        {
          synchronized (connectPhaseLock)
          {
            // the window is still closed.
            // Send a WindowProbeMsg message to wakeup the receiver in case the
View Full Code Here

                thread.join(60 * 1000);
                if (thread.isAlive())
                    throw new Error
                        (String.format
                         ("Semaphore stuck: permits %d, thread waiting %s%n",
                          sem.availablePermits(),
                          sem.hasQueuedThreads() ? "true" : "false"));
            }
            if (badness[0] != null)
                throw new Error(badness[0]);
            if (sem.availablePermits() != 0)
View Full Code Here

                          sem.availablePermits(),
                          sem.hasQueuedThreads() ? "true" : "false"));
            }
            if (badness[0] != null)
                throw new Error(badness[0]);
            if (sem.availablePermits() != 0)
              throw new Error(String.valueOf(sem.availablePermits()));
            if (sem.hasQueuedThreads())
              throw new Error(String.valueOf(sem.hasQueuedThreads()));
            if (sem.getQueueLength() != 0)
              throw new Error(String.valueOf(sem.getQueueLength()));
View Full Code Here

                          sem.hasQueuedThreads() ? "true" : "false"));
            }
            if (badness[0] != null)
                throw new Error(badness[0]);
            if (sem.availablePermits() != 0)
              throw new Error(String.valueOf(sem.availablePermits()));
            if (sem.hasQueuedThreads())
              throw new Error(String.valueOf(sem.hasQueuedThreads()));
            if (sem.getQueueLength() != 0)
              throw new Error(String.valueOf(sem.getQueueLength()));
            if (sem.isFair() != fair)
View Full Code Here

            Thread.sleep(1000);

            for ( int i = 0; i < attempts; ++i )
            {
                Assert.assertEquals(restartLatch.availablePermits(), 0);

                final int index = i;
                InstanceConfig changedInstanceConfig = new InstanceConfig()
                {
                    @Override
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.