The result of AtomicLong.incrementAndGet() is used rather than
incrementing the long and reading its value separately. The
previous approach allowed for the static counter to be incremented
several times before any caller read the value, resulting in
several callers with the same value.
incrementing the long and reading its value separately. The
previous approach allowed for the static counter to be incremented
several times before any caller read the value, resulting in
several callers with the same value.