Examples of incrementAndGet()


Examples of com.hazelcast.core.IAtomicLong.incrementAndGet()

    public void testAtomicLong() throws Exception {
        String partitionKey = "hazelcast";
        HazelcastInstance hz = getHazelcastInstance(partitionKey);

        IAtomicLong atomicLong = hz.getAtomicLong("atomiclong@" + partitionKey);
        atomicLong.incrementAndGet();
        assertEquals("atomiclong@" + partitionKey, atomicLong.getName());
        assertEquals(partitionKey, atomicLong.getPartitionKey());

        AtomicLongService service = getNodeEngine(hz).getService(AtomicLongService.SERVICE_NAME);
        assertTrue(service.containsAtomicLong(atomicLong.getName()));
View Full Code Here

Examples of com.netflix.astyanax.util.BlockingConcurrentWindowCounter.incrementAndGet()

                // Write file data one block at a time
                boolean done = false;
                while (!done && exception.get() == null) {
                    // This throttles us so we don't get too far ahead of
                    // ourselves if one of the threads is stuck
                    final int chunkNumber = chunkCounter.incrementAndGet();

                    // Get a block or allocate a new one
                    final ByteBuffer bb = blocks.poll(new Supplier<ByteBuffer>() {
                        @Override
                        public ByteBuffer get() {
View Full Code Here

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

Examples of io.vertx.core.shareddata.Counter.incrementAndGet()

    assertNullPointerException(() -> getVertx().sharedData().getCounter(null, ar -> {}));
    assertNullPointerException(() -> getVertx().sharedData().getCounter("foo", null));
    getVertx().sharedData().getCounter("foo", ar -> {
      Counter counter = ar.result();
      assertNullPointerException(() -> counter.get(null));
      assertNullPointerException(() -> counter.incrementAndGet(null));
      assertNullPointerException(() -> counter.getAndIncrement(null));
      assertNullPointerException(() -> counter.decrementAndGet(null));
      assertNullPointerException(() -> counter.addAndGet(1, null));
      assertNullPointerException(() -> counter.getAndAdd(1, null));
      assertNullPointerException(() -> counter.compareAndSet(1, 1, null));
View Full Code Here

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

        });

        unicast.setUpProtocol(new Protocol() {
            public Object up(Event evt) {
                if(evt.getType() == Event.MSG) {
                    delivered_msgs.incrementAndGet();
                    UNICAST.UnicastHeader hdr=(UNICAST.UnicastHeader)((Message)evt.getArg()).getHeader(UNICAST_ID);
                    if(hdr != null)
                        delivered_msg_list.add(hdr.getSeqno());

                    if(delivered_msgs.get() >= num_msgs) {
View Full Code Here

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

        });

        unicast.setUpProtocol(new Protocol() {
            public Object up(Event evt) {
                if(evt.getType() == Event.MSG) {
                    delivered_msgs.incrementAndGet();
                    UNICAST2.Unicast2Header hdr=(UNICAST2.Unicast2Header)((Message)evt.getArg()).getHeader(UNICAST_ID);
                    if(hdr != null)
                        delivered_msg_list.add(hdr.getSeqno());

                    if(delivered_msgs.get() >= num_msgs) {
View Full Code Here

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

                threads[i]=new Thread() {
                    public void run() {
                        for(int j=0; j < msgs_per_thread; j++) {
                            Channel sender=Util.tossWeightedCoin(0.5) ? c1 : c2;
                            boolean oob=Util.tossWeightedCoin(oob_prob);
                            int num=counter.incrementAndGet();
                            Message msg=new Message(dest, null, num);
                            if(oob)
                               msg.setFlag(Message.OOB);
                            try {
                                sender.send(msg);
View Full Code Here

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

        nak.setDownProtocol(new Protocol() {public Object down(Event evt) {return null;}});

        nak.setUpProtocol(new Protocol() {
            public Object up(Event evt) {
                if(evt.getType() == Event.MSG) {
                    delivered_msgs.incrementAndGet();
                    NakAckHeader hdr=(NakAckHeader)((Message)evt.getArg()).getHeader(NAKACK_ID);
                    if(hdr != null)
                        delivered_msg_list.add(hdr.getSeqno());

                    if(delivered_msgs.get() >= num_msgs) {
View Full Code Here

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

            msg.putHeader(NAKACK_ID, hdr);
            boolean added=win.add(seqno, msg);

            if(added) {
                AtomicInteger val=map.get((long)seqno);
                val.incrementAndGet();
            }
        }

        protected void waitForBarrier() {
            try {
View Full Code Here

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

  public void testAtomicInteger()
    throws Exception
  {
    AtomicInteger seq = new AtomicInteger(47);
    assertEquals(48, seq.incrementAndGet());
  }

  @Override
  protected void setUp()
    throws Exception
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.