Giriş
Şu satırı dahil ederiz
import com.hazelcast.cp.IAtomicLong;
alterAsync metodu
Örnek
Şöyle yaparız
import com.hazelcast.core.IFunction; IAtomicLong atomicLong = ...; atomicLong.set(2L); CompletionStage<Void> completionStage = atomicLong.alterAsync(new MultiplyByTwo()); completionStage.toCompletableFuture().get(); Long result = atomicLong.get(); // 4 public class MultiplyByTwo implements IFunction<Long, Long> { @Override public Long apply(Long input) { return input * 2L; } }
getAtomicLong metodu
Örnek
Şöyle yaparız
HazelcastInstance instance = ... IAtomicLong counter = instance.getCPSubsystem().getAtomicLong("counter"); counter.incrementAndGet();
Hiç yorum yok:
Yorum Gönder