mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 15:19:59 +07:00
[Workspace Model][IJPL-161667] Replace put with putIsAbsent in ImmutableEntityStorageImpl.initializeEntity
It does not make sense to replace a value in `entityCache` if it was concurrently inserted by someone else. GitOrigin-RevId: f28ff2357ced479942bef3c05483d5106a757d34
This commit is contained in:
committed by
intellij-monorepo-bot
parent
e517d0e1e8
commit
eefc6bb21f
@@ -95,9 +95,10 @@ internal open class ImmutableEntityStorageImpl(
|
||||
}
|
||||
|
||||
val newData = newInstance()
|
||||
entityCache.put(entityId, newData)
|
||||
val inserted = entityCache.putIfAbsent(entityId, newData) ?: newData
|
||||
|
||||
return newData
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
return inserted as T
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
Reference in New Issue
Block a user