Examples of acquire()


Examples of com.google.code.http4j.impl.conn.ConnectionPool.acquire()

  public void setMaxConnectionsPerHost() throws InterruptedException,
      ExecutionException, TimeoutException, IOException {
    final ConnectionManager pool = new ConnectionPool();
    pool.setMaxConnectionsPerHost(1);
    try {
      Connection connection = pool.acquire(host);
      Assert.assertNotNull(connection);
      pool.release(connection);
      connection = pool.acquire(host);
      Assert.assertNotNull(connection);
      ExecutorService service = Executors.newSingleThreadExecutor();
View Full Code Here

Examples of com.google.code.http4j.impl.conn.ConnectionPool.acquire()

    pool.setMaxConnectionsPerHost(1);
    try {
      Connection connection = pool.acquire(host);
      Assert.assertNotNull(connection);
      pool.release(connection);
      connection = pool.acquire(host);
      Assert.assertNotNull(connection);
      ExecutorService service = Executors.newSingleThreadExecutor();
      service.invokeAny(Collections.singleton(new Callable<Connection>() {
        @Override
        public Connection call() throws Exception {
View Full Code Here

Examples of com.google.code.http4j.impl.conn.ConnectionPool.acquire()

      Assert.assertNotNull(connection);
      ExecutorService service = Executors.newSingleThreadExecutor();
      service.invokeAny(Collections.singleton(new Callable<Connection>() {
        @Override
        public Connection call() throws Exception {
          return pool.acquire(host);
        }
      }), 2, TimeUnit.SECONDS);
    } finally {
      pool.shutdown();
    }
View Full Code Here

Examples of com.google.code.http4j.impl.conn.ConnectionPool.acquire()

  public void setMaxConnectionsPerHost() throws InterruptedException,
      ExecutionException, TimeoutException, IOException {
    final ConnectionManager pool = new ConnectionPool();
    pool.setMaxConnectionsPerHost(1);
    try {
      Connection connection = pool.acquire(host);
      Assert.assertNotNull(connection);
      pool.release(connection);
      connection = pool.acquire(host);
      Assert.assertNotNull(connection);
      ExecutorService service = Executors.newSingleThreadExecutor();
View Full Code Here

Examples of com.google.code.http4j.impl.conn.ConnectionPool.acquire()

    pool.setMaxConnectionsPerHost(1);
    try {
      Connection connection = pool.acquire(host);
      Assert.assertNotNull(connection);
      pool.release(connection);
      connection = pool.acquire(host);
      Assert.assertNotNull(connection);
      ExecutorService service = Executors.newSingleThreadExecutor();
      service.invokeAny(Collections.singleton(new Callable<Connection>() {
        @Override
        public Connection call() throws Exception {
View Full Code Here

Examples of com.google.code.http4j.impl.conn.ConnectionPool.acquire()

      Assert.assertNotNull(connection);
      ExecutorService service = Executors.newSingleThreadExecutor();
      service.invokeAny(Collections.singleton(new Callable<Connection>() {
        @Override
        public Connection call() throws Exception {
          return pool.acquire(host);
        }
      }), 2, TimeUnit.SECONDS);
    } finally {
      pool.shutdown();
    }
View Full Code Here

Examples of com.google.common.util.concurrent.RateLimiter.acquire()

                    deleteHint(hostIdBytes, hint.name(), hint.maxTimestamp());
                    continue;
                }

                MessageOut<RowMutation> message = rm.createMessage();
                rateLimiter.acquire(message.serializedSize(MessagingService.current_version));
                WrappedRunnable callback = new WrappedRunnable()
                {
                    public void runMayThrow() throws IOException
                    {
                        rowsReplayed.incrementAndGet();
View Full Code Here

Examples of com.hazelcast.concurrent.semaphore.Permit.acquire()

    }

    @Override
    public void run() throws Exception {
        Permit permit = getPermit();
        permit.acquire(permitCount, firstCaller);
        response = true;
    }

    @Override
    public int getFactoryId() {
View Full Code Here

Examples of com.hazelcast.core.ISemaphore.acquire()

        semaphore.init(initialPermits);

        for (int i = 0; i < k; i++) {
            int rand = (int) (Math.random() * 5) + 1;

            semaphore.acquire(rand);
            initialPermits -= rand;
            assertEquals(initialPermits, semaphore.availablePermits());
            semaphore.release(rand);
            initialPermits += rand;
            assertEquals(initialPermits, semaphore.availablePermits());
View Full Code Here

Examples of com.netflix.astyanax.recipes.uniqueness.MultiRowUniquenessConstraint.acquire()

        ColumnPrefixUniquenessConstraint<String> singleUnique
            = new ColumnPrefixUniquenessConstraint<String>(keyspace, UNIQUE_CF, "testMultiLock_A")
                .withConsistencyLevel(ConsistencyLevel.CL_ONE)
                .withPrefix("prefix_");
        try {
            unique.acquire();
            String uniqueColumn = singleUnique.readUniqueColumn();
            Assert.assertEquals("abc", uniqueColumn);
            LOG.info("UniqueColumn: " + uniqueColumn);
        }
        catch (Exception e) {
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.