gpt4 book ai didi

org.infinispan.counter.api.WeakCounter.add()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-27 11:17:05 30 4
gpt4 key购买 nike

本文整理了Java中org.infinispan.counter.api.WeakCounter.add()方法的一些代码示例,展示了WeakCounter.add()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WeakCounter.add()方法的具体详情如下:
包路径:org.infinispan.counter.api.WeakCounter
类名称:WeakCounter
方法名:add

WeakCounter.add介绍

[英]Adds the given value to the new value.
[中]将给定值与新值相加。

代码示例

代码示例来源:origin: org.infinispan/infinispan-commons

/**
* Decrements the counter.
*/
default CompletableFuture<Void> decrement() {
 return add(-1L);
}

代码示例来源:origin: org.infinispan/infinispan-commons

/**
* Increments the counter.
*/
default CompletableFuture<Void> increment() {
 return add(1L);
}

代码示例来源:origin: org.infinispan/infinispan-commons

/**
* @see WeakCounter#add(long)
*/
@Override
public void add(long delta) {
 awaitCounterOperation(counter.add(delta));
}

代码示例来源:origin: org.infinispan/infinispan-server-hotrod

void counterAddAndGet(HotRodHeader header, Subject subject, String counterName, long value) {
 applyCounter(header, counterName,
    (h, counter) -> counter.addAndGet(value).whenComplete((value1, throwable) -> longResultHandler(h, value1, throwable)),
    (h, counter) -> counter.add(value).whenComplete((value2, throwable1) -> longResultHandler(h, 0L, throwable1)));
}

代码示例来源:origin: org.infinispan/infinispan-server-hotrod

@Override
public void add(WeakCounter counter, long delta, long result) {
 awaitCounterOperation(counter.add(delta));
}

代码示例来源:origin: infinispan/infinispan-simple-tutorials

counter3.add(5).thenAccept(aVoid -> System.out.println("Adding 5 to counter-3 completed!")).get();

代码示例来源:origin: infinispan/infinispan-simple-tutorials

counter3.add(5).thenAccept(aVoid -> System.out.println("Adding 5 to counter-3 completed!")).get();

代码示例来源:origin: org.infinispan/infinispan-clustered-counter

private void addToWeakCounter(String name, long delta) {
 awaitCounterOperation(counterManager(0).getWeakCounter(name).add(delta));
}

代码示例来源:origin: org.infinispan/infinispan-clustered-counter

public void testSingleConcurrencyLevel() throws ExecutionException, InterruptedException {
 final CounterManager counterManager = EmbeddedCounterManagerFactory.asCounterManager(manager(0));
 final String counterName = "c1-counter";
 counterManager.defineCounter(counterName,
    CounterConfiguration.builder(CounterType.WEAK).concurrencyLevel(1).build());
 WeakCounter wc = counterManager.getWeakCounter(counterName);
 wc.add(2).get();
 assertEquals(2, wc.getValue());
}

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com