/** * Increments and then return current cache version. Atomic. */ public long incrementAndGet() { return version.incrementAndGet(); }
@Override public Long next() { // return idGen.incrementAndGet(); }
@Override public long incrementAndGet() { return atomicNumber.incrementAndGet(); }
private void increment(Exchange exchange) { exchange.getOut().setBody(this.atomicnumber.incrementAndGet()); }
public final byte[] getNextJobHandle() { String handle = "H:".concat(clusterHostname).concat(":").concat(String.valueOf(jobHandleCounter.incrementAndGet())); return handle.getBytes(); }
@TimeStep(prob = 0.1) public void write(ThreadState state) { state.randomCounter().incrementAndGet(); state.increments++; }
@Override public void run() { ExecutorTest test = (ExecutorTest) hz.getUserContext().get(TestUtils.TEST_INSTANCE + ":" + testId); test.executedCounter.incrementAndGet(); }
public static void notifyStartupComplete() { logger.info("Notify other nodes that startup completed"); IAtomicLong initMarker = getHazelcastInstance().getAtomicLong("initMarker"); initMarker.incrementAndGet(); }
@Override public void run() { ExecutorTest test = (ExecutorTest) hz.getUserContext().get(getUserContextKeyFromTestId(testId)); test.executedCounter.incrementAndGet(); }
public static void notifyStartupComplete() { logger.info("Notify other nodes that startup completed"); IAtomicLong initMarker = getHazelcastInstance().getAtomicLong("initMarker"); initMarker.incrementAndGet(); }
public static void main(String[] args) { HazelcastInstance hz = Hazelcast.newHazelcastInstance(); IAtomicLong counter = hz.getAtomicLong("counter"); for (int i = 0; i < 1000 * 1000; i++) { if (i % 500000 == 0) { System.out.println("At: " + i); } counter.incrementAndGet(); } System.out.println(format("Count is %s", counter.get())); Hazelcast.shutdownAll(); } }
@ManagedAnnotation(value = "incrementAndGet", operation = true) @ManagedDescription("increment the current value then get") public long incrementAndGet() { return managedObject.incrementAndGet(); }
@ManagedAnnotation(value = "incrementAndGet", operation = true) @ManagedDescription("increment the current value then get") public long incrementAndGet() { return managedObject.incrementAndGet(); }
@TimeStep public void timeStep() { long key = keyCounter.incrementAndGet(); map.put(key, "test value"); }
private void handleAtomicNumberInc(String[] args) { println(getAtomicNumber().incrementAndGet()); }
private void handleAtomicNumberInc(String[] args) { println(getAtomicNumber().incrementAndGet()); }
@Override public void run() { long iteration = 0; while (!testContext.isStopped()) { counter.incrementAndGet(); if (iteration % logFrequency == 0) { log.info(Thread.currentThread().getName() + " At iteration: " + iteration); } if (iteration % performanceUpdateFrequency == 0) { operations.addAndGet(performanceUpdateFrequency); } iteration++; } totalCounter.addAndGet(iteration); }
private void handleAtomicNumberInc(String[] args) { println(getAtomicNumber().incrementAndGet()); }
private void handleAtomicNumberInc(String[] args) { println(getAtomicNumber().incrementAndGet()); }
public static void main(String[] args) throws Exception { HazelcastInstance hz = Hazelcast.newHazelcastInstance(); ISemaphore semaphore = hz.getSemaphore("semaphore"); IAtomicLong resource = hz.getAtomicLong("resource"); for (int i = 0; i < 1000; i++) { System.out.println("At iteration: " + i + ", Active Threads: " + resource.get()); semaphore.acquire(); try { resource.incrementAndGet(); Thread.sleep(1000); resource.decrementAndGet(); } finally { semaphore.release(); } } System.out.println("Finished"); } }