Github user danny0405 commented on the issue:

    https://github.com/apache/storm/pull/2800
  
    @srdo 
    Okey, i checkout the AtomicReference for jdk8 and get the code snippet:
    ```java
    public final V getAndUpdate(UnaryOperator<V> updateFunction) {
            V prev, next;
            do {
                prev = get();
                next = updateFunction.apply(prev);
            } while (!compareAndSet(prev, next));
            return prev;
        }
    ```
    For our storm use cases, we never update the
    ```java
    AtomicReference<Map<String, Map<List<Integer>, Map<String, Object>>>> 
heartbeatsCache
    ```
    reference, so we use it totally as a normal HashMap, and there lost the 
thread safety.
    
    I think `CincurrentHashMap` is better.


---

Reply via email to