Examples of tryAcquire()


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

        Activator a = new Activator();
        a.start(bctx);
       
        // Wait until the EndpointListener.endpointAdded call was made as the controlflow is asynchronous
        sema.tryAcquire(30, TimeUnit.SECONDS);
       
        c.verify();

    }

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

       
        rsaList.add(rsa);
       
        tm.triggerExportImportForRemoteSericeAdmin(rsa);
       
        assertTrue(sema.tryAcquire(10, TimeUnit.SECONDS));
       
       
        tm.stop();
       
        c.verify();

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

                semaphore.release();
            }
        }.start();
        m_repository.writeLocal(in);
        try {
            if (!semaphore.tryAcquire(30, TimeUnit.SECONDS)) {
                throw new IOException("Error writing the contents of RepositoryUserAdmin.");
            }
        }
        catch (InterruptedException e) {
            Thread.currentThread().interrupt();

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

                     }

                     message.getBodyBuffer().writeBytes(new byte[50]);

                     producer.send(message);
                     assertTrue(semop.tryAcquire(1, 10, TimeUnit.SECONDS));
                  }
               }
               catch (Throwable e)
               {
                  e.printStackTrace(System.out);

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

          try {
            s.acquire();
          } catch (InterruptedException ix) {}
        } else {
          try {
            s.tryAcquire(graceperiod, TimeUnit.MILLISECONDS);
          } catch (InterruptedException ix) {}
        }
      }
      result = bpcRef.get();
      st.close();

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

        creationSemaphore = new Semaphore(1, true);
        socketCreationMap.put(key, creationSemaphore);
      }
    }
    try {
      boolean retval = creationSemaphore.tryAcquire(10, TimeUnit.SECONDS);
      if (!retval) {
        throw new IOException("Could not acquire IO Semaphore'" + key
            + "' after 10 seconds -- giving up ");
      }
    } catch (InterruptedException e) {

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

                semaphore.drainPermits();
                _semaphores.putIfAbsent(thread, semaphore);
            }
            semaphore = _semaphores.get(thread);
            try {
                semaphore.tryAcquire(timeout, TimeUnit.MILLISECONDS);
            } catch (InterruptedException exception) {
                logger.log(Level.FINER, "Exception ", exception);
            }
        }

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

                int next = random.nextInt(100);
                countList.add(next);
                count.setCount(next);

                Assert.assertTrue(semaphore.tryAcquire(CLIENT_QTY, 10, TimeUnit.SECONDS));
            }
            count.setCount(-1);

            for ( Future<List<Integer>> future : futures )
            {

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

                creationSemaphore = new Semaphore(1, true);
                socketCreationMap.put(key, creationSemaphore);
            }
        }
        try {
            boolean retval = creationSemaphore.tryAcquire(10, TimeUnit.SECONDS);
            if (!retval) {
                throw new IOException("Could not acquire IO Semaphore'" + key
                        + "' after 10 seconds -- giving up ");
            }
        } catch (InterruptedException e) {

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

            }
        }
        s.release(notOwnedCount);
        try {
            if (ok.get()) {
                return s.tryAcquire(partitionCount, 10, TimeUnit.SECONDS) && ok.get();
            } else {
                return false;
            }
        } catch (InterruptedException ignored) {
            return false;
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.