LongAdder

Learn why LongAdder can be a better choice for computing statistics in a multithreaded environment than AtomicLong.

We'll cover the following...

If you are interviewing, consider buying our number#1 course for Java Multithreading Interviews.

Overview

Consider a scenario where you are hosting an API service and need to maintain a running count of all the invocations of a particular API endpoint. You could use AtomicLong for the occasion as a counter but if you expect several concurrent requests ...