Package java.util.concurrent.atomic

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


            startLatch.countDown();
            startLatch.await();
            // half batch, half do not
            if(id % 2 == 0) {
              for(String s : expected) {
                wal.writeEntry(new WALEntry<Text>(new Text(s), seqid.incrementAndGet()));
              }
            } else {
              List<WALEntry<Text>> batch = Lists.newArrayList();
              for(String s : expected) {
                batch.add(new WALEntry<Text>(new Text(s), seqid.incrementAndGet()));
View Full Code Here


                wal.writeEntry(new WALEntry<Text>(new Text(s), seqid.incrementAndGet()));
              }
            } else {
              List<WALEntry<Text>> batch = Lists.newArrayList();
              for(String s : expected) {
                batch.add(new WALEntry<Text>(new Text(s), seqid.incrementAndGet()));
              }
              wal.writeEntries(batch);
            }
          } catch (Exception e) {
            logger.warn("Error doing appends", e);
View Full Code Here

                  if (i%100==0) {
                    region.compactStores();
                  }
                }
              }
              long ts = timeStamps.incrementAndGet();
              RowMutations rm = new RowMutations(row);
              if (op) {
                Put p = new Put(row, ts);
                p.add(fam1, qual1, value1);
                rm.add(p);
View Full Code Here

                  if (i%100==0) {
                    region.compactStores();
                  }
                }
              }
              long ts = timeStamps.incrementAndGet();
              List<Mutation> mrm = new ArrayList<Mutation>();
              if (op) {
                Put p = new Put(row2, ts);
                p.add(fam1, qual1, value1);
                mrm.add(p);
View Full Code Here

    for (int i = 0; i < 20; i++) {
      completionService.submit(new Callable<Void>() {
        @Override
        public Void call() {
          try {
            Put put = new Put(txnId.incrementAndGet(),
              WriteOrderOracle.next(), eventIn);
            ByteBuffer bytes = TransactionEventRecord.toByteBuffer(put);
            writer.put(bytes);
            writer.commit(TransactionEventRecord.toByteBuffer(
              new Commit(txnId.get(), WriteOrderOracle.next())));
View Full Code Here

                  }
               };

               synchronized(numExecutingOutputs)
               {
                  numExecutingOutputs.incrementAndGet();
               }

               if (executorService != null)
               {
                  try
View Full Code Here

         session = new ZookeeperSession("127.0.0.1:" + port,5000) {
            @Override
            public WatcherProxy makeWatcherProxy(ClusterInfoWatcher w)
            {
                     processCount.incrementAndGet();
                     return super.makeWatcherProxy(w);
            };
         };
         sessionRef.set(session);
View Full Code Here

    final AtomicLong tx = new AtomicLong(0);
    UploadProgress progress = new UploadProgress() {
      public void onUpload(long transferred, long total) {
        assertEquals(file.length(), total);
        assertEquals(tx.incrementAndGet(), transferred);
      }
    };
    post(url).bufferSize(1).progress(progress).send(file).code();
    assertEquals(file.length(), tx.get());
  }
View Full Code Here

    InputStream input = new FileInputStream(file);
    final AtomicLong tx = new AtomicLong(0);
    UploadProgress progress = new UploadProgress() {
      public void onUpload(long transferred, long total) {
        assertEquals(-1, total);
        assertEquals(tx.incrementAndGet(), transferred);
      }
    };
    post(url).bufferSize(1).progress(progress).send(input).code();
    assertEquals(file.length(), tx.get());
  }
View Full Code Here

    final byte[] bytes = "hello".getBytes(CHARSET_UTF8);
    final AtomicLong tx = new AtomicLong(0);
    UploadProgress progress = new UploadProgress() {
      public void onUpload(long transferred, long total) {
        assertEquals(bytes.length, total);
        assertEquals(tx.incrementAndGet(), transferred);
      }
    };
    post(url).bufferSize(1).progress(progress).send(bytes).code();
    assertEquals(bytes.length, tx.get());
  }
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.