Package java.util.concurrent.atomic

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


                        logger.info("**** starting indexing thread {}", indexerId);
                        while (!stop.get()) {
                            long id = idGenerator.incrementAndGet();
                            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


                        logger.info("**** starting indexing thread {}", indexerId);
                        while (!stop.get()) {
                            long id = idGenerator.incrementAndGet();
                            client("node2").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

        final CountDownLatch latch = new CountDownLatch(NUMBER_OF_CLIENTS * NUMBER_OF_ITERATIONS);
        for (int i = 0; i < NUMBER_OF_CLIENTS; i++) {
            clients[i] = new Thread(new Runnable() {
                @Override public void run() {
                    for (int j = 0; j < NUMBER_OF_ITERATIONS; j++) {
                        final long id = idGenerator.incrementAndGet();
                        BenchmarkMessage message = new BenchmarkMessage(id, payload);
                        BaseTransportResponseHandler<BenchmarkMessage> handler = new BaseTransportResponseHandler<BenchmarkMessage>() {
                            @Override public BenchmarkMessage newInstance() {
                                return new BenchmarkMessage();
                            }
View Full Code Here

        }
      };

      @Override
      public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        long requestNumber = _requestCounter.incrementAndGet();
        String requestId = prefix + "-" + requestNumber;
        String tracingConnectionString;
        String connectionString;
        if (controller) {
          ControllerServerContext controllerServerContext = ControllerServerContext.getControllerServerContext();
View Full Code Here

      blockCacheKey.setFile(file);

      if (blockCache.fetch(blockCacheKey, buffer)) {
        hitsInCache.incrementAndGet();
      } else {
        missesInCache.incrementAndGet();
      }

      byte[] testData = testData(random, blockSize, newData);
      long t1 = System.nanoTime();
      boolean store = blockCache.store(blockCacheKey, 0, testData, 0, blockSize);
View Full Code Here

        AtomicLong count = restartScoreDistribution.get(pair.getScore());
        if (count == null)
        {
          count = new AtomicLong();restartScoreDistribution.put(pair.getScore(),count);
        }
        count.incrementAndGet();
        restartsToIterations.put(pair, iterations);
        iterations = 0;
        topLevelListener.Restart(RestartLearningEnum.restartHARD);
      }
      else
View Full Code Here

        AtomicLong count = whichScoresWereUsedForMerging.get(pair.getScore());
        if (count == null)
        {
          count = new AtomicLong();whichScoresWereUsedForMerging.put(pair.getScore(),count);
        }
        count.incrementAndGet();
        scoresToIterations.put(pair, iterations);
        topLevelListener.Restart(RestartLearningEnum.restartNONE);
      }
     
      possibleMerges = topLevelListener.ChooseStatePairs(getTentativeAutomaton());
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

                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 (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

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.