Using An AtomicLong With A Modulo Operation May Be Faster Than Using compareAndSet() For Thread-Safe Range-Based Counters

    0
    114
    views

    Last week, I looked at using Java’s AtomicInteger class in order to loop over a range of numbers in a thread-safe manner without having to add any additional locking to the code. The core of the logic revolved around executing a while(true) loop that repeatedly invoked a .compareAndSet() method u… read more »

    Read More : https://www.bennadel.com//blog/3427-using-an-atomiclong-with-a-modulo-operation-may-be-faster-than-using-compareandset-for-thread-safe-range-based-counters.htm

    LEAVE A REPLY

    Please enter your comment!
    Please enter your name here