Examples of tryAcquire()


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

  public static void waitForEvent(int occurrences, String event, long timeout) {
    log.debug("waiting for " + event);
    Semaphore eventSemaphore = getEventSemaphore(event);
    try {
      if (eventSemaphore.tryAcquire(occurrences, timeout, TimeUnit.MILLISECONDS)) {
        log.debug("received '" + event + "' notification");
      }
      else {
        throw new JbpmException("event '" + event + "' did not occur within " + timeout + " ms");
      }

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

            blockUntilViewsReceived(channels, 60000);
           

            // Re-acquire the semaphore tickets; when we have them all
            // we know the threads are done
            boolean acquired = semaphore.tryAcquire(count, 20, TimeUnit.SECONDS);
            if(!acquired){
                log.warn("Most likely a bug, analyse the stack below:");
                log.warn(Util.dumpThreads());
            }                
            Util.sleep(1000);

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

            // Sleep to ensure the threads get all the semaphore tickets
            Util.sleep(1000);

            // Reacquire the semaphore tickets; when we have them all
            // we know the threads are done
            boolean acquired = semaphore.tryAcquire(count, 30, TimeUnit.SECONDS);
            if(!acquired){
                log.warn("Most likely a bug, analyse the stack below:");
                log.warn(Util.dumpThreads());
            }

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

  {
    Semaphore sem = semaphore;
   
    if (sem != null)
    {
      return sem.tryAcquire(timeout, TimeUnit.MILLISECONDS);
    }
    else
    {
      return true;
    }

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

        Util.sleep(1000);

        // Reacquire the semaphore tickets; when we have them all
        // we know the threads are done
        boolean acquired = semaphore.tryAcquire( apps.length, 30, TimeUnit.SECONDS);
        if(!acquired){
            log.warn("Most likely a bug, analyse the stack below:");
            log.warn(Util.dumpThreads());
        }
                     

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

            blockUntilViewsReceived(channels, 60000);

            // Reacquire the semaphore tickets; when we have them all
            // we know the threads are done
            boolean acquired = semaphore.tryAcquire(channelCount, 60, TimeUnit.SECONDS);
            if(!acquired){
                log.warn("Most likely a bug, analyse the stack below:");
                log.warn(Util.dumpThreads());
            }

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

            // Sleep to ensure the threads get all the semaphore tickets
            Util.sleep(1000);

            // Reacquire the semaphore tickets; when we have them all
            // we know the threads are done
            boolean acquired = semaphore.tryAcquire(count, 20, TimeUnit.SECONDS);
            if(!acquired){
                log.warn("Most likely a bug, analyse the stack below:");
                log.warn(Util.dumpThreads());
            }

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

        // Sleep to ensure the threads get all the semaphore tickets
        Util.sleep(1000);

        // Reacquire the semaphore tickets; when we have them all
        // we know the threads are done
        s.tryAcquire(1, 60, TimeUnit.SECONDS);
        receivers[0].cleanup();
        Util.sleep(1000);

        checkEventStateTransferSequence(receivers[0]);

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

            // Sleep to ensure the threads get all the semaphore tickets
            Util.sleep(1000);

            // Reacquire the semaphore tickets; when we have them all
            // we know the threads are done
            semaphore.tryAcquire(count, 60, TimeUnit.SECONDS);

            // do general asserts about channels
            a.verify(channels);

            // kill random member

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

                }, null);
            }
        }

        // Wait until all updates return
        if(!sem.tryAcquire(ClientBase.CONNECTION_TIMEOUT, TimeUnit.MILLISECONDS)) {
            LOG.warn("Did not aquire semaphore fast enough");
        }
        mytestfooThread.join(ClientBase.CONNECTION_TIMEOUT);
        if (mytestfooThread.isAlive()) {
            LOG.error("mytestfooThread is still alive");
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.