java.util.concurrent.atomic.LongAdder#longValue()源码实例Demo

下面列出了java.util.concurrent.atomic.LongAdder#longValue() 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: neural   文件: StandAloneLimiter.java
@Override
protected Acquire tryAcquireRequest() {
    if (cache == null) {
        return Acquire.SUCCESS;
    }

    try {
        LongAdder times = cache.get(System.currentTimeMillis() / 1000, LongAdder::new);
        if (limiterConfig.getRatePermit() > times.longValue()) {
            return Acquire.SUCCESS;
        }
    } catch (Exception e) {
        log.error("The try acquire memory rate limiter is exception", e);
        return Acquire.EXCEPTION;
    }

    return Acquire.FAILURE;
}
 
源代码2 项目: dragonwell8_jdk   文件: Serial.java
static void testLongAdder() {
    LongAdder a = new LongAdder();
    a.add(45);
    LongAdder result = echo(a);
    if (result.longValue() != a.longValue())
        throw new RuntimeException("Unexpected longValue");

    checkSerialClassName(a, "java.util.concurrent.atomic.LongAdder$SerializationProxy");
}
 
源代码3 项目: TencentKona-8   文件: Serial.java
static void testLongAdder() {
    LongAdder a = new LongAdder();
    a.add(45);
    LongAdder result = echo(a);
    if (result.longValue() != a.longValue())
        throw new RuntimeException("Unexpected longValue");

    checkSerialClassName(a, "java.util.concurrent.atomic.LongAdder$SerializationProxy");
}
 
源代码4 项目: native-obfuscator   文件: Serial.java
static void testLongAdder() {
    LongAdder a = new LongAdder();
    a.add(45);
    LongAdder result = echo(a);
    if (result.longValue() != a.longValue())
        throw new RuntimeException("Unexpected longValue");

    checkSerialClassName(a, "java.util.concurrent.atomic.LongAdder$SerializationProxy");
}
 
源代码5 项目: jdk8u60   文件: Serial.java
static void testLongAdder() {
    LongAdder a = new LongAdder();
    a.add(45);
    LongAdder result = echo(a);
    if (result.longValue() != a.longValue())
        throw new RuntimeException("Unexpected longValue");

    checkSerialClassName(a, "java.util.concurrent.atomic.LongAdder$SerializationProxy");
}
 
源代码6 项目: openjdk-jdk8u   文件: Serial.java
static void testLongAdder() {
    LongAdder a = new LongAdder();
    a.add(45);
    LongAdder result = echo(a);
    if (result.longValue() != a.longValue())
        throw new RuntimeException("Unexpected longValue");

    checkSerialClassName(a, "java.util.concurrent.atomic.LongAdder$SerializationProxy");
}
 
源代码7 项目: openjdk-jdk8u-backup   文件: Serial.java
static void testLongAdder() {
    LongAdder a = new LongAdder();
    a.add(45);
    LongAdder result = echo(a);
    if (result.longValue() != a.longValue())
        throw new RuntimeException("Unexpected longValue");

    checkSerialClassName(a, "java.util.concurrent.atomic.LongAdder$SerializationProxy");
}
 
源代码8 项目: openjdk-jdk9   文件: Serial.java
static void testLongAdder() {
    LongAdder a = new LongAdder();
    a.add(45);
    LongAdder result = echo(a);
    if (result.longValue() != a.longValue())
        throw new RuntimeException("Unexpected longValue");

    checkSerialClassName(a, "java.util.concurrent.atomic.LongAdder$SerializationProxy");
}
 
源代码9 项目: jdk8u-jdk   文件: Serial.java
static void testLongAdder() {
    LongAdder a = new LongAdder();
    a.add(45);
    LongAdder result = echo(a);
    if (result.longValue() != a.longValue())
        throw new RuntimeException("Unexpected longValue");

    checkSerialClassName(a, "java.util.concurrent.atomic.LongAdder$SerializationProxy");
}
 
源代码10 项目: hottub   文件: Serial.java
static void testLongAdder() {
    LongAdder a = new LongAdder();
    a.add(45);
    LongAdder result = echo(a);
    if (result.longValue() != a.longValue())
        throw new RuntimeException("Unexpected longValue");

    checkSerialClassName(a, "java.util.concurrent.atomic.LongAdder$SerializationProxy");
}
 
源代码11 项目: openjdk-8-source   文件: Serial.java
static void testLongAdder() {
    LongAdder a = new LongAdder();
    a.add(45);
    LongAdder result = echo(a);
    if (result.longValue() != a.longValue())
        throw new RuntimeException("Unexpected longValue");

    checkSerialClassName(a, "java.util.concurrent.atomic.LongAdder$SerializationProxy");
}
 
源代码12 项目: openjdk-8   文件: Serial.java
static void testLongAdder() {
    LongAdder a = new LongAdder();
    a.add(45);
    LongAdder result = echo(a);
    if (result.longValue() != a.longValue())
        throw new RuntimeException("Unexpected longValue");

    checkSerialClassName(a, "java.util.concurrent.atomic.LongAdder$SerializationProxy");
}
 
