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();
            }

            @Override
            public void add(ConnectionContext context, Destination destination)
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 actual = 0;
                while(!stopClients.get()) {
                    TextMessage msg = session.createTextMessage("Hello World");
                    msg.setLongProperty("id", actual++);
                    producer.send(msg);
                    sentCounter.incrementAndGet();
                }
            }
        });

        Thread consumer = startFailoverClient("consumer", new Client() {
View Full Code Here

                            ByteBuffer repdata = rpcClient.call(message);
                            if (repdata != null) {
                                callTimesOK.incrementAndGet();
                            }
                            else {
                                callTimesFailed.incrementAndGet();
                            }
                        }
                        catch (InterruptedException e) {
                            e.printStackTrace();
                        }
View Full Code Here

                                if (!result) {
                                    System.err.println(k + "\tSend message failed, error message:");
                                    Thread.sleep(1000);
                                }
                                else {
                                    sendTotalCnt.incrementAndGet();
                                }
                            }
                            catch (Exception e) {
                                System.out.println("sendMessage exception -------------");
                                e.printStackTrace();
View Full Code Here

                    }

                    @Override
                    public void notLeader()
                    {
                        dunceCounter.incrementAndGet();
                    }
                },
                exec
            );
            latches.add(latch);
View Full Code Here

                    // do not run timer task as it was not allowed
                    return;
                }

                try {
                    long count = counter.incrementAndGet();

                    boolean fire = endpoint.getRepeatCount() <= 0 || count <= endpoint.getRepeatCount();
                    if (fire) {
                        sendTimerExchange(count);
                    } else {
View Full Code Here

                            + 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

                try {
                    if(LOG.isDebugEnabled()) {
                        LOG.debug("Got my message: " + message);
                    }
                    receivedOneCondition.countDown();
                    received.incrementAndGet();
                    waitCondition.await(5, TimeUnit.MINUTES);
                    if(LOG.isDebugEnabled()) {
                        LOG.debug("acking message: " + message);
                    }
                    message.acknowledge();
View Full Code Here

        final AtomicLong received = new AtomicLong();
        sub = session.createDurableSubscriber(destination, "mySub");
        sub.setMessageListener(new MessageListener() {
            @Override
            public void onMessage(Message message) {
                received.incrementAndGet();
            }
        });

        LOG.info("Waiting for messages to arrive");
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.