diff --git a/atlas-core/src/main/scala/com/netflix/atlas/core/util/InternMap.scala b/atlas-core/src/main/scala/com/netflix/atlas/core/util/InternMap.scala index df38b3c04..807a63517 100644 --- a/atlas-core/src/main/scala/com/netflix/atlas/core/util/InternMap.scala +++ b/atlas-core/src/main/scala/com/netflix/atlas/core/util/InternMap.scala @@ -123,21 +123,15 @@ class ConcurrentInternMap[K <: AnyRef](newMap: => InternMap[K], concurrencyLevel if (i < 0) -1 * i else i } - private def lock[R](key: K)(f: InternMap[K] => R): R = { - val i = index(key) + def intern(k: K): K = { + val i = index(k) locks(i).lock() - try f(segments(i)) + try segments(i).intern(k) finally { locks(i).unlock() } } - def intern(k: K): K = { - lock(k) { m => - m.intern(k) - } - } - def retain(f: Long => Boolean): Unit = { (0 until concurrencyLevel).foreach { i => locks(i).lock()