Package EDU.oswego.cs.dl.util.concurrent

Examples of EDU.oswego.cs.dl.util.concurrent.Semaphore.attempt()


            // Give them 500 ms per loop
            maxElapsed = System.currentTimeMillis() + (500 * LOOP_COUNT);
            for (int i = 0; i <= count; i++)
            {
               long waitTime = maxElapsed - System.currentTimeMillis();
               assertTrue("Acquired thread " + i, semaphore.attempt(waitTime));
            }
           
            reacquired = true;
           
            // Ensure there were no exceptions
View Full Code Here


            // Give them 500 ms per loop
            maxElapsed = System.currentTimeMillis() + (500 * LOOP_COUNT);
            for (int i = 0; i <= count; i++)
            {
               long waitTime = maxElapsed - System.currentTimeMillis();
               assertTrue("Acquired thread " + i, semaphore.attempt(waitTime));
            }
           
            reacquired = true;
           
            // Ensure there were no exceptions
View Full Code Here

         TestingUtil.sleepThread(1000);
        
         // Reacquire the semaphore tickets; when we have them all
         // we know the threads are done        
         for (int i = 0; i < count; i++) {
            boolean acquired = semaphore.attempt(60000);
            if (!acquired)
               fail("failed to acquire semaphore " + i);
         }

         // Sleep to allow any async calls to clear
View Full Code Here

               // with too many messages sent after activation -- we want
               // to compare transferred state with the sender
               stressors[i].stopPuts();
               log.info("TEST: Run " + x + "-- /" + names[i] + " activated on A");
               // Reacquire one semaphore ticket
               boolean acquired = semaphore.attempt(60000);
               if (!acquired)
                  fail("failed to acquire semaphore " + names[i]);
               log.info("TEST: Run " + x + "-- acquired semaphore from " + names[i]);
              
               // Pause to allow other work to proceed
View Full Code Here

          TestingUtil.sleepThread((long)1000);

          // Reacquire the semaphore tickets; when we have them all
         // we know the threads are done        
         for (int i = 0; i < count; i++) {
            boolean acquired = semaphore.attempt(60000);
            if (!acquired)
               fail("failed to acquire semaphore " + i);
         }

         // Sleep to allow any async calls to clear
View Full Code Here

               // with too many messages sent after activation -- we want
               // to compare transferred state with the sender
               stressors[i].stopPuts();
               System.out.println("Run " + x + "-- /" + names[i] + " activated on A");
               // Reacquire one semaphore ticket
               boolean acquired = semaphore.attempt(60000);
               if (!acquired)
                  fail("failed to acquire semaphore " + i);
              
               // Pause to allow other work to proceed
                TestingUtil.sleepThread((long)100);
View Full Code Here

         TestingUtil.sleepThread(1000);
        
         // Reacquire the semaphore tickets; when we have them all
         // we know the threads are done        
         for (int i = 0; i < CACHE_COUNT; i++) {
            boolean acquired = semaphore.attempt(60000);
            if (!acquired)
               fail("failed to acquire semaphore " + i);
         }

         // Sleep to allow any async calls to clear
View Full Code Here

          TestingUtil.sleepThread((long)1000);

          // Reacquire the semaphore tickets; when we have them all
         // we know the threads are done        
         for (int i = 0; i < count; i++) {
            boolean acquired = semaphore.attempt(60000);
            if (!acquired)
               fail("failed to acquire semaphore " + i);
         }

         // Sleep to allow any async calls to clear
View Full Code Here

               // with too many messages sent after activation -- we want
               // to compare transferred state with the sender
               stressors[i].stopPuts();
               System.out.println("Run " + x + "-- /" + names[i] + " activated on A");
               // Reacquire one semaphore ticket
               boolean acquired = semaphore.attempt(60000);
               if (!acquired)
                  fail("failed to acquire semaphore " + i);
              
               // Pause to allow other work to proceed
                TestingUtil.sleepThread((long)100);
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.