Package java.util.concurrent.atomic

Examples of java.util.concurrent.atomic.AtomicLong.incrementAndGet()


                            + node.getMessageId().getProducerSequenceId());
                }
                assertEquals("is in order", enqueueCounter.get(), node
                        .getMessageId().getProducerSequenceId());
                receivedLatch.countDown();
                enqueueCounter.incrementAndGet();
                node.decrementReferenceCount();
            }

            public void add(ConnectionContext context, Destination destination)
                    throws Exception {
View Full Code Here


            public void onMessage(Message message) {
                try {
                    LOG.info("Got my message: " + message);
                    receivedOneCondition.countDown();
                    received.incrementAndGet();
                    waitCondition.await(60, TimeUnit.SECONDS);
                    LOG.info("acking message: " + message);
                    message.acknowledge();
                } catch (Exception e) {
                    e.printStackTrace();
View Full Code Here

        long start = System.currentTimeMillis();
        try {
          long end = System.currentTimeMillis();
          while (end - start < 3000) {
            if (consumer.receive(1000) != null) {
                received.incrementAndGet();
            }
            Thread.sleep(100);
            end = System.currentTimeMillis();
          }
          consumer.close();
View Full Code Here

        long start = System.currentTimeMillis();
        try {
          long end = System.currentTimeMillis();
          while (end - start < 3000) {
            if (consumer.receive(1000) != null) {
                received.incrementAndGet();
            }
            Thread.sleep(100);
            end = System.currentTimeMillis();
          }
          consumer.close();
View Full Code Here

            }
        }, 1, 1, TimeUnit.SECONDS);

        while (true) {
            executor.execute(new CommitlogExecutor());
            count.incrementAndGet();
        }
    }

    private static long mb(long maxMemory) {
        return maxMemory / (1024 * 1024);
 
View Full Code Here

        // test overflow case
        AtomicLong overflowCount = new AtomicLong(0xFFFFFFFFFFFFFFFFL);
       
        correlationID =
            JMSUtils.createCorrelationId(conduitId, overflowCount.incrementAndGet());
       
        expected = conduitId + "0000000000000000";
        assertEquals("The correlationID value does not match expected value",
                     expected, correlationID);
        assertEquals("The correlationID value does not match expected length",
View Full Code Here

                48, correlationID.length());
       
        // test sequential flow
        AtomicLong messageSequenceCount = new AtomicLong(0);
        correlationID =
            JMSUtils.createCorrelationId(conduitId, messageSequenceCount.incrementAndGet());
       
        expected = conduitId + "0000000000000001";
        assertEquals("The correlationID value does not match expected value",
                     expected, correlationID);
        assertEquals("The correlationID value does not match expected length",
View Full Code Here

                     expected, correlationID);
        assertEquals("The correlationID value does not match expected length",
                     48, correlationID.length());

        correlationID =
            JMSUtils.createCorrelationId(conduitId, messageSequenceCount.incrementAndGet());

        expected = conduitId + "0000000000000002";
        assertEquals("The correlationID value does not match expected value",
                     expected, correlationID);
        assertEquals("The correlationID value does not match expected length",
View Full Code Here

                if (c == null)
                {
                    c = new AtomicLong();
                    timeoutsPerHost.put(ip, c);
                }
                c.incrementAndGet();
                // we only create AtomicLong instances here, so that the write
                // access to the hashmap happens single-threadedly.
                if (recentTimeoutsPerHost.get(ip) == null)
                    recentTimeoutsPerHost.put(ip, new AtomicLong());
View Full Code Here

                            if (id % 1000 == 0) {
                                client("node1").admin().indices().prepareFlush().execute().actionGet();
                            }
                            client("node1").prepareIndex("test", "type1", Long.toString(id))
                                    .setSource(MapBuilder.<String, Object>newMapBuilder().put("test", "value" + id).map()).execute().actionGet();
                            indexCounter.incrementAndGet();
                        }
                        logger.info("**** done indexing thread {}", indexerId);
                    } catch (Exception e) {
                        logger.warn("**** failed indexing thread {}", e, indexerId);
                    } finally {
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.