源代码13 项目: jdk8u_jdk   文件: Serial.java
static void testLongAdder() {
    LongAdder a = new LongAdder();
    a.add(45);
    LongAdder result = echo(a);
    if (result.longValue() != a.longValue())
        throw new RuntimeException("Unexpected longValue");

    checkSerialClassName(a, "java.util.concurrent.atomic.LongAdder$SerializationProxy");
}
 
源代码14 项目: jdk8u-jdk   文件: Serial.java
static void testLongAdder() {
    LongAdder a = new LongAdder();
    a.add(45);
    LongAdder result = echo(a);
    if (result.longValue() != a.longValue())
        throw new RuntimeException("Unexpected longValue");

    checkSerialClassName(a, "java.util.concurrent.atomic.LongAdder$SerializationProxy");
}
 
源代码15 项目: jdk8u-dev-jdk   文件: Serial.java
static void testLongAdder() {
    LongAdder a = new LongAdder();
    a.add(45);
    LongAdder result = echo(a);
    if (result.longValue() != a.longValue())
        throw new RuntimeException("Unexpected longValue");

    checkSerialClassName(a, "java.util.concurrent.atomic.LongAdder$SerializationProxy");
}
 
源代码16 项目: bgpcep   文件: EffectiveRibInWriter.java
@Override
public long getPrefixedReceivedCount(final TablesKey tablesKey) {
    final LongAdder counter = this.prefixesReceived.get(tablesKey);
    if (counter == null) {
        return 0;
    }
    return counter.longValue();
}
 
源代码17 项目: bgpcep   文件: EffectiveRibInWriter.java
@Override
public long getPrefixedInstalledCount(final TablesKey tablesKey) {
    final LongAdder counter = this.prefixesInstalled.get(tablesKey);
    if (counter == null) {
        return 0;
    }
    return counter.longValue();
}
 
@Override
public long getCurrentSession(Transport transport) {
    LongAdder counter = transportCounter.get(transport.getId());
    return counter == null ? 0 : counter.longValue();
}
 
源代码19 项目: hbase-operator-tools   文件: RegionsMerger.java
public void mergeRegions(String tblName, int targetRegions) throws Exception {
  TableName table = TableName.valueOf(tblName);
  Path tableDir = getTablePath(table);
  try(Connection conn = ConnectionFactory.createConnection(conf)) {
    Admin admin = conn.getAdmin();
    LongAdder counter = new LongAdder();
    LongAdder lastTimeProgessed = new LongAdder();
    //need to get all regions for the table, regardless of region state
    List<RegionInfo> regions = admin.getRegions(table);
    Map<Future, Pair<RegionInfo, RegionInfo>> regionsMerging = new ConcurrentHashMap<>();
    long roundsNoProgress = 0;
    while (regions.size() > targetRegions) {
      LOG.info("Iteration: {}", counter);
      RegionInfo previous = null;
      int regionSize = regions.size();
      LOG.info("Attempting to merge {} regions to reach the target {} ...", regionSize, targetRegions);
      //to request merge, regions must be OPEN, though
      regions = getOpenRegions(conn, table);
      for (RegionInfo current : regions) {
        if (!current.isSplit()) {
          if (previous != null && canMerge(tableDir, previous, current, regionsMerging.values())) {
            Future f = admin.mergeRegionsAsync(current.getEncodedNameAsBytes(),
                previous.getEncodedNameAsBytes(), true);
            Pair<RegionInfo, RegionInfo> regionPair = new Pair<>(previous, current);
            regionsMerging.put(f,regionPair);
            previous = null;
            if ((regionSize - regionsMerging.size()) <= targetRegions) {
              break;
            }
          } else {
            previous = current;
          }
        }
        else{
          LOG.debug("Skipping split region: {}", current.getEncodedName());
        }
      }
      counter.increment();
      LOG.info("Sleeping for {} seconds before next iteration...", (sleepBetweenCycles/1000));
      Thread.sleep(sleepBetweenCycles);
      regionsMerging.forEach((f, currentPair)-> {
        if (f.isDone()) {
          LOG.info("Merged regions {} and {} together.",
            currentPair.getFirst().getEncodedName(),
            currentPair.getSecond().getEncodedName());
          regionsMerging.remove(f);
          lastTimeProgessed.reset();
          lastTimeProgessed.add(counter.longValue());
        } else {
          LOG.warn("Merge of regions {} and {} isn't completed yet.",
            currentPair.getFirst(),
            currentPair.getSecond());
        }
      });
      roundsNoProgress = counter.longValue() - lastTimeProgessed.longValue();
      if(roundsNoProgress == this.maxRoundsStuck){
        LOG.warn("Reached {} iterations without progressing with new merges. Aborting...",
          roundsNoProgress);
        break;
      }

      //again, get all regions, regardless of the state,
      // in order to avoid breaking the loop prematurely
      regions = admin.getRegions(table);
    }
  }
}
 
源代码20 项目: smart-socket   文件: MonitorPlugin.java
private long getAndReset(LongAdder longAdder) {
    long result = longAdder.longValue();
    longAdder.add(-result);
    return result;
}