title: How to get truly atomic update for TrieMap.getOrElseUpdate
body: <p>As I understand, <code>TrieMap.getOrElseUpdate</code> is still not truly atomic, and  <a href="https://issues.scala-lang.org/browse/SI-7943" rel="nofollow">this</a> fixes only returned result (it could return different instances for different callers before this fix), so the updater function still might be called several times, as documentation (for 2.11.7) says:</p>
  
  <blockquote>
    <p>Note: This method will invoke op at most once. However, op may be invoked without the result being added to the map if a concurrent process is also trying to add a value corresponding to the same key k.</p>
  </blockquote>
  
  <p>*I've checked that manually for 2.11.7, still "at least once"</p>
  
  <p>How to guarantee one-time call (if I use TrieMap for factories)?</p>