Java Utililty Methods AtomicInteger

List of utility methods to do AtomicInteger

Description

The list of methods to do AtomicInteger are organized into topic(s).

Method

voiddecrementStoredNoOfParts()
decrement Stored No Of Parts
storedNoOfParts.decrementAndGet();
intdecrementVxlanGpeRefCnt(final String vxlanGpePortKey, final String vppNode)
decrement Vxlan Gpe Ref Cnt
if (VXLAN_GPER_PORT_REF_CNT.get(vppNode) == null) {
    return 0;
if (VXLAN_GPER_PORT_REF_CNT.get(vppNode).get(vxlanGpePortKey) == null) {
    return 0;
return VXLAN_GPER_PORT_REF_CNT.get(vppNode).get(vxlanGpePortKey).decrementAndGet();
voiddecrementWheelsCount()
decrement Wheels Count
synchronized (activeFutures) {
    activeFutures.incrementAndGet();
    activeFutures.notify();
intdeleteIndexedFields(Set fieldsToDelete, List fields, Map fieldIndexLookupMap)
Given a list of Strings and a map holding the index of each string, this method removes the strings and re-builds the index.
List<String> copy = new ArrayList<String>(fields);
fields.clear();
int singleIndex = -1;
if (fieldsToDelete.size() == 1) {
    final AtomicInteger index = fieldIndexLookupMap.get(fieldsToDelete.iterator().next());
    if (index != null) {
        singleIndex = index.intValue();
final int size = copy.size();
String fieldName;
int i;
for (i = 0; i < size; i++) {
    fieldName = copy.get(i);
    if (!fieldsToDelete.remove(fieldName)) {
        fields.add(fieldName);
fieldIndexLookupMap.clear();
for (i = 0; i < fields.size(); i++) {
    fieldIndexLookupMap.put(fields.get(i), new AtomicInteger(i));
return singleIndex;
String[]encodeMap(Map map)
encode Map
String[] array = new String[map.size()];
AtomicInteger integer = new AtomicInteger(0);
map.forEach((key, value) -> array[integer.getAndIncrement()] = key + "-" + value);
return array;
intgenerateUniqueId()
Generate unique id int.
for (;;) {
    final int result = sNextGeneratedId.get();
    int newValue = result + 1;
    if (newValue > 0x00FFFFFF)
        newValue = 1;
    if (sNextGeneratedId.compareAndSet(result, newValue)) {
        return result;
intgetAllocationFailureCount()
Returns the number of allocation failures since the application started.
return ALLOCATION_FAILURE_COUNT.get();
intgetAndResetInvocationCount()
get And Reset Invocation Count
return getAndResetInvocationCount(DEFAULT_COUNTER);
intgetAndResetInvocationCount()
get And Reset Invocation Count
return COUNTER.getAndSet(0);
intgetCriticalExceptionCount()
get Critical Exception Count
int ret = criticalCount.get();
return ret;