List of utility methods to do AtomicInteger
void | resetCounter() reset Counter counter = new AtomicInteger(0);
|
void | resetCounters() reset Counters counters.clear(); |
Map | resetExceptionCount() reset Exception Count Map<String, AtomicInteger> cur = exceptionCount; exceptionCount = new ConcurrentHashMap<String, AtomicInteger>(); criticalCount.set(0); exceptionTimefrom = System.currentTimeMillis(); singleMax = 0; singleMaxName = ""; return getCountMap(cur); |
boolean | setBit(AtomicInteger i, int mask) Atomically sets a bit (or bits) for an AtomicInteger. boolean success = false; while (!success) { int current = i.get(); if ((current & mask) != 0) { return false; int next = current | mask; success = i.compareAndSet(current, next); ... |
void | setBitByValue(final AtomicInteger ai, final int value) set Bit By Value setBitByIndex(ai, Integer.numberOfTrailingZeros(value)); |
boolean | setBitIfUnsetByIndex(final AtomicInteger ai, final int n) set Bit If Unset By Index if (n >= Integer.SIZE) { throw new IllegalArgumentException("Out of int bit index boundary (31)"); int bitInt = 1 << n; int oldValue = ai.get(); int newValue = oldValue | bitInt; while (newValue != oldValue && !ai.compareAndSet(oldValue, newValue)) { oldValue = ai.get(); ... |
void | storeStoreBarrier() store Store Barrier ai.lazySet(-1); |
long | timeToId(long timeInMillis) time To Id if (serial.intValue() > 9900 * BASE) { serial.set(BASE); return timeInMillis / 1000 * 1000000000 + serial.getAndAdd(BASE) + RANDOM.nextInt(BASE); |
Map | tokenize(String string) Parse the given string and return a list of the whitespace-delimited tokens that it contains mapped to the number of occurrences of each token. Map<String, AtomicInteger> result = new HashMap<String, AtomicInteger>(); String[] tokens = string.split("\\s"); for (String token : tokens) { if (token.length() == 0) { continue; String tokenDown = token.toLowerCase(); AtomicInteger count = result.get(tokenDown); ... |
int | uniqueSequenceId() Generates a process-wide unique sequence number. return sequence.incrementAndGet();
|