Package edu.emory.mathcs.backport.java.util.concurrent.atomic

Examples of edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicInteger.incrementAndGet()


            private final AtomicInteger threadId = new AtomicInteger( 0 );

            public Thread newThread( Runnable runnable )
            {
                Thread t = originalThreadFactory.newThread( runnable );
                t.setName( ExecutorThreadModel.this.threadNamePrefix + '-' + threadId.incrementAndGet() );
                t.setDaemon( true );
                return t;
            }
        };
        tpe.setThreadFactory( newThreadFactory );
View Full Code Here


                        Queue queue = session.createTemporaryQueue();
                        QueueReceiver consumer = session.createReceiver(queue);
                        connection.start();
                       
                       
                        if (count.incrementAndGet() >= NUMBER){
                            synchronized(count){
                                count.notify();
                            }
                        }
                    }
View Full Code Here

            new Thread() {
                public void run() {
                    try {
                        barrier.await();
                        for( int i=0; i < ENQUEUE_COUNT/WORKER_COUNT; i++ ) {
                            queue.incrementAndGet();
                            runner.wakeup();
                            yield();
                        }
                    }
                    catch (BrokenBarrierException e) {
View Full Code Here

                            int counter=0;
                            // Get a least 1 message.
                            Message msg = receiveMessage(connection, 2000);
                            if( msg!=null ) {
                                printer.increment();
                                receiveCounter.incrementAndGet();
                               
                                counter++;
                               
                                // Try to piggy back a few extra message acks if they are ready.
                                Message extra=null;
View Full Code Here

                                // Try to piggy back a few extra message acks if they are ready.
                                Message extra=null;
                                while( (extra = receiveMessage(connection,0))!=null ) {
                                    msg=extra;
                                    printer.increment();
                                    receiveCounter.incrementAndGet();
                                    counter++;
                                }
                            }
                           
                           
View Full Code Here

        Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        destination = createDestination(session, destinationType);
        ActiveMQMessageConsumer consumer = (ActiveMQMessageConsumer) session.createConsumer(destination);
        consumer.setMessageListener(new MessageListener() {
            public void onMessage(Message m) {
                counter.incrementAndGet();
                if( counter.get()==1 )
                    done1.countDown();
                if( counter.get()==2 )
                    done2.countDown();
            }
View Full Code Here

        sendMessages(session, destination, 4);

        // See if the message get sent to the listener
        consumer.setMessageListener(new MessageListener() {
            public void onMessage(Message m) {
                counter.incrementAndGet();
                if( counter.get()==4 )
                    done.countDown();
            }
        });
View Full Code Here

            public void onMessage(Message m) {
                try {
                    TextMessage tm = (TextMessage)m;
                    log.info("Got in first listener: "+tm.getText());
                    assertEquals( ""+counter.get(), tm.getText() );
                    counter.incrementAndGet();
                    m.acknowledge();
                    if( counter.get()==2 ) {
                      sendDone.await();
                        connection.close();
                        got2Done.countDown();
View Full Code Here

            public void onMessage(Message m) {
                try {
                    TextMessage tm = (TextMessage)m;
                    log.info("Got in second listener: "+tm.getText());
                    assertEquals( ""+counter.get(), tm.getText() );
                    counter.incrementAndGet();
                    if( counter.get()==4 )
                        done2.countDown();
                } catch (Throwable e) {
                    e.printStackTrace();
                }
View Full Code Here

        Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        destination = createDestination(session, destinationType);
        MessageConsumer consumer = session.createConsumer(destination);
        consumer.setMessageListener(new MessageListener() {
            public void onMessage(Message m) {
                counter.incrementAndGet();
                if( counter.get()==4 )
                    done.countDown();
            }
        });
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.