Github user AlexShvedoff commented on the issue:

    https://github.com/apache/metamodel/pull/175
  
    It doesn't look like .add is threadsafe.  Per the ArrayList overview docs, 
you might be left with the impression that as long as sufficient max capacity 
has been pre alloc'd you're thread-safe.  But if you look at the implementation 
of .add:
    
    457     public boolean More ...add(E e) {
    458         ensureCapacityInternal(size + 1);  // Increments modCount!!
    459         elementData[size++] = e;
    460         return true;
    461     }
    
    That elementData[size++] is definitely not atomic, so it's possible for 
concurrent threads to step on each other and overwrite the same array slot.
    
    But yeah, we are ok here since the ArrayList being used is definitely not 
shared between threads.


---

Reply via email to