com.google.common.util.concurrent.AtomicLongMap#addAndGet ( )源码实例Demo

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

源代码1 项目: pinpoint   文件: AtomicLongMapTest.java
@Test
public void testIncrement() throws Exception {
    AtomicLongMap<String> cache = AtomicLongMap.create();
    cache.addAndGet("a", 1L);
    cache.addAndGet("a", 2L);
    cache.addAndGet("b", 5L);


    Map<String, Long> remove = AtomicLongMapUtils.remove(cache);
    Assert.assertEquals((long) remove.get("a"), 3L);
    Assert.assertEquals((long) remove.get("b"), 5L);

    cache.addAndGet("a", 1L);
    Map<String, Long> remove2 = AtomicLongMapUtils.remove(cache);
    Assert.assertEquals((long) remove2.get("a"), 1L);
}
 
源代码2 项目: bistoury   文件: ProfilerDataDumper.java
private void dumpAllState(DumpData dumpData) {
    AtomicLongMap<Integer> allStateMap = AtomicLongMap.create();
    List<Map<Integer, Long>> allRecord = ImmutableList.of(dumpData.getBlockedTimes(), dumpData.getRunnableCpuTimes(),
            dumpData.getTimedWaitingTimes(), dumpData.getWaitingTimes());
    for (Map<Integer, Long> cpuTime : allRecord) {
        for (Map.Entry<Integer, Long> entry : cpuTime.entrySet()) {
            allStateMap.addAndGet(entry.getKey(), entry.getValue());
        }
    }
    doDump(allStateMap.asMap(), Manager.getAllStatePath(), false);
    doDump(allStateMap.asMap(), Manager.getFilterAllStatePath(), true);
}
 
源代码3 项目: metanome-algorithms   文件: ResultCompletion.java
private AtomicLongMap<PartitionRefiner> createSelectivityEstimation(IEvidenceSet sampleEvidence,
		Set<PredicatePair> predicatePairs) {
	AtomicLongMap<PartitionRefiner> selectivityCount = AtomicLongMap.create();
	for (PredicateBitSet ps : sampleEvidence) {
		int count = (int) sampleEvidence.getCount(ps);
		ps.forEach(p -> {
			selectivityCount.addAndGet(p, count);
		});
		for (PredicatePair pair : predicatePairs)
			if (pair.bothContainedIn(ps)) {
				selectivityCount.addAndGet(pair, sampleEvidence.getCount(ps));
			}
	}
	return selectivityCount;
}
 
源代码4 项目: pinpoint   文件: AtomicLongMapTest.java
@Test
public void testIntegerMax() throws Exception {
    AtomicLongMap<String> cache = AtomicLongMap.create();
    cache.addAndGet("a", 1L);
    cache.addAndGet("a", 2L);
    cache.addAndGet("b", 5L);
}
 
源代码5 项目: pinpoint   文件: AtomicLongMapTest.java
@Test
public void testIntegerMin() throws Exception {
    AtomicLongMap<String> cache = AtomicLongMap.create();
    cache.addAndGet("a", 1L);
    cache.addAndGet("a", 2L);
    cache.addAndGet("b", 5L);

}