Package java.util.concurrent.atomic

Examples of java.util.concurrent.atomic.AtomicInteger.intValue()


    }
    for (int i = 0; i < 2*N; ++i) {
      threads[i].join();
    }
    assertEquals(2*N + " " + N + " " + N,
        a.intValue() + " " + servlet.gets.intValue() + " " + servlet.posts.intValue());
    server.stop();
  }

  private final class TestListener implements ServerListener {
    public boolean stopped;
View Full Code Here


            LOG.trace("Starting to submit parallel tasks");

            while (it.hasNext()) {
                final ProcessorExchangePair pair = it.next();
                final Exchange subExchange = pair.getExchange();
                updateNewExchange(subExchange, total.intValue(), pairs, it);

                completion.submit(new Callable<Exchange>() {
                    public Exchange call() throws Exception {
                        // only start the aggregation task when the task is being executed to avoid staring
                        // the aggregation task to early and pile up too many threads
View Full Code Here

            LOG.trace("Starting to submit parallel tasks");

            while (it.hasNext()) {
                final ProcessorExchangePair pair = it.next();
                final Exchange subExchange = pair.getExchange();
                updateNewExchange(subExchange, total.intValue(), pairs, it);

                completion.submit(new Callable<Exchange>() {
                    public Exchange call() throws Exception {
                        // only start the aggregation task when the task is being executed to avoid staring
                        // the aggregation task to early and pile up too many threads
View Full Code Here

            LOG.trace("Starting to submit parallel tasks");

            while (it.hasNext()) {
                final ProcessorExchangePair pair = it.next();
                final Exchange subExchange = pair.getExchange();
                updateNewExchange(subExchange, total.intValue(), pairs, it);

                completion.submit(new Callable<Exchange>() {
                    public Exchange call() throws Exception {
                        // only start the aggregation task when the task is being executed to avoid staring
                        // the aggregation task to early and pile up too many threads
View Full Code Here

        public void setNextReader(AtomicReaderContext sub) {
        }

        @Override
        public void collect(int doc) {
          assertTrue("collected doc=" + doc + " beyond max=" + end, doc < end.intValue());
          hits.set(doc);
        }

        @Override
        public void setScorer(Scorer scorer) {
View Full Code Here

        public boolean acceptsDocsOutOfOrder() {
          return true;
        }
      };

    while (end.intValue() < docCount) {
      final int inc = _TestUtil.nextInt(random(), 1, 1000);
      end.getAndAdd(inc);
      scorer.score(c, end.intValue(), -1);
    }
View Full Code Here

      };

    while (end.intValue() < docCount) {
      final int inc = _TestUtil.nextInt(random(), 1, 1000);
      end.getAndAdd(inc);
      scorer.score(c, end.intValue(), -1);
    }

    assertEquals(docCount, hits.cardinality());
    r.close();
    dir.close();
View Full Code Here

               } };

      CompositeConverter compositeConverter = new CompositeConverter(converters);
      Object result = compositeConverter.convert(".");
      Assert.assertTrue(result instanceof String);
      Assert.assertEquals(2, counter.intValue());
   }
}
View Full Code Here

        // yet delivered to the client application (i.e. MessageListener#onMessage()) when the Connection#stop() occurs.
        //
        // The number of messages moved + the number consumed + any messages remaining on source should
        // *always* be equal to the number we originally sent.

        int numberOfMessagesReadByConsumer = totalConsumed.intValue();
        int numberOfMessagesOnDestinationQueue = _managedDestinationQueue.getMessageCount().intValue();
        int numberOfMessagesRemainingOnSourceQueue = _managedSourceQueue.getMessageCount().intValue();

        LOGGER.debug("Async consumer read : " + numberOfMessagesReadByConsumer
                + " Number of messages moved to destination : " + numberOfMessagesOnDestinationQueue
View Full Code Here

        startAsyncConsumerOn(_destinationQueue, asyncConnection, allMessagesConsumedLatch, totalConsumed);

        _managedSourceQueue.moveMessages(fromMessageId, toMessageId, _destinationQueueName);

        allMessagesConsumedLatch.await(5000, TimeUnit.MILLISECONDS);
        assertEquals("Did not consume all messages from destination queue", numberOfMessagesToSend, totalConsumed.intValue());
    }

    /**
     * Tests {@link ManagedQueue#moveMessages(long, long, String)} interface.
     */
 
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